-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
165 lines (163 loc) · 4.91 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
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
module.exports = {
env: {
browser: true,
es2021: true,
jest: true,
},
extends: [
'plugin:react/recommended',
'plugin:@typescript-eslint/recommended',
'prettier',
'plugin:prettier/recommended',
'plugin:import/recommended',
],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaFeatures: {
jsx: true,
},
project: 'tsconfig.json',
tsconfigRootDir: __dirname,
ecmaVersion: 'latest',
sourceType: 'module',
},
root: true,
plugins: ['react', 'react-hooks', '@typescript-eslint', 'prettier'],
rules: {
'react/react-in-jsx-scope': 'off',
camelcase: 'error',
'spaced-comment': 'error',
quotes: ['error', 'single'],
'no-duplicate-imports': 'error',
'no-use-before-define': 'off',
'react/jsx-filename-extension': ['warn', { extensions: ['.tsx'] }],
'import/extensions': [
'error',
'ignorePackages',
{ ts: 'never', tsx: 'never' },
],
'no-shadow': 'off',
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'warn',
'import/prefer-default-export': 'off',
'react/prop-types': 'off',
'lines-between-class-members': ['error', 'always'],
'no-unused-vars': 'off',
// React rules
'react/boolean-prop-naming': [
'error',
{ propTypeNames: ['bool', 'mutuallyExclusiveTrueProps'] },
],
'react/button-has-type': [
'error',
{
button: true,
submit: true,
reset: true,
},
],
'react/destructuring-assignment': ['error', 'always'],
'react/function-component-definition': [
'error',
{
namedComponents: 'arrow-function',
unnamedComponents: 'arrow-function',
},
],
'react/hook-use-state': ['error', { allowDestructuredState: true }],
'react/jsx-boolean-value': ['error', 'never'],
// TypeScript rules
'@typescript-eslint/array-type': ['error', { default: 'generic' }],
'@typescript-eslint/await-thenable': 'error',
'@typescript-eslint/consistent-indexed-object-style': ['error', 'record'],
'@typescript-eslint/consistent-type-assertions': [
'error',
{
assertionStyle: 'as',
},
],
'@typescript-eslint/consistent-type-definitions': ['error', 'type'],
'@typescript-eslint/explicit-member-accessibility': [
'error',
{
accessibility: 'explicit',
overrides: {
accessors: 'explicit',
constructors: 'no-public',
methods: 'explicit',
properties: 'off',
parameterProperties: 'explicit',
},
},
],
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/interface-name-prefix': 'off',
'@typescript-eslint/member-ordering': 'error',
'@typescript-eslint/method-signature-style': ['error', 'method'],
'@typescript-eslint/naming-convention': [
'error',
{
selector: 'enum',
format: ['UPPER_CASE'],
prefix: ['E_'],
},
{
selector: 'enumMember',
format: ['UPPER_CASE'],
},
{
selector: 'typeAlias',
format: ['PascalCase'],
prefix: ['T'],
},
{
selector: 'interface',
format: ['PascalCase'],
prefix: ['I'],
},
{
selector: 'variable',
format: ['camelCase', 'UPPER_CASE', 'PascalCase'],
leadingUnderscore: 'allow',
},
],
'@typescript-eslint/no-confusing-void-expression': [
'error',
{
ignoreArrowShorthand: true,
},
],
'@typescript-eslint/no-duplicate-enum-values': 'error',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-inferrable-types': 'error',
'@typescript-eslint/no-require-imports': 'error',
'@typescript-eslint/no-shadow': ['error'],
'@typescript-eslint/no-unnecessary-boolean-literal-compare': 'error',
'@typescript-eslint/no-unnecessary-qualifier': 'error',
'@typescript-eslint/no-unnecessary-type-arguments': 'error',
'@typescript-eslint/no-unnecessary-type-assertion': 'error',
'@typescript-eslint/no-unnecessary-type-constraint': 'error',
'@typescript-eslint/no-unsafe-declaration-merging': 'error',
'@typescript-eslint/no-unused-vars': 'off',
'@typescript-eslint/no-useless-empty-export': 'error',
'@typescript-eslint/no-use-before-define': ['error'],
'@typescript-eslint/parameter-properties': [
'error',
{
prefer: 'parameter-property',
},
],
'@typescript-eslint/prefer-enum-initializers': 'error',
'@typescript-eslint/prefer-for-of': 'error',
'@typescript-eslint/prefer-function-type': 'error',
'@typescript-eslint/prefer-optional-chain': 'error',
'@typescript-eslint/promise-function-async': 'error',
'@typescript-eslint/sort-type-constituents': 'error',
'@typescript-eslint/switch-exhaustiveness-check': 'error',
},
settings: {
'import/resolver': {
typescript: {},
},
},
};