Skip to content

Commit 8e238aa

Browse files
committed
Add eslint
1 parent e92c2f0 commit 8e238aa

File tree

5 files changed

+46
-7
lines changed

5 files changed

+46
-7
lines changed

.eslintignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules
2+
**/bundle.js
3+
webpack.config.js

.eslintrc

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"extends": "eslint:recommended",
3+
"root": true,
4+
"env": {
5+
"browser": true,
6+
"es6": true,
7+
"amd": true
8+
},
9+
"ecmaFeatures": {
10+
"jsx": true
11+
},
12+
"rules": {
13+
"semi": [2, "always"],
14+
"curly": 2,
15+
"dot-notation": 2,
16+
"radix": 2,
17+
"wrap-iife": 2,
18+
"eqeqeq": 2,
19+
"block-scoped-var": 2,
20+
"consistent-return": 2,
21+
"no-alert": 2,
22+
"no-new-wrappers": 2,
23+
"no-native-reassign": 2,
24+
"no-extend-native": 2,
25+
"no-implicit-coercion": 2,
26+
"no-sequences": 2,
27+
"no-unused-expressions": 2,
28+
"no-useless-call": 2,
29+
"no-useless-concat": 2,
30+
"no-warning-comments": 2,
31+
"no-shadow-restricted-names": 2,
32+
"no-undef-init": 2,
33+
"no-with": 2
34+
}
35+
}

package.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
"babel-loader": "^5.3.2",
2121
"jquery": "^2.1.4",
2222
"react": "^0.13.3",
23-
"webpack": "^1.11.0"
23+
"webpack": "^1.11.0",
24+
"eslint": "^1.6.0",
25+
"eslint-loader": "^1.0.0"
2426
}
2527
}

src/main/js/app.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
const React = require("react");
22
const $ = require("jquery");
33

4+
/* eslint no-unused-vars: 0 */
45
const App = React.createClass({
56
render() {
67
return (
78
<h1>Hello {this.state.name}</h1>
8-
)
9+
);
910
},
1011

1112
getInitialState() {
12-
return {name: "World"}
13+
return {name: "World"};
1314
},
1415

1516
componentDidMount() {

webpack.config.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,8 @@ module.exports = {
1111
},
1212
module: {
1313
loaders: [
14-
{
15-
test: path.join(__dirname, 'src/main/js'),
16-
loader: 'babel-loader'
17-
}
14+
{test: path.join(__dirname, 'src/main/js'), loader: 'babel-loader'},
15+
{test: path.join(__dirname, 'src/main/js'), loader: 'eslint-loader'}
1816
]
1917
}
2018
};

0 commit comments

Comments
 (0)