Skip to content

Commit 15c4d35

Browse files
committed
Adds prettier, adds precommit lint hook
1 parent 9c054d9 commit 15c4d35

File tree

3 files changed

+203
-6
lines changed

3 files changed

+203
-6
lines changed

.eslintrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ module.exports = {
2121
"rules": {
2222
"arrow-parens": [
2323
"error",
24-
"always"
24+
"as-needed"
2525
],
2626
"arrow-body-style": [
2727
2,

package.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"main": "lib/react-d3-tree.min.js",
66
"scripts": {
77
"clean:lib": "rimraf lib/*",
8+
"precommit": "lint-staged",
89
"build": "yarn clean:lib && webpack --progress --colors --env build",
910
"dev": "yarn clean:lib && webpack --progress --colors --watch --env dev",
1011
"lint": "eslint .",
@@ -21,6 +22,13 @@
2122
"preanalyze": "rimraf stats.json",
2223
"analyze": "webpack --config webpack.config.js --env build --profile --json > stats.json && echo '==> http://webpack.github.io/analyse/'"
2324
},
25+
"lint-staged": {
26+
"src/**/*.js": [
27+
"eslint",
28+
"prettier --write --single-quote --trailing-comma=all",
29+
"git add"
30+
]
31+
},
2432
"jest": {
2533
"collectCoverageFrom": [
2634
"src/**/*.{js,jsx}",
@@ -69,10 +77,13 @@
6977
"eslint-plugin-import": "^2.2.0",
7078
"eslint-plugin-jsx-a11y": "^4.0.0",
7179
"eslint-plugin-react": "^6.10.0",
80+
"husky": "^0.14.3",
7281
"jest": "^19.0.2",
7382
"jsdoc-to-markdown": "^3.0.0",
83+
"lint-staged": "^4.1.3",
7484
"np": "^2.16.0",
7585
"postcss-loader": "^1.3.3",
86+
"prettier": "^1.6.1",
7687
"react": "^15.6.0",
7788
"react-docgen": "^2.16.0",
7889
"react-dom": "^15.6.0",

0 commit comments

Comments
 (0)