-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.eslintrc.js
83 lines (82 loc) · 2.15 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
73
74
75
76
77
78
79
80
81
82
83
//@ts-check
/** @typedef {import('eslint').Linter.Config} EslintConfig **/
/** @type EslintConfig */
module.exports = {
env: {
browser: true,
node: true,
es2021: true,
},
extends: [
'eslint:recommended',
'plugin:import/recommended',
'plugin:import/typescript',
'plugin:@typescript-eslint/recommended',
'prettier',
],
parser: '@typescript-eslint/parser',
parserOptions: {
// ecmaFeatures: {
// jsx: true,
// },
ecmaVersion: 12,
sourceType: 'module',
},
plugins: ['import', '@typescript-eslint', 'react-hooks'],
rules: {
'import/no-unresolved': [2, { ignore: ['^@/', 'dist', 'vscode'] }],
'import/first': 1,
'import/order': [
1,
{
groups: [
'builtin',
'external',
'internal',
'parent',
'sibling',
'index',
'object',
'type',
],
pathGroups: [
{
pattern: 'react/*',
group: 'builtin',
position: 'before',
},
{
pattern: '@/**',
group: 'external',
position: 'after',
},
],
pathGroupsExcludedImportTypes: [],
// newlines-between 不同组之间是否进行换行
'newlines-between': 'always',
// alphabetize 根据字母顺序对每个组内的顺序进行排序
alphabetize: {
order: 'asc',
caseInsensitive: true,
},
},
],
'@typescript-eslint/no-non-null-assertion': 0,
'react-hooks/rules-of-hooks': 'error', // 检查 Hook 的规则
'react-hooks/exhaustive-deps': 'warn', // 检查 effect 的依赖
'@typescript-eslint/no-empty-function': 0,
'@typescript-eslint/no-var-requires': 0,
'@typescript-eslint/no-empty-interface': 0,
'import/default': 0,
// 数据转换 !!var +var
'no-implicit-coercion': 0,
'@typescript-eslint/consistent-type-imports': 1,
'no-undef': 0,
'no-console': 1,
/**
* 禁止变量名与上层作用域内的已定义的变量重复
*/
'@typescript-eslint/no-shadow': 2,
'@typescript-eslint/ban-ts-comment': 0,
},
}