Skip to content

Commit 7a99711

Browse files
committed
test
1 parent dfa776d commit 7a99711

File tree

5 files changed

+633
-12
lines changed

5 files changed

+633
-12
lines changed

.eslintrc.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
module.exports = {
2-
"extends": "airbnb",
2+
"extends": [
3+
"airbnb",
4+
"plugin:prettier/recommended",
5+
],
36
"rules": {
47
"react/jsx-filename-extension": "off",
58
"react/forbid-prop-types": "off",
@@ -10,6 +13,7 @@ module.exports = {
1013
"jsx-a11y/anchor-is-valid": "off",
1114
"react/no-array-index-key": "off",
1215
"no-console": "off",
16+
"prettier/prettier": "error"
1317
},
1418
"env": {
1519
"browser": true,

.prettierrc.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module.exports = {
2+
printWidth: 120, //一行的字符数,如果超过会进行换行,默认为80
3+
tabWidth: 2 //一个tab代表几个空格数,默认为2
4+
};

config/webpack.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ module.exports = function(webpackEnv) {
327327
formatter: require.resolve('react-dev-utils/eslintFormatter'),
328328
eslintPath: require.resolve('eslint'),
329329
resolvePluginsRelativeTo: __dirname,
330-
330+
fix: true,
331331
},
332332
loader: require.resolve('eslint-loader'),
333333
},

package.json

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
"react-dom": "^16.9.0",
5656
"react-redux": "^7.1.1",
5757
"react-router": "^5.1.2",
58+
"react-transition-group": "^4.3.0",
5859
"redux": "^4.0.4",
5960
"redux-logger": "^3.0.6",
6061
"redux-thunk": "^2.3.0",
@@ -71,8 +72,23 @@
7172
"webpack": "4.39.1",
7273
"webpack-dev-server": "3.2.1",
7374
"webpack-manifest-plugin": "2.0.4",
74-
"workbox-webpack-plugin": "4.3.1",
75-
"react-transition-group": "^4.3.0"
75+
"workbox-webpack-plugin": "4.3.1"
76+
},
77+
"husky": {
78+
"hooks": {
79+
"pre-commit": "lint-staged"
80+
}
81+
},
82+
"lint-staged": {
83+
"src/*.{js,jsx,mjs,ts,tsx}": [
84+
"node_modules/.bin/prettier --write",
85+
"node_modules/.bin/eslint --fix",
86+
"git add"
87+
],
88+
"src/*.{css,scss,less,json,html,md,markdown}": [
89+
"node_modules/.bin/prettier --write",
90+
"git add"
91+
]
7692
},
7793
"scripts": {
7894
"start": "node scripts/start.js",
@@ -148,6 +164,10 @@
148164
]
149165
},
150166
"devDependencies": {
167+
"eslint-plugin-prettier": "^3.1.1",
168+
"husky": "^3.1.0",
169+
"lint-staged": "^9.4.3",
170+
"prettier": "^1.19.1",
151171
"react-router-dom": "^5.0.1",
152172
"react-transition-group": "^4.3.0"
153173
},

0 commit comments

Comments
 (0)