mirror of
https://github.com/YMFE/yapi.git
synced 2024-12-09 05:00:30 +08:00
添加 eslint
This commit is contained in:
parent
5d65476e7b
commit
0970534f65
36
.eslintrc.json
Normal file
36
.eslintrc.json
Normal file
@ -0,0 +1,36 @@
|
||||
{
|
||||
"env": {
|
||||
"browser": true,
|
||||
"commonjs": true
|
||||
},
|
||||
"extends": [],
|
||||
"globals": [
|
||||
"$",
|
||||
"$$",
|
||||
"jQuery",
|
||||
"Promise"
|
||||
],
|
||||
"rules": {
|
||||
"no-with": "error",
|
||||
"no-octal": "error",
|
||||
"no-undef": "error",
|
||||
"no-dupe-keys": "error",
|
||||
"no-dupe-args": "error",
|
||||
"no-delete-var": "error",
|
||||
"no-unused-vars": "error",
|
||||
"no-caller": "error",
|
||||
"no-debugger": "error",
|
||||
"no-unreachable": "error",
|
||||
"no-inner-declarations": [
|
||||
"error",
|
||||
"functions"
|
||||
]
|
||||
},
|
||||
"ignorePattern": [
|
||||
"/fekit_modules/*",
|
||||
"/node_modules/*",
|
||||
"/bower_components/*",
|
||||
"/dev/*",
|
||||
"/prd/*"
|
||||
]
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
import './Header.scss'
|
||||
import React, { Component } from 'react'
|
||||
import { BrowserRouter as Router, Route, Link } from 'react-router-dom'
|
||||
import { Link } from 'react-router-dom'
|
||||
|
||||
class Header extends Component {
|
||||
constructor(props) {
|
||||
@ -29,4 +29,4 @@ class Header extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
export default Header
|
||||
export default Header
|
||||
|
@ -1,9 +1,7 @@
|
||||
// import { React, Component } from '../../base.js'
|
||||
import './Home.scss'
|
||||
import React, { Component } from 'react'
|
||||
import { Button, Input, Icon, Checkbox } from 'antd'
|
||||
import Header from '../../components/Header/Header.js'
|
||||
import { BrowserRouter as Router, Route, Link } from 'react-router-dom'
|
||||
|
||||
class Home extends Component {
|
||||
constructor(props) {
|
||||
@ -19,4 +17,4 @@ class Home extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
export default Home
|
||||
export default Home
|
||||
|
@ -1,16 +1,19 @@
|
||||
// import { React, Component } from '../../base.js'
|
||||
import './Login.scss'
|
||||
import React, { Component } from 'react'
|
||||
import PropTypes from 'prop-types'
|
||||
import { Button, Input, Icon, Checkbox } from 'antd'
|
||||
import { BrowserRouter as Router, Route, Link } from 'react-router-dom'
|
||||
import './Login.scss'
|
||||
|
||||
class Login extends Component {
|
||||
constructor(props) {
|
||||
super(props)
|
||||
}
|
||||
|
||||
static propTypes = {
|
||||
value: PropTypes.string,
|
||||
per: PropTypes.string,
|
||||
}
|
||||
|
||||
render () {
|
||||
console.log(this.props)
|
||||
return (
|
||||
<acticle className="login-main">
|
||||
<span>{this.props.value}{this.props.per}</span>
|
||||
@ -29,7 +32,7 @@ class Login extends Component {
|
||||
|
||||
<div className="login">
|
||||
<Checkbox>记住密码</Checkbox>
|
||||
<Button type="primary">登录</Button>
|
||||
<Button type="primary">登录</Button>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
@ -1,12 +1,10 @@
|
||||
import React, { Component } from 'react'
|
||||
import { createStore, combineReducers } from 'redux'
|
||||
import { connect } from 'react-redux'
|
||||
import Login from './Login.js'
|
||||
|
||||
// Action
|
||||
const increaseAction = { type: 'increase' }
|
||||
|
||||
function mapStateToProps(state) {
|
||||
function mapStateToProps() {
|
||||
return {
|
||||
per: '测试数据',
|
||||
}
|
||||
@ -24,4 +22,3 @@ const App = connect(
|
||||
)(Login)
|
||||
|
||||
export default App
|
||||
|
||||
|
@ -1,5 +1,3 @@
|
||||
import React, { Component } from 'react'
|
||||
|
||||
export default function (state = 3, action) {
|
||||
const count = state
|
||||
switch (action.type) {
|
||||
|
@ -27,6 +27,7 @@
|
||||
"mongoose": "4.10.8",
|
||||
"mongoose-auto-increment": "^5.0.1",
|
||||
"node-sass-china": "^4.5.0",
|
||||
"prop-types": "^15.5.10",
|
||||
"redux": "^3.7.1",
|
||||
"ykit-config-antd": "^0.1.3",
|
||||
"ykit-config-react": "^0.4.4"
|
||||
|
10
ykit.js
10
ykit.js
@ -2,7 +2,13 @@ var path = require('path');
|
||||
var ExtractTextPlugin = require("extract-text-webpack-plugin");
|
||||
|
||||
module.exports = {
|
||||
plugins: ['qunar', 'antd'],
|
||||
plugins: [{
|
||||
name: 'qunar',
|
||||
options: {
|
||||
eslint: true,
|
||||
configFile: path.resolve(__dirname, "./client/.eslintrc.js")
|
||||
}
|
||||
}, 'antd'],
|
||||
devtool: 'cheap-source-map',
|
||||
config: {
|
||||
exports: [
|
||||
@ -17,7 +23,7 @@ module.exports = {
|
||||
// true/false,默认 false,效果相当于 ykit server --hot
|
||||
hot: true,
|
||||
// true/false,默认 false,开启后可在当前打开的页面提示打包错误
|
||||
overlay: true
|
||||
overlay: true
|
||||
},
|
||||
hooks: {},
|
||||
commands: []
|
||||
|
Loading…
Reference in New Issue
Block a user