-
Notifications
You must be signed in to change notification settings - Fork 1
/
.eslintrc.js
72 lines (72 loc) · 1.7 KB
/
.eslintrc.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
module.exports = {
extends: [
'eslint-config-tencent',
'eslint-config-tencent/ts',
'eslint-config-tencent/prettier',
'plugin:react/recommended',
'plugin:react-hooks/recommended',
'plugin:import/typescript',
],
parser: '@typescript-eslint/parser',
parserOptions: {
project: ['./tsconfig.json'],
tsconfigRootDir: '.',
ecmaVersion: 2021,
sourceType: 'module',
ecmaFeatures: {
jsx: true,
},
},
settings: {
react: {
pragma: 'React',
version: '17',
},
'import/parsers': {
'@typescript-eslint/parser': ['.ts', '.tsx'],
},
'import/resolver': {
typescript: {
alwaysTryTypes: true,
project: ['./tsconfig.json'],
},
},
},
env: {
browser: true,
es6: true,
amd: true,
jquery: true,
jest: true,
},
globals: {
seajs: false,
process: false,
},
plugins: ['@typescript-eslint', 'import', 'prettier', 'react', 'react-hooks'],
rules: {
'react/display-name': 'warn',
'react/prop-types': 'off',
'@typescript-eslint/class-literal-property-style': 'off',
'import/order': [
'error',
{
groups: ['builtin', 'external', 'internal', ['parent', 'sibling'], 'index'],
'newlines-between': 'always',
alphabetize: {
order: 'asc',
caseInsensitive: true,
},
},
],
// 增加 react-use 相关 hooks提示
// @reference https://github.com/streamich/react-use/issues/1703
'react-hooks/exhaustive-deps': [
'warn',
{
additionalHooks:
'^use(Async|AsyncFn|AsyncRetry|Debounce|UpdateEffect|IsomorphicLayoutEffect|DeepCompareEffect|ShallowCompareEffect)$',
},
],
},
};