-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.cjs
127 lines (123 loc) · 3.13 KB
/
.eslintrc.cjs
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
module.exports = require('eslint-define-config').defineConfig({
extends: [
'eslint:recommended',
'plugin:react/recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:import/recommended',
'plugin:import/typescript',
'plugin:prettier/recommended'
],
env: {
browser: true,
es6: true,
commonjs: true
},
plugins: ['react', '@typescript-eslint', 'react-hooks', 'unused-imports'],
parser: '@typescript-eslint/parser',
rules: {
complexity: ['error', 30],
'no-duplicate-imports': 'off',
// react
'react/react-in-jsx-scope': 'off',
// ts
'@typescript-eslint/no-explicit-any': ['error'],
'@typescript-eslint/consistent-type-definitions': 'off',
'@typescript-eslint/no-unused-vars': 'off',
'@typescript-eslint/consistent-type-imports': ['error', { disallowTypeAnnotations: false }],
'@typescript-eslint/naming-convention': [
'warn',
{
selector: 'variable',
format: ['camelCase', 'PascalCase', 'UPPER_CASE'],
leadingUnderscore: 'allow'
},
{
selector: ['function'],
format: ['camelCase', 'PascalCase'],
leadingUnderscore: 'allow'
},
{
selector: ['class'],
format: ['PascalCase'],
leadingUnderscore: 'allow'
},
{
selector: ['classProperty'],
format: ['PascalCase', 'camelCase'],
leadingUnderscore: 'allow'
},
{
selector: ['interface'],
format: ['PascalCase'],
prefix: ['I']
},
{
selector: ['enum'],
format: ['PascalCase'],
prefix: ['E']
},
{
selector: ['enumMember'],
format: ['PascalCase', 'camelCase']
}
],
// unused-imports
'unused-imports/no-unused-imports': 'error',
'unused-imports/no-unused-vars': [
'warn',
{
vars: 'all',
varsIgnorePattern: '^_',
args: 'after-used',
argsIgnorePattern: '^_'
}
],
// import
'import/no-unresolved': 'off',
'import/order': [
'error',
{
groups: ['builtin', 'external', 'internal', 'unknown', 'parent', 'sibling', 'index', 'object', 'type'],
pathGroups: [
{
pattern: 'react',
group: 'builtin',
position: 'before'
},
{
pattern: 'react-dom/**',
group: 'builtin',
position: 'before'
},
{
pattern: 'antd',
group: 'builtin',
position: 'before'
},
{
pattern: '@micro/**',
group: 'internal',
position: 'before'
},
{
pattern: '@apps/**',
group: 'internal',
position: 'before'
},
{
pattern: '@shared/**',
group: 'internal',
position: 'before'
},
{
pattern: '@/**',
group: 'internal',
position: 'before'
}
],
'newlines-between': 'always',
alphabetize: { order: 'asc', caseInsensitive: true }
}
]
}
});