-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.js
245 lines (244 loc) · 7.4 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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
// https://www.robertcooper.me/using-eslint-and-prettier-in-a-typescript-project
// https://dev.to/renatobentorocha/how-to-setup-a-react-js-project-with-typcript-eslint-and-prettier-8mn
// https://levelup.gitconnected.com/setting-up-eslint-with-prettier-typescript-and-visual-studio-code-d113bbec9857
// https://github.com/donatoaguirre24/react-typescript-eslint-config/blob/master/.eslintrc.json
module.exports = {
env: {
'browser': true,
'es6': true,
'serviceworker': true
},
globals: {
'Atomics': 'readonly',
'SharedArrayBuffer': 'readonly',
__PATH_PREFIX__: true,
},
parser: '@typescript-eslint/parser',
parserOptions: {
project: './tsconfig.json',
ecmaVersion: 2019,
sourceType: 'module',
ecmaFeatures: {
jsx: true,
}
},
plugins: [
'react',
'@typescript-eslint',
'prettier',
'simple-import-sort',
],
extends: [
'plugin:react/recommended',
'airbnb',
'prettier/@typescript-eslint',
'plugin:prettier/recommended',
'plugin:import/errors',
'plugin:import/warnings',
'plugin:import/typescript',
'plugin:react-hooks/recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'plugin:promise/recommended',
],
rules: {
'import/extensions': [
'error',
'ignorePackages',
{
'js': 'never',
'jsx': 'never',
'ts': 'never',
'tsx': 'never'
}
],
semi: [2, 'always'],
'prettier/prettier': 'error',
'@typescript-eslint/explicit-function-return-type': 'off',
'react/jsx-filename-extension': [2, { extensions: ['.js', '.jsx', '.ts', '.tsx'] }],
'react/button-has-type': 0,
'import/no-extraneous-dependencies': [2, { devDependencies: ['**/test.tsx', '**/test.ts'] }],
'@typescript-eslint/indent': [2, 2],
// copied from back-end config
'array-callback-return': 'error',
'block-scoped-var': 'error',
'react/prop-types': [2, { ignore: ['children'] }],
camelcase: [
'error',
{
properties: 'never',
},
],
curly: ["error", 'multi', 'consistent'],
'dot-notation': 'error',
eqeqeq: ['error', 'allow-null'],
'func-names': ['error', 'as-needed'],
'func-style': [
'error',
'declaration',
{
allowArrowFunctions: true,
},
],
'guard-for-in': 'error',
'implicit-arrow-linebreak': 'off',
'function-paren-newline': 'off',
'max-len': ["error", { "code": 120 }],
'handle-callback-err': 'error',
'max-depth': 'error',
'max-params': ['error', 5],
'no-bitwise': 'error',
'no-caller': 'error',
'no-else-return': 'error',
'no-eval': 'error',
'max-statements-per-line': 'off',
'consistent-this': 'error',
'no-extra-label': 'error',
'no-implicit-coercion': 'error',
'no-implicit-globals': 'error',
'no-implied-eval': 'error',
'no-iterator': 'error',
'no-label-var': 'error',
'no-labels': [
'error',
{
allowLoop: true,
},
],
'no-lone-blocks': 'error',
'no-lonely-if': 'error',
'no-loop-func': 'error',
'no-mixed-requires': [
'error',
{
grouping: true,
},
],
'no-multi-str': 'error',
'no-new': 'error',
'no-new-func': 'error',
'no-new-object': 'error',
'no-new-require': 'error',
'no-new-symbol': 'error',
'no-new-wrappers': 'error',
'no-octal-escape': 'error',
'no-script-url': 'error',
'no-self-compare': 'error',
'no-sequences': 'error',
'no-shadow': 'error',
'no-shadow-restricted-names': 'error',
'no-throw-literal': 'error',
'no-undef-init': 'error',
'no-unneeded-ternary': 'error',
'no-unused-expressions': 'error',
'no-useless-call': 'error',
'no-useless-computed-key': 'error',
'no-useless-concat': 'error',
'no-useless-rename': 'error',
'no-void': 'error',
'no-with': 'error',
'object-shorthand': 'error',
'operator-assignment': 'error',
'padding-line-between-statements': 'error',
'prefer-template': 'error',
radix: 'error',
'spaced-comment': [
'error',
'always',
{
block: {
balanced: true,
},
},
],
'vars-on-top': 'error',
yoda: 'error',
'no-trailing-spaces': 'error',
'max-classes-per-file': 'off',
'no-array-constructor': 'off',
'class-methods-use-this': 'off',
'no-unused-vars': 2,
'no-use-before-define': 'off',
'no-var': 2,
'no-empty-function': 'off',
'prefer-const': 2,
'prefer-rest-params': 2,
'prefer-spread': 2,
'no-console': 1,
'sort-keys': 0,
quotes: ['error', 'single'],
'object-curly-spacing': 2,
'simple-import-sort/sort': 'error',
'lines-between-class-members': 'off',
'import/prefer-default-export': 'off',
'sort-imports': 'off',
'import/order': 'off',
'import/first': 'error',
'import/newline-after-import': 'error',
'import/no-duplicates': 'error',
'@typescript-eslint/no-explicit-any': 2,
'@typescript-eslint/no-empty-interface': 2,
'@typescript-eslint/member-ordering': 2,
'@typescript-eslint/no-unused-vars': 2,
'@typescript-eslint/interface-name-prefix': 0,
'@typescript-eslint/await-thenable': 2,
'@typescript-eslint/no-for-in-array': 2,
'@typescript-eslint/no-misused-promises': 2,
'@typescript-eslint/no-unnecessary-type-assertion': 2,
'@typescript-eslint/prefer-includes': 2,
'@typescript-eslint/prefer-regexp-exec': 2,
'@typescript-eslint/prefer-string-starts-ends-with': 2,
'require-await': 'off',
'@typescript-eslint/require-await': 2,
'@typescript-eslint/unbound-method': 2,
'@typescript-eslint/adjacent-overload-signatures': 2,
'@typescript-eslint/ban-types': 2,
'@typescript-eslint/consistent-type-assertions': 2,
'@typescript-eslint/no-use-before-define': 2,
'@typescript-eslint/no-var-requires': 2,
'@typescript-eslint/prefer-for-of': 2,
'@typescript-eslint/prefer-namespace-keyword': 2,
'@typescript-eslint/triple-slash-reference': 2,
'@typescript-eslint/type-annotation-spacing': 2,
'@typescript-eslint/no-array-constructor': 2,
'@typescript-eslint/no-empty-function': 2,
'@typescript-eslint/no-inferrable-types': 2,
'@typescript-eslint/no-misused-new': 2,
'@typescript-eslint/no-namespace': 2,
'@typescript-eslint/no-non-null-assertion': 2,
'@typescript-eslint/no-this-alias': 2,
'@typescript-eslint/member-delimiter-style': 2,
'@typescript-eslint/promise-function-async': 2,
'@typescript-eslint/no-dynamic-delete': 2,
'@typescript-eslint/no-floating-promises': 2,
'@typescript-eslint/prefer-readonly': 2,
'@typescript-eslint/array-type': [
'error',
{
default: 'array-simple',
},
],
'@typescript-eslint/no-require-imports': 'error',
'@typescript-eslint/no-unnecessary-qualifier': 'error',
'@typescript-eslint/prefer-function-type': 'error',
'@typescript-eslint/require-array-sort-compare': 'error',
'@typescript-eslint/restrict-plus-operands': 'error',
'@typescript-eslint/quotes': ['error', 'single'],
'@typescript-eslint/ban-ts-ignore': 'off',
'react/jsx-props-no-spreading': 'warn',
},
settings: {
'import/parsers': {
'@typescript-eslint/parser': ['.ts', '.tsx'],
},
'import/resolver': {
typescript: {},
node: {
extensions: ['.js', '.jsx', '.ts', '.tsx']
}
},
react: {
version: 'detect'
}
}
};