Skip to content

Commit 9497215

Browse files
Add ESLint as the default linter
- Create `.eslintrc` and `.eslintignore` - Add the above files to `.npmignore` - Save `eslint` to devDependencies - Create task `npm run lint` that lints `lib` and `test` directory Documentation: http://eslint.org
1 parent 9970b64 commit 9497215

File tree

4 files changed

+39
-1
lines changed

4 files changed

+39
-1
lines changed

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.json

.eslintrc

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"env": {
3+
"node": true,
4+
"browser": true,
5+
"mocha": true,
6+
"commonjs": true
7+
},
8+
9+
"extends": "eslint:recommended",
10+
11+
"rules": {
12+
"indent": [
13+
"error",
14+
4,
15+
{ SwitchCase: 1 }
16+
],
17+
"linebreak-style": [
18+
"error",
19+
"unix"
20+
],
21+
"quotes": [
22+
"error",
23+
"single"
24+
],
25+
"semi": [
26+
"error",
27+
"always"
28+
],
29+
"strict": 2,
30+
"no-unused-vars": 2,
31+
"no-cond-assign": 2,
32+
"camelcase": 1
33+
}
34+
}

.npmignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
test
2+
.eslint*

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
"author": "Mark <mark@remarkablemark.org>",
66
"main": "index.js",
77
"scripts": {
8-
"test": "mocha"
8+
"test": "mocha",
9+
"lint": "eslint index.js \"lib/**\" \"test/**\""
910
},
1011
"repository": {
1112
"type": "git",
@@ -26,6 +27,7 @@
2627
"htmlparser2": "^3.9.1"
2728
},
2829
"devDependencies": {
30+
"eslint": "^3.3.1",
2931
"jsdomify": "^2.1.0",
3032
"mocha": "^3.0.2",
3133
"react": "^15.3.0",

0 commit comments

Comments
 (0)