Skip to content

Commit c9fa8af

Browse files
committed
update style-laoder,css-loader,eslint,husky;add stylelint
1 parent ff41b15 commit c9fa8af

File tree

4 files changed

+1409
-1159
lines changed

4 files changed

+1409
-1159
lines changed

.eslintrc.js

Lines changed: 29 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,51 +25,65 @@ module.exports = {
2525
},
2626
'ecmaVersion': 2018,
2727
'sourceType': 'module',
28-
// 'project': './tsconfig.json'
28+
'project': './tsconfig.json'
2929
},
3030
'plugins': [
3131
'react',
32-
'@typescript-eslint',
33-
// 'prettier'
32+
'@typescript-eslint'
3433
],
3534
'rules': {
3635
'no-undef': 0,
37-
// 'indent': [ 'error', 2 ],
38-
'linebreak-style': [ 'error', 'unix' ],
39-
'quotes': [ 'error', 'single' ],
40-
'semi': [ 2, 'never' ],
41-
'no-unused-vars': 'off',
36+
'indent': 0,
37+
'linebreak-style': [ 2, 'unix' ],
38+
'quotes': 0,
39+
'semi': 0,
40+
'no-unused-vars': 0,
4241
'prefer-spread': 0,
4342
'prefer-const': 0,
4443
'switch-colon-spacing': [2, {'after': true, 'before': true}],
4544
'default-case': 2,
4645
'no-spaced-func': 2,
4746
'no-case-declarations': 0,
47+
'space-before-function-paren': 0,
48+
'keyword-spacing': 0,
49+
'key-spacing': 2,
50+
'comma-spacing': 0,
51+
'space-before-blocks': 2,
52+
'arrow-spacing': 2,
53+
'semi-spacing': 2,
54+
'no-irregular-whitespace': 2,
55+
4856
// react jsx
4957
'react/display-name': 0,
50-
'react/jsx-filename-extension': 'off',
51-
'react/jsx-first-prop-new-line': 'off',
52-
'react/jsx-indent': [ 'error', 2 ],
58+
'react/jsx-filename-extension': 0,
59+
'react/jsx-first-prop-new-line': 0,
60+
'react/jsx-indent': [ 2, 2 ],
5361
'react/jsx-indent-props': [2, 2],
5462
'react/prop-types': 0,
63+
'react/jsx-key': 2,
5564

56-
// @typescript-eslint
65+
// @typescript-eslint
66+
'@typescript-eslint/quotes': [2, 'single'],
5767
'@typescript-eslint/indent': [2, 2],
5868
'@typescript-eslint/camelcase': 0,
5969
'@typescript-eslint/explicit-function-return-type': 0,
6070
'@typescript-eslint/no-non-null-assertion': 0,
6171
'@typescript-eslint/no-use-before-define': 0,
6272
'@typescript-eslint/member-delimiter-style': 0,
6373
'@typescript-eslint/no-unused-vars': 0,
64-
'@typescript-eslint/no-use-before-define': 0,
6574
'@typescript-eslint/no-explicit-any': 0,
6675
'@typescript-eslint/explicit-member-accessibility': 0,
6776
'@typescript-eslint/no-angle-bracket-type-assertion': 0,
6877
'@typescript-eslint/interface-name-prefix': 0,
6978
'@typescript-eslint/no-empty-function': 1,
70-
'@typescript-eslint/semi': 0,
79+
'@typescript-eslint/semi': [2, 'never'],
7180
'@typescript-eslint/no-inferrable-types': 0,
7281
'@typescript-eslint/no-empty-interface': 1,
7382
'@typescript-eslint/class-name-casing': 0,
83+
'@typescript-eslint/explicit-module-boundary-types': 0,
84+
'@typescript-eslint/space-before-function-paren': [2],
85+
'@typescript-eslint/keyword-spacing': [2, ],
86+
'@typescript-eslint/comma-spacing': 2,
87+
'@typescript-eslint/type-annotation-spacing': 2
7488
}
75-
};
89+
}

.stylelintrc.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
2+
module.exports = {
3+
'extends': 'stylelint-config-standard',
4+
'rules': {
5+
'selector-list-comma-newline-after': 'never-multi-line',
6+
'value-list-comma-newline-after': 'never-multi-line',
7+
'selector-pseudo-class-no-unknown': null,
8+
'declaration-colon-newline-after': null,
9+
'no-descending-specificity': null,
10+
'max-empty-lines': 2
11+
},
12+
ignoreFiles: [
13+
'node_modules/**/*',
14+
'public/**/*',
15+
'dist/**/*',
16+
'**/*.js',
17+
'**/*.jsx',
18+
'**/*.tsx',
19+
'**/*.ts'
20+
]
21+
}

package.json

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
"dev": "NODE_ENV=development webpack-dev-server --config build/webpack.dev.conf.js",
1111
"build": "NODE_ENV=production webpack --config build/webpack.prod.conf.js",
1212
"lint": "eslint --ext ts,tsx src/",
13-
"lint:fix": "eslint --ext ts,tsx src/ --fix"
13+
"lint:fix": "eslint --ext ts,tsx src/ --fix",
14+
"lintcss": "stylelint --syntax scss src/**/*.scss",
15+
"lintcss:fix": "stylelint --syntax scss src/**/*.scss --fix"
1416
},
1517
"repository": {
1618
"type": "git",
@@ -43,25 +45,26 @@
4345
"@types/react": "^16.7.7",
4446
"@types/react-dom": "^16.0.10",
4547
"@types/react-router-dom": "^4.3.1",
46-
"@typescript-eslint/eslint-plugin": "^2.4.0",
47-
"@typescript-eslint/parser": "^2.4.0",
48+
"@typescript-eslint/eslint-plugin": "^4.10.0",
49+
"@typescript-eslint/parser": "^4.10.0",
4850
"babel-loader": "^8.0.4",
4951
"clean-webpack-plugin": "^0.1.19",
5052
"copy-webpack-plugin": "^7.0.0",
51-
"css-loader": "^1.0.1",
52-
"eslint": "^6.5.1",
53-
"eslint-plugin-react": "^7.16.0",
53+
"css-loader": "^5.0.1",
54+
"eslint": "^7.15.0",
55+
"eslint-plugin-react": "^7.21.5",
5456
"html-webpack-plugin": "^4.5.0",
55-
"husky": "^3.0.9",
56-
"lint-staged": "^9.4.2",
57+
"husky": "^4.3.6",
58+
"lint-staged": "^10.5.3",
5759
"mini-css-extract-plugin": "^1.3.3",
5860
"node-sass": "^5.0.0",
5961
"optimize-css-assets-webpack-plugin": "^5.0.1",
6062
"postcss-loader": "^4.1.0",
6163
"postcss-preset-env": "^6.7.0",
6264
"sass-loader": "^10.1.0",
63-
"style-loader": "^0.23.1",
64-
"sw-precache-webpack-plugin": "^0.11.5",
65+
"style-loader": "^2.0.0",
66+
"stylelint": "^13.8.0",
67+
"stylelint-config-standard": "^20.0.0",
6568
"typescript": "^3.6.4",
6669
"uglifyjs-webpack-plugin": "^2.0.1",
6770
"url-loader": "^1.1.2",
@@ -79,8 +82,10 @@
7982
},
8083
"lint-staged": {
8184
"src/**/*.{js,jsx,ts,tsx}": [
82-
"npm run lint:fix",
83-
"git add"
85+
"npm run lint:fix"
86+
],
87+
"src/**/*.{css,scss}": [
88+
"npm run lintcss:fix"
8489
]
8590
}
8691
}

0 commit comments

Comments
 (0)