Skip to content

Commit 2352b49

Browse files
committed
Add linting to CI, precommit
1 parent 4db60e4 commit 2352b49

File tree

4 files changed

+473
-8
lines changed

4 files changed

+473
-8
lines changed

.eslintrc.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
module.exports = {
2-
extends: ["airbnb-base", "prettier"]
3-
};
2+
extends: ['airbnb-base', 'prettier'],
3+
plugins: ['prettier'],
4+
rules: {
5+
'prettier/prettier': 2,
6+
},
7+
}

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ script:
77
- node --version
88
- yarn --version
99
- yarn run test
10+
- yarn run lint
1011
notifications:
1112
email:
1213
on_failure: change

package.json

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@
77
"build": "babel src --ignore test.js --out-dir dist",
88
"test": "jest",
99
"test:watch": "jest --watch",
10-
"prepublish": "npm run build"
10+
"lint": "eslint src",
11+
"prepublish": "npm run build",
12+
"precommit": "lint-staged",
13+
"lint-staged": "lint-staged"
1114
},
1215
"files": [
1316
"dist",
@@ -37,12 +40,20 @@
3740
"eslint-config-airbnb-base": "^10.0.1",
3841
"eslint-config-prettier": "^2.9.0",
3942
"eslint-plugin-import": "^2.2.0",
43+
"eslint-plugin-prettier": "^2.6.0",
4044
"jest": "^17.0.0",
45+
"lint-staged": "^6.1.0",
4146
"prettier": "^1.10.2"
4247
},
4348
"dependencies": {
4449
"css-color-keywords": "^1.0.0",
4550
"fbjs": "^0.8.5",
4651
"postcss-value-parser": "^3.3.0"
52+
},
53+
"lint-staged": {
54+
"*.js": [
55+
"eslint --fix",
56+
"git add"
57+
]
4758
}
4859
}

0 commit comments

Comments
 (0)