Skip to content

Commit 7fec907

Browse files
author
sunss
committed
chore(.eslint.js): 优化结构
1 parent acca004 commit 7fec907

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

.eslintrc.js

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ const prettierOptions = JSON.parse(fs.readFileSync(path.resolve(__dirname, '.pre
66
module.exports = {
77
parser: '@typescript-eslint/parser',
88
extends: [
9-
'airbnb-typescript',
10-
'prettier',
9+
'airbnb-typescript', // 使用 airbnb 拓展插件库
10+
'prettier', // prettier 已自带 prettier/react、prettier/@typescript-eslint
1111
// 'prettier/react',
1212
// 'prettier/@typescript-eslint',
1313
],
@@ -28,6 +28,21 @@ module.exports = {
2828
project: './tsconfig.eslint.json',
2929
// project: {},
3030
},
31+
settings: {
32+
'import/parsers': {
33+
'@typescript-eslint/parser': ['.ts', '.tsx'],
34+
},
35+
'import/resolver': {
36+
webpack: {
37+
config: './config/webpack.base.js',
38+
},
39+
typescript: {
40+
alwaysTryTypes: true, // always try to resolve types under `<root>@types` directory even it doesn't contain any source code, like `@types/unist`
41+
directory: './tsconfig.json',
42+
},
43+
},
44+
'import/ignore': ['types'], // Weirdly eslint cannot resolve exports in types folder (try removing this later)
45+
},
3146
rules: {
3247
'jsx-no-lambda': 0,
3348
semi: [2, 'always'],
@@ -113,19 +128,4 @@ module.exports = {
113128
// 'redux-saga/yield-effects': 2,
114129
'require-yield': 0,
115130
},
116-
settings: {
117-
'import/parsers': {
118-
'@typescript-eslint/parser': ['.ts', '.tsx'],
119-
},
120-
'import/resolver': {
121-
webpack: {
122-
config: './config/webpack.base.js',
123-
},
124-
typescript: {
125-
alwaysTryTypes: true, // always try to resolve types under `<root>@types` directory even it doesn't contain any source code, like `@types/unist`
126-
directory: './tsconfig.json',
127-
},
128-
},
129-
'import/ignore': ['types'], // Weirdly eslint cannot resolve exports in types folder (try removing this later)
130-
},
131131
};

0 commit comments

Comments
 (0)