@modern-js-app/eslint-config 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +32 -0
- package/eslintrc.js +2316 -0
- package/eslintrc.prettier.js +74 -0
- package/index.js +1 -0
- package/package.json +38 -0
- package/utils.js +11 -0
package/eslintrc.js
ADDED
|
@@ -0,0 +1,2316 @@
|
|
|
1
|
+
/* eslint-disable max-lines, no-magic-numbers */
|
|
2
|
+
// const path = require('path');
|
|
3
|
+
|
|
4
|
+
const { jsExtensions } = require('./utils');
|
|
5
|
+
|
|
6
|
+
module.exports = {
|
|
7
|
+
ignorePatterns: ['**/node_modules/**', '**/dist/**'],
|
|
8
|
+
// https://eslint.org/docs/user-guide/configuring#specifying-parser-options
|
|
9
|
+
parserOptions: {
|
|
10
|
+
ecmaVersion: 8,
|
|
11
|
+
ecmaFeatures: {
|
|
12
|
+
impliedStrict: true,
|
|
13
|
+
ecmaVersion: 2018,
|
|
14
|
+
jsx: true,
|
|
15
|
+
},
|
|
16
|
+
sourceType: 'module',
|
|
17
|
+
babelOptions: {
|
|
18
|
+
configFile: require.resolve('@modern-js/babel-preset-app'),
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
// https://www.npmjs.com/package/@babel/eslint-parser
|
|
22
|
+
parser: '@babel/eslint-parser',
|
|
23
|
+
// https://eslint.org/docs/user-guide/configuring#specifying-environments
|
|
24
|
+
env: {
|
|
25
|
+
es6: true,
|
|
26
|
+
'shared-node-browser': true,
|
|
27
|
+
browser: false,
|
|
28
|
+
node: false,
|
|
29
|
+
worker: false,
|
|
30
|
+
serviceworker: false,
|
|
31
|
+
mocha: false,
|
|
32
|
+
jest: false,
|
|
33
|
+
},
|
|
34
|
+
// https://eslint.org/docs/user-guide/configuring#specifying-globals
|
|
35
|
+
globals: { gql: 'readable' },
|
|
36
|
+
// https://eslint.org/docs/user-guide/configuring#configuring-plugins
|
|
37
|
+
plugins: [
|
|
38
|
+
// https://www.npmjs.com/package/eslint-plugin-prettier
|
|
39
|
+
'prettier',
|
|
40
|
+
// https://www.npmjs.com/package/@babel/eslint-plugin
|
|
41
|
+
'@babel',
|
|
42
|
+
// https://www.npmjs.com/package/eslint-plugin-react
|
|
43
|
+
'react',
|
|
44
|
+
// https://www.npmjs.com/package/eslint-plugin-react-hooks
|
|
45
|
+
'react-hooks',
|
|
46
|
+
// https://www.npmjs.com/package/eslint-plugin-import
|
|
47
|
+
'import',
|
|
48
|
+
// https://www.npmjs.com/package/eslint-plugin-eslint-comments
|
|
49
|
+
'eslint-comments',
|
|
50
|
+
// https://www.npmjs.com/package/eslint-plugin-filenames
|
|
51
|
+
'filenames',
|
|
52
|
+
// https://www.npmjs.com/package/eslint-plugin-promise
|
|
53
|
+
'promise',
|
|
54
|
+
// https://www.npmjs.com/package/eslint-plugin-node
|
|
55
|
+
'node',
|
|
56
|
+
// https://github.com/gajus/eslint-plugin-jsdoc
|
|
57
|
+
// 'jsdoc',
|
|
58
|
+
// https: //github.com/eslint/eslint-plugin-markdown
|
|
59
|
+
'markdown',
|
|
60
|
+
],
|
|
61
|
+
// https://eslint.org/docs/user-guide/configuring#extending-configuration-files
|
|
62
|
+
extends: [
|
|
63
|
+
// https://eslint.org/docs/user-guide/configuring#using-eslintrecommended
|
|
64
|
+
'eslint:recommended',
|
|
65
|
+
'plugin:react/recommended',
|
|
66
|
+
'plugin:import/errors',
|
|
67
|
+
'plugin:import/warnings',
|
|
68
|
+
'plugin:eslint-comments/recommended',
|
|
69
|
+
'plugin:promise/recommended',
|
|
70
|
+
'plugin:node/recommended',
|
|
71
|
+
],
|
|
72
|
+
// https://eslint.org/docs/user-guide/configuring#configuring-rules
|
|
73
|
+
rules: {
|
|
74
|
+
/*
|
|
75
|
+
* Possible Errors
|
|
76
|
+
* https://eslint.org/docs/rules/for-direction
|
|
77
|
+
*/
|
|
78
|
+
'for-direction': 'off',
|
|
79
|
+
// https://eslint.org/docs/rules/getter-return
|
|
80
|
+
'getter-return': ['error', { allowImplicit: true }],
|
|
81
|
+
// https://eslint.org/docs/rules/no-async-promise-executor
|
|
82
|
+
'no-async-promise-executor': 'error',
|
|
83
|
+
// https://eslint.org/docs/rules/no-await-in-loop
|
|
84
|
+
'no-await-in-loop': 'off',
|
|
85
|
+
// https://eslint.org/docs/rules/no-compare-neg-zero
|
|
86
|
+
'no-compare-neg-zero': 'error',
|
|
87
|
+
// https://eslint.org/docs/rules/no-cond-assign
|
|
88
|
+
'no-cond-assign': ['error', 'always'],
|
|
89
|
+
// https://eslint.org/docs/rules/no-console
|
|
90
|
+
'no-console': ['error', { allow: ['info', 'warn', 'error'] }],
|
|
91
|
+
// https://eslint.org/docs/rules/no-constant-condition
|
|
92
|
+
'no-constant-condition': ['error', { checkLoops: false }],
|
|
93
|
+
|
|
94
|
+
/*
|
|
95
|
+
* https://eslint.org/docs/rules/no-control-regex
|
|
96
|
+
* @TIPS
|
|
97
|
+
* explicitly declare `eslint-disable` when truly necessary
|
|
98
|
+
*/
|
|
99
|
+
'no-control-regex': 'error',
|
|
100
|
+
|
|
101
|
+
/*
|
|
102
|
+
* https://eslint.org/docs/rules/no-debugger
|
|
103
|
+
* @TIPS: for non-VSCode users, please use `debugger // eslint-disable-line`
|
|
104
|
+
* instead of `debugger` to avoid it to be removed by IDE's autoFixOnSave feature
|
|
105
|
+
*/
|
|
106
|
+
'no-debugger': 'error',
|
|
107
|
+
// https://eslint.org/docs/rules/no-dupe-args
|
|
108
|
+
'no-dupe-args': 'error',
|
|
109
|
+
// https://eslint.org/docs/rules/no-dupe-keys
|
|
110
|
+
'no-dupe-keys': 'error',
|
|
111
|
+
// https://eslint.org/docs/rules/no-duplicate-case
|
|
112
|
+
'no-duplicate-case': 'error',
|
|
113
|
+
// https://eslint.org/docs/rules/no-empty
|
|
114
|
+
'no-empty': ['error', { allowEmptyCatch: true }],
|
|
115
|
+
// https://eslint.org/docs/rules/no-empty-character-class
|
|
116
|
+
'no-empty-character-class': 'error',
|
|
117
|
+
// https://eslint.org/docs/rules/no-ex-assign
|
|
118
|
+
'no-ex-assign': 'error',
|
|
119
|
+
// https://eslint.org/docs/rules/no-extra-boolean-cast
|
|
120
|
+
'no-extra-boolean-cast': 'error',
|
|
121
|
+
// https://eslint.org/docs/rules/no-extra-parens
|
|
122
|
+
'no-extra-parens': ['error', 'all', { ignoreJSX: 'multi-line' }],
|
|
123
|
+
// https://eslint.org/docs/rules/no-extra-semi
|
|
124
|
+
'no-extra-semi': 'error',
|
|
125
|
+
// https://eslint.org/docs/rules/no-func-assign
|
|
126
|
+
'no-func-assign': 'error',
|
|
127
|
+
// https://eslint.org/docs/rules/no-inner-declarations
|
|
128
|
+
'no-inner-declarations': ['error', 'both'],
|
|
129
|
+
// https://eslint.org/docs/rules/no-invalid-regexp
|
|
130
|
+
'no-invalid-regexp': ['error', { allowConstructorFlags: [] }],
|
|
131
|
+
// https://eslint.org/docs/rules/no-irregular-whitespace
|
|
132
|
+
'no-irregular-whitespace': [
|
|
133
|
+
'error',
|
|
134
|
+
{
|
|
135
|
+
skipStrings: false,
|
|
136
|
+
skipTemplates: false,
|
|
137
|
+
skipComments: false,
|
|
138
|
+
skipRegExps: true,
|
|
139
|
+
},
|
|
140
|
+
],
|
|
141
|
+
// https://eslint.org/docs/rules/no-misleading-character-class
|
|
142
|
+
'no-misleading-character-class': 'error',
|
|
143
|
+
// https://eslint.org/docs/rules/no-obj-calls
|
|
144
|
+
'no-obj-calls': 'error',
|
|
145
|
+
// https://eslint.org/docs/rules/no-prototype-builtins
|
|
146
|
+
'no-prototype-builtins': 'off',
|
|
147
|
+
// https://eslint.org/docs/rules/no-regex-spaces
|
|
148
|
+
'no-regex-spaces': 'error',
|
|
149
|
+
// https://eslint.org/docs/rules/no-sparse-arrays
|
|
150
|
+
'no-sparse-arrays': 'error',
|
|
151
|
+
// https://eslint.org/docs/rules/no-template-curly-in-string
|
|
152
|
+
'no-template-curly-in-string': 'error',
|
|
153
|
+
// https://eslint.org/docs/rules/no-unexpected-multiline
|
|
154
|
+
'no-unexpected-multiline': 'error',
|
|
155
|
+
// https://eslint.org/docs/rules/no-unreachable
|
|
156
|
+
'no-unreachable': 'error',
|
|
157
|
+
// https://eslint.org/docs/rules/no-unsafe-finally
|
|
158
|
+
'no-unsafe-finally': 'error',
|
|
159
|
+
// https://eslint.org/docs/rules/no-unsafe-negation
|
|
160
|
+
'no-unsafe-negation': 'error',
|
|
161
|
+
// https://eslint.org/docs/rules/require-atomic-updates
|
|
162
|
+
// @bug https://github.com/eslint/eslint/issues/11899
|
|
163
|
+
'require-atomic-updates': 'warn',
|
|
164
|
+
// 'require-atomic-updates': 'error',
|
|
165
|
+
// https://eslint.org/docs/rules/use-isnan
|
|
166
|
+
'use-isnan': 'error',
|
|
167
|
+
// https://eslint.org/docs/rules/valid-typeof
|
|
168
|
+
'valid-typeof': ['error', { requireStringLiterals: true }],
|
|
169
|
+
|
|
170
|
+
/*
|
|
171
|
+
* Best Practices
|
|
172
|
+
* https://eslint.org/docs/rules/accessor-pairs
|
|
173
|
+
*/
|
|
174
|
+
'accessor-pairs': 'error',
|
|
175
|
+
// https://eslint.org/docs/rules/array-callback-return
|
|
176
|
+
'array-callback-return': ['error', { allowImplicit: true }],
|
|
177
|
+
// https://eslint.org/docs/rules/block-scoped-var
|
|
178
|
+
'block-scoped-var': 'error',
|
|
179
|
+
// https://eslint.org/docs/rules/class-methods-use-this
|
|
180
|
+
// @BUG issue:
|
|
181
|
+
'class-methods-use-this': 'off',
|
|
182
|
+
// 'class-methods-use-this': [
|
|
183
|
+
// 'warn',
|
|
184
|
+
// {
|
|
185
|
+
// exceptMethods: [
|
|
186
|
+
// 'getChildContext',
|
|
187
|
+
// 'UNSAFE_componentWillMount',
|
|
188
|
+
// 'componentWillMount',
|
|
189
|
+
// 'componentDidMount',
|
|
190
|
+
// 'UNSAFE_componentWillReceiveProps',
|
|
191
|
+
// 'componentWillReceiveProps',
|
|
192
|
+
// 'shouldComponentUpdate',
|
|
193
|
+
// 'getSnapshotBeforeUpdate',
|
|
194
|
+
// 'UNSAFE_componentWillUpdate',
|
|
195
|
+
// 'componentWillUpdate',
|
|
196
|
+
// 'componentDidUpdate',
|
|
197
|
+
// 'componentWillUnmount',
|
|
198
|
+
// 'componentDidCatch',
|
|
199
|
+
// 'render',
|
|
200
|
+
// ],
|
|
201
|
+
// },
|
|
202
|
+
// ],
|
|
203
|
+
// https://eslint.org/docs/rules/complexity
|
|
204
|
+
complexity: ['warn', { max: 30 }],
|
|
205
|
+
// https://eslint.org/docs/rules/consistent-return
|
|
206
|
+
'consistent-return': 'error',
|
|
207
|
+
// https://eslint.org/docs/rules/curly
|
|
208
|
+
curly: 'error',
|
|
209
|
+
// https://eslint.org/docs/rules/default-case
|
|
210
|
+
'default-case': 'error',
|
|
211
|
+
// https://eslint.org/docs/rules/dot-location
|
|
212
|
+
'dot-location': ['error', 'property'],
|
|
213
|
+
// https://eslint.org/docs/rules/dot-notation
|
|
214
|
+
'dot-notation': ['error', { allowKeywords: true }],
|
|
215
|
+
// https://eslint.org/docs/rules/eqeqeq
|
|
216
|
+
eqeqeq: ['error', 'always', { null: 'ignore' }],
|
|
217
|
+
// https://eslint.org/docs/rules/guard-for-in
|
|
218
|
+
'guard-for-in': 'off',
|
|
219
|
+
// https://eslint.org/docs/rules/max-classes-per-file
|
|
220
|
+
'max-classes-per-file': ['error', 1],
|
|
221
|
+
// https://eslint.org/docs/rules/no-alert
|
|
222
|
+
'no-alert': 'error',
|
|
223
|
+
// https://eslint.org/docs/rules/no-caller
|
|
224
|
+
'no-caller': 'error',
|
|
225
|
+
|
|
226
|
+
/*
|
|
227
|
+
* https://eslint.org/docs/rules/no-case-declarations
|
|
228
|
+
* @TIPS
|
|
229
|
+
* case 1:
|
|
230
|
+
* const a = 1;
|
|
231
|
+
* case 2:
|
|
232
|
+
* ->
|
|
233
|
+
* case 1: {
|
|
234
|
+
* const a = 1;
|
|
235
|
+
* }
|
|
236
|
+
* case 2: {
|
|
237
|
+
*/
|
|
238
|
+
'no-case-declarations': 'error',
|
|
239
|
+
// https://eslint.org/docs/rules/no-div-regex
|
|
240
|
+
'no-div-regex': 'error',
|
|
241
|
+
|
|
242
|
+
/*
|
|
243
|
+
* https://eslint.org/docs/rules/no-else-return
|
|
244
|
+
* 1. this rule makes it harder to signal that there are two cases and only one of them will run.
|
|
245
|
+
* 2. no upside (with no-unreachable rule)
|
|
246
|
+
*/
|
|
247
|
+
'no-else-return': 'off',
|
|
248
|
+
|
|
249
|
+
/*
|
|
250
|
+
* "no-else-return": [
|
|
251
|
+
* "error",
|
|
252
|
+
* {
|
|
253
|
+
* "allowElseIf": true
|
|
254
|
+
* }
|
|
255
|
+
* ],
|
|
256
|
+
* https://eslint.org/docs/rules/no-empty-function
|
|
257
|
+
* @TIPS
|
|
258
|
+
* add commment to explain why we need a empty function/method here
|
|
259
|
+
*/
|
|
260
|
+
'no-empty-function': ['error', { allow: [] }],
|
|
261
|
+
// https://eslint.org/docs/rules/no-empty-pattern
|
|
262
|
+
'no-empty-pattern': 'error',
|
|
263
|
+
// https://eslint.org/docs/rules/no-eq-null
|
|
264
|
+
'no-eq-null': 'off',
|
|
265
|
+
// https://eslint.org/docs/rules/no-eval
|
|
266
|
+
'no-eval': 'error',
|
|
267
|
+
// https://eslint.org/docs/rules/no-extend-native
|
|
268
|
+
'no-extend-native': 'error',
|
|
269
|
+
// https://eslint.org/docs/rules/no-extra-bind
|
|
270
|
+
'no-extra-bind': 'error',
|
|
271
|
+
// https://eslint.org/docs/rules/no-extra-label
|
|
272
|
+
'no-extra-label': 'error',
|
|
273
|
+
// https://eslint.org/docs/rules/no-fallthrough
|
|
274
|
+
'no-fallthrough': 'error',
|
|
275
|
+
// https://eslint.org/docs/rules/no-floating-decimal
|
|
276
|
+
'no-floating-decimal': 'error',
|
|
277
|
+
// https://eslint.org/docs/rules/no-global-assign
|
|
278
|
+
'no-global-assign': 'error',
|
|
279
|
+
// https://eslint.org/docs/rules/no-implicit-coercion
|
|
280
|
+
'no-implicit-coercion': ['error', { allow: [] }],
|
|
281
|
+
// https://eslint.org/docs/rules/no-implicit-globals
|
|
282
|
+
'no-implicit-globals': 'error',
|
|
283
|
+
// https://eslint.org/docs/rules/no-implied-eval
|
|
284
|
+
'no-implied-eval': 'error',
|
|
285
|
+
// https://eslint.org/docs/rules/no-invalid-this
|
|
286
|
+
'no-invalid-this': 'off',
|
|
287
|
+
'@babel/no-invalid-this': 'error',
|
|
288
|
+
// https://eslint.org/docs/rules/no-iterator
|
|
289
|
+
'no-iterator': 'error',
|
|
290
|
+
// https://eslint.org/docs/rules/no-labels
|
|
291
|
+
'no-labels': 'error',
|
|
292
|
+
// https://eslint.org/docs/rules/no-lone-blocks
|
|
293
|
+
'no-lone-blocks': 'error',
|
|
294
|
+
// https://eslint.org/docs/rules/no-loop-func
|
|
295
|
+
'no-loop-func': 'error',
|
|
296
|
+
// https://eslint.org/docs/rules/no-magic-numbers
|
|
297
|
+
'no-magic-numbers': [
|
|
298
|
+
'warn',
|
|
299
|
+
{
|
|
300
|
+
ignore: [
|
|
301
|
+
0, 0.5, 0.25, 1, -1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 24, 60, 100,
|
|
302
|
+
1000, 365, 1024,
|
|
303
|
+
],
|
|
304
|
+
ignoreArrayIndexes: true,
|
|
305
|
+
enforceConst: false,
|
|
306
|
+
detectObjects: false,
|
|
307
|
+
},
|
|
308
|
+
],
|
|
309
|
+
// https://eslint.org/docs/rules/no-multi-spaces
|
|
310
|
+
'no-multi-spaces': [
|
|
311
|
+
'error',
|
|
312
|
+
{
|
|
313
|
+
ignoreEOLComments: false,
|
|
314
|
+
exceptions: {},
|
|
315
|
+
},
|
|
316
|
+
],
|
|
317
|
+
// https://eslint.org/docs/rules/no-multi-str
|
|
318
|
+
'no-multi-str': 'error',
|
|
319
|
+
// https://eslint.org/docs/rules/no-new
|
|
320
|
+
'no-new': 'error',
|
|
321
|
+
// https://eslint.org/docs/rules/no-new-func
|
|
322
|
+
'no-new-func': 'error',
|
|
323
|
+
// https://eslint.org/docs/rules/no-new-wrappers
|
|
324
|
+
'no-new-wrappers': 'error',
|
|
325
|
+
// https://eslint.org/docs/rules/no-octal
|
|
326
|
+
'no-octal': 'error',
|
|
327
|
+
// https://eslint.org/docs/rules/no-octal-escape
|
|
328
|
+
'no-octal-escape': 'error',
|
|
329
|
+
// https://eslint.org/docs/rules/no-param-reassign
|
|
330
|
+
'no-param-reassign': ['error', { props: false }],
|
|
331
|
+
// https://eslint.org/docs/rules/no-proto
|
|
332
|
+
'no-proto': 'error',
|
|
333
|
+
// https://eslint.org/docs/rules/no-redeclare
|
|
334
|
+
'no-redeclare': ['error', { builtinGlobals: true }],
|
|
335
|
+
// https://eslint.org/docs/rules/no-restricted-properties
|
|
336
|
+
'no-restricted-properties': [
|
|
337
|
+
'error',
|
|
338
|
+
{
|
|
339
|
+
property: '__defineGetter__',
|
|
340
|
+
message: 'Please use Object.defineProperty instead.',
|
|
341
|
+
},
|
|
342
|
+
],
|
|
343
|
+
// https://eslint.org/docs/rules/no-return-assign
|
|
344
|
+
'no-return-assign': ['error', 'except-parens'],
|
|
345
|
+
// https://eslint.org/docs/rules/no-return-await
|
|
346
|
+
'no-return-await': 'off',
|
|
347
|
+
// https://eslint.org/docs/rules/no-script-url
|
|
348
|
+
'no-script-url': 'error',
|
|
349
|
+
// https://eslint.org/docs/rules/no-self-assign
|
|
350
|
+
'no-self-assign': ['error', { props: true }],
|
|
351
|
+
// https://eslint.org/docs/rules/no-self-compare
|
|
352
|
+
'no-self-compare': 'error',
|
|
353
|
+
// https://eslint.org/docs/rules/no-sequences
|
|
354
|
+
// @BUG conflict with prettier
|
|
355
|
+
'no-sequences': 'off',
|
|
356
|
+
// 'no-sequences': 'error',
|
|
357
|
+
// https://eslint.org/docs/rules/no-throw-literal
|
|
358
|
+
'no-throw-literal': 'error',
|
|
359
|
+
// https://eslint.org/docs/rules/no-unmodified-loop-condition
|
|
360
|
+
'no-unmodified-loop-condition': 'error',
|
|
361
|
+
// https://eslint.org/docs/rules/no-unused-expressions
|
|
362
|
+
'no-unused-expressions': 'off',
|
|
363
|
+
'@babel/no-unused-expressions': [
|
|
364
|
+
'error',
|
|
365
|
+
{
|
|
366
|
+
allowShortCircuit: true,
|
|
367
|
+
allowTernary: false,
|
|
368
|
+
allowTaggedTemplates: true,
|
|
369
|
+
},
|
|
370
|
+
],
|
|
371
|
+
// https://eslint.org/docs/rules/no-unused-labels
|
|
372
|
+
'no-unused-labels': 'error',
|
|
373
|
+
// https://eslint.org/docs/rules/no-useless-call
|
|
374
|
+
'no-useless-call': 'error',
|
|
375
|
+
// https://eslint.org/docs/rules/no-useless-catch
|
|
376
|
+
'no-useless-catch': 'error',
|
|
377
|
+
// https://eslint.org/docs/rules/no-useless-concat
|
|
378
|
+
'no-useless-concat': 'error',
|
|
379
|
+
// https://eslint.org/docs/rules/no-useless-escape
|
|
380
|
+
'no-useless-escape': 'error',
|
|
381
|
+
// https://eslint.org/docs/rules/no-useless-return
|
|
382
|
+
'no-useless-return': 'error',
|
|
383
|
+
// https://eslint.org/docs/rules/no-void
|
|
384
|
+
'no-void': 'error',
|
|
385
|
+
// https://eslint.org/docs/rules/no-warning-comments
|
|
386
|
+
'no-warning-comments': [
|
|
387
|
+
'error',
|
|
388
|
+
{
|
|
389
|
+
terms: ['@TEMP'],
|
|
390
|
+
location: 'anywhere',
|
|
391
|
+
},
|
|
392
|
+
],
|
|
393
|
+
// https://eslint.org/docs/rules/no-with
|
|
394
|
+
'no-with': 'error',
|
|
395
|
+
// https://eslint.org/docs/rules/prefer-named-capture-group
|
|
396
|
+
'prefer-named-capture-group': 'off',
|
|
397
|
+
// https://eslint.org/docs/rules/prefer-promise-reject-errors
|
|
398
|
+
'prefer-promise-reject-errors': 'error',
|
|
399
|
+
// https://eslint.org/docs/rules/radix
|
|
400
|
+
radix: 'error',
|
|
401
|
+
// https://eslint.org/docs/rules/require-await
|
|
402
|
+
'require-await': 'error',
|
|
403
|
+
// https://eslint.org/docs/rules/require-unicode-regexp
|
|
404
|
+
'require-unicode-regexp': 'off',
|
|
405
|
+
// https://eslint.org/docs/rules/vars-on-top
|
|
406
|
+
'vars-on-top': 'off',
|
|
407
|
+
// https://eslint.org/docs/rules/wrap-iife
|
|
408
|
+
'wrap-iife': ['error', 'inside'],
|
|
409
|
+
// https://eslint.org/docs/rules/yoda
|
|
410
|
+
yoda: 'off',
|
|
411
|
+
|
|
412
|
+
/*
|
|
413
|
+
* Strict Mode
|
|
414
|
+
* https://eslint.org/docs/rules/strict
|
|
415
|
+
*/
|
|
416
|
+
strict: ['error', 'never'],
|
|
417
|
+
|
|
418
|
+
/*
|
|
419
|
+
* Variables
|
|
420
|
+
* https://eslint.org/docs/rules/init-declarations
|
|
421
|
+
*/
|
|
422
|
+
'init-declarations': 'off',
|
|
423
|
+
// https://eslint.org/docs/rules/no-delete-var
|
|
424
|
+
'no-delete-var': 'error',
|
|
425
|
+
// https://eslint.org/docs/rules/no-label-var
|
|
426
|
+
'no-label-var': 'error',
|
|
427
|
+
// https://eslint.org/docs/rules/no-restricted-globals
|
|
428
|
+
'no-restricted-globals': [
|
|
429
|
+
'error',
|
|
430
|
+
// @CUSTOM
|
|
431
|
+
],
|
|
432
|
+
|
|
433
|
+
/*
|
|
434
|
+
* https://eslint.org/docs/rules/no-shadow
|
|
435
|
+
* "no-shadow": "off",
|
|
436
|
+
*/
|
|
437
|
+
'no-shadow': [
|
|
438
|
+
'error',
|
|
439
|
+
{
|
|
440
|
+
builtinGlobals: false,
|
|
441
|
+
allow: [],
|
|
442
|
+
},
|
|
443
|
+
],
|
|
444
|
+
// https://eslint.org/docs/rules/no-shadow-restricted-names
|
|
445
|
+
'no-shadow-restricted-names': 'error',
|
|
446
|
+
// https://eslint.org/docs/rules/no-undef
|
|
447
|
+
'no-undef': 'error',
|
|
448
|
+
// https://eslint.org/docs/rules/no-undef-init
|
|
449
|
+
'no-undef-init': 'error',
|
|
450
|
+
// https://eslint.org/docs/rules/no-undefined
|
|
451
|
+
'no-undefined': 'off',
|
|
452
|
+
// https://eslint.org/docs/rules/no-unused-vars
|
|
453
|
+
'no-unused-vars': [
|
|
454
|
+
'error',
|
|
455
|
+
{
|
|
456
|
+
vars: 'all',
|
|
457
|
+
args: 'after-used',
|
|
458
|
+
ignoreRestSiblings: true,
|
|
459
|
+
argsIgnorePattern: '^_',
|
|
460
|
+
caughtErrors: 'none',
|
|
461
|
+
},
|
|
462
|
+
],
|
|
463
|
+
// https://eslint.org/docs/rules/no-use-before-define
|
|
464
|
+
'no-use-before-define': [
|
|
465
|
+
'error',
|
|
466
|
+
{
|
|
467
|
+
functions: false,
|
|
468
|
+
classes: false,
|
|
469
|
+
variables: false,
|
|
470
|
+
},
|
|
471
|
+
],
|
|
472
|
+
// https://eslint.org/docs/rules/no-sync
|
|
473
|
+
'no-sync': 'off',
|
|
474
|
+
|
|
475
|
+
/*
|
|
476
|
+
* Stylistic Issues
|
|
477
|
+
* https://eslint.org/docs/rules/array-bracket-newline
|
|
478
|
+
*/
|
|
479
|
+
'array-bracket-newline': ['error', 'consistent'],
|
|
480
|
+
// https://eslint.org/docs/rules/array-bracket-spacing
|
|
481
|
+
'array-bracket-spacing': ['error', 'never'],
|
|
482
|
+
// https://eslint.org/docs/rules/array-element-newline
|
|
483
|
+
'array-element-newline': ['error', 'consistent'],
|
|
484
|
+
// https://eslint.org/docs/rules/block-spacing
|
|
485
|
+
'block-spacing': ['error', 'always'],
|
|
486
|
+
// https://eslint.org/docs/rules/brace-style
|
|
487
|
+
'brace-style': ['error', '1tbs', { allowSingleLine: true }],
|
|
488
|
+
// https://eslint.org/docs/rules/camelcase
|
|
489
|
+
camelcase: [
|
|
490
|
+
'error',
|
|
491
|
+
{
|
|
492
|
+
properties: 'never',
|
|
493
|
+
allow: ['^UNSAFE_'],
|
|
494
|
+
},
|
|
495
|
+
],
|
|
496
|
+
// https://eslint.org/docs/rules/capitalized-comments
|
|
497
|
+
'capitalized-comments': 'off',
|
|
498
|
+
// https://eslint.org/docs/rules/comma-dangle
|
|
499
|
+
'comma-dangle': ['error', 'always-multiline'],
|
|
500
|
+
// https://eslint.org/docs/rules/comma-spacing
|
|
501
|
+
'comma-spacing': [
|
|
502
|
+
'error',
|
|
503
|
+
{
|
|
504
|
+
before: false,
|
|
505
|
+
after: true,
|
|
506
|
+
},
|
|
507
|
+
],
|
|
508
|
+
// https://eslint.org/docs/rules/comma-style
|
|
509
|
+
'comma-style': ['error', 'last'],
|
|
510
|
+
// https://eslint.org/docs/rules/computed-property-spacing
|
|
511
|
+
'computed-property-spacing': ['error', 'never'],
|
|
512
|
+
// https://eslint.org/docs/rules/consistent-this
|
|
513
|
+
'consistent-this': ['error', 'self'],
|
|
514
|
+
// https://eslint.org/docs/rules/eol-last
|
|
515
|
+
'eol-last': ['error', 'always'],
|
|
516
|
+
// https://eslint.org/docs/rules/func-call-spacing
|
|
517
|
+
'func-call-spacing': ['error', 'never'],
|
|
518
|
+
// https://eslint.org/docs/rules/func-name-matching
|
|
519
|
+
'func-name-matching': [
|
|
520
|
+
'error',
|
|
521
|
+
'always',
|
|
522
|
+
{ considerPropertyDescriptor: true },
|
|
523
|
+
],
|
|
524
|
+
|
|
525
|
+
/*
|
|
526
|
+
* https://eslint.org/docs/rules/func-names
|
|
527
|
+
* "func-names": [
|
|
528
|
+
* "error",
|
|
529
|
+
* "as-needed"
|
|
530
|
+
* ],
|
|
531
|
+
* https://eslint.org/docs/rules/func-style
|
|
532
|
+
* "func-style": [
|
|
533
|
+
* "error",
|
|
534
|
+
* "expression"
|
|
535
|
+
* ],
|
|
536
|
+
* https://eslint.org/docs/rules/function-paren-newline
|
|
537
|
+
*/
|
|
538
|
+
'function-paren-newline': ['error', 'multiline'],
|
|
539
|
+
// https://eslint.org/docs/rules/id-blacklist
|
|
540
|
+
'id-blacklist': [
|
|
541
|
+
'error',
|
|
542
|
+
// @CUSTOM
|
|
543
|
+
],
|
|
544
|
+
// https://eslint.org/docs/rules/id-length
|
|
545
|
+
'id-length': 'off',
|
|
546
|
+
// https://eslint.org/docs/rules/id-match
|
|
547
|
+
'id-match': 'off',
|
|
548
|
+
// https://eslint.org/docs/rules/implicit-arrow-linebreak
|
|
549
|
+
'implicit-arrow-linebreak': ['error', 'beside'],
|
|
550
|
+
// https://eslint.org/docs/rules/indent
|
|
551
|
+
indent: [
|
|
552
|
+
'error',
|
|
553
|
+
2,
|
|
554
|
+
{
|
|
555
|
+
SwitchCase: 1,
|
|
556
|
+
VariableDeclarator: 'first',
|
|
557
|
+
outerIIFEBody: 0,
|
|
558
|
+
MemberExpression: 1,
|
|
559
|
+
FunctionDeclaration: { parameters: 'first' },
|
|
560
|
+
FunctionExpression: { parameters: 'first' },
|
|
561
|
+
CallExpression: { arguments: 'first' },
|
|
562
|
+
ArrayExpression: 1,
|
|
563
|
+
ObjectExpression: 1,
|
|
564
|
+
ImportDeclaration: 1,
|
|
565
|
+
flatTernaryExpressions: false,
|
|
566
|
+
},
|
|
567
|
+
],
|
|
568
|
+
// https://eslint.org/docs/rules/jsx-quotes
|
|
569
|
+
'jsx-quotes': ['error', 'prefer-double'],
|
|
570
|
+
// https://eslint.org/docs/rules/key-spacing
|
|
571
|
+
'key-spacing': [
|
|
572
|
+
'error',
|
|
573
|
+
{
|
|
574
|
+
beforeColon: false,
|
|
575
|
+
afterColon: true,
|
|
576
|
+
mode: 'strict',
|
|
577
|
+
},
|
|
578
|
+
],
|
|
579
|
+
// https://eslint.org/docs/rules/keyword-spacing
|
|
580
|
+
'keyword-spacing': [
|
|
581
|
+
'error',
|
|
582
|
+
{
|
|
583
|
+
before: true,
|
|
584
|
+
after: true,
|
|
585
|
+
},
|
|
586
|
+
],
|
|
587
|
+
// https://eslint.org/docs/rules/line-comment-position
|
|
588
|
+
'line-comment-position': 'off',
|
|
589
|
+
// https://eslint.org/docs/rules/linebreak-style
|
|
590
|
+
'linebreak-style': ['error', 'unix'],
|
|
591
|
+
// https://eslint.org/docs/rules/lines-around-comment
|
|
592
|
+
'lines-around-comment': [
|
|
593
|
+
'error',
|
|
594
|
+
{
|
|
595
|
+
beforeBlockComment: true,
|
|
596
|
+
afterBlockComment: false,
|
|
597
|
+
beforeLineComment: false,
|
|
598
|
+
afterLineComment: false,
|
|
599
|
+
allowBlockStart: true,
|
|
600
|
+
allowBlockEnd: false,
|
|
601
|
+
allowClassStart: true,
|
|
602
|
+
allowClassEnd: false,
|
|
603
|
+
allowObjectStart: true,
|
|
604
|
+
allowObjectEnd: false,
|
|
605
|
+
allowArrayStart: true,
|
|
606
|
+
allowArrayEnd: false,
|
|
607
|
+
},
|
|
608
|
+
],
|
|
609
|
+
// https://eslint.org/docs/rules/lines-between-class-members
|
|
610
|
+
'lines-between-class-members': ['error', 'always'],
|
|
611
|
+
// https://eslint.org/docs/rules/max-depth
|
|
612
|
+
'max-depth': ['warn', 4],
|
|
613
|
+
|
|
614
|
+
/*
|
|
615
|
+
* https://eslint.org/docs/rules/max-len
|
|
616
|
+
* https://github.com/prettier/eslint-config-prettier#max-len
|
|
617
|
+
*/
|
|
618
|
+
'max-len': [
|
|
619
|
+
'error',
|
|
620
|
+
{
|
|
621
|
+
code: 80,
|
|
622
|
+
tabWidth: 4,
|
|
623
|
+
ignoreComments: true,
|
|
624
|
+
ignoreTrailingComments: false,
|
|
625
|
+
ignoreUrls: true,
|
|
626
|
+
ignoreStrings: true,
|
|
627
|
+
ignoreTemplateLiterals: true,
|
|
628
|
+
ignoreRegExpLiterals: true,
|
|
629
|
+
},
|
|
630
|
+
],
|
|
631
|
+
// https://eslint.org/docs/rules/max-lines
|
|
632
|
+
'max-lines': [
|
|
633
|
+
'warn',
|
|
634
|
+
{
|
|
635
|
+
max: 300,
|
|
636
|
+
skipBlankLines: true,
|
|
637
|
+
skipComments: true,
|
|
638
|
+
},
|
|
639
|
+
],
|
|
640
|
+
// https://eslint.org/docs/rules/max-lines-per-function
|
|
641
|
+
'max-lines-per-function': 'off',
|
|
642
|
+
|
|
643
|
+
/*
|
|
644
|
+
* 'max-lines-per-function': [
|
|
645
|
+
* 'error',
|
|
646
|
+
* {
|
|
647
|
+
* max: 50,
|
|
648
|
+
* skipBlankLines: true,
|
|
649
|
+
* skipComments: true,
|
|
650
|
+
* IIFEs: true,
|
|
651
|
+
* },
|
|
652
|
+
* ],
|
|
653
|
+
* https://eslint.org/docs/rules/max-nested-callbacks
|
|
654
|
+
*/
|
|
655
|
+
'max-nested-callbacks': ['warn', 4],
|
|
656
|
+
// https://eslint.org/docs/rules/max-params
|
|
657
|
+
'max-params': ['warn', 4],
|
|
658
|
+
// https://eslint.org/docs/rules/max-statements
|
|
659
|
+
'max-statements': ['warn', 20],
|
|
660
|
+
// https://eslint.org/docs/rules/max-statements-per-line
|
|
661
|
+
'max-statements-per-line': ['error', { max: 1 }],
|
|
662
|
+
// https://eslint.org/docs/rules/multiline-comment-style
|
|
663
|
+
// @TODO bug:
|
|
664
|
+
// // class Foo {
|
|
665
|
+
// // bar(){}
|
|
666
|
+
// // baz(){}
|
|
667
|
+
// // }
|
|
668
|
+
// ->
|
|
669
|
+
// /*
|
|
670
|
+
// * class Foo {
|
|
671
|
+
// * bar(){}
|
|
672
|
+
// * baz(){}
|
|
673
|
+
// * }
|
|
674
|
+
// */
|
|
675
|
+
'multiline-comment-style': 'off',
|
|
676
|
+
// 'multiline-comment-style': ['error', 'starred-block'],
|
|
677
|
+
// https://eslint.org/docs/rules/multiline-ternary
|
|
678
|
+
'multiline-ternary': ['error', 'always-multiline'],
|
|
679
|
+
// https://eslint.org/docs/rules/new-cap
|
|
680
|
+
'new-cap': [
|
|
681
|
+
'error',
|
|
682
|
+
{
|
|
683
|
+
newIsCap: true,
|
|
684
|
+
capIsNew: false,
|
|
685
|
+
properties: true,
|
|
686
|
+
},
|
|
687
|
+
],
|
|
688
|
+
'@babel/new-cap': 'off',
|
|
689
|
+
// https://eslint.org/docs/rules/new-parens
|
|
690
|
+
'new-parens': 'error',
|
|
691
|
+
// https://eslint.org/docs/rules/newline-per-chained-call
|
|
692
|
+
'newline-per-chained-call': 'off',
|
|
693
|
+
// https://eslint.org/docs/rules/no-array-constructor
|
|
694
|
+
'no-array-constructor': 'error',
|
|
695
|
+
// https://eslint.org/docs/rules/no-bitwise
|
|
696
|
+
'no-bitwise': 'error',
|
|
697
|
+
// https://eslint.org/docs/rules/no-continue
|
|
698
|
+
'no-continue': 'off',
|
|
699
|
+
// https://eslint.org/docs/rules/no-inline-comments
|
|
700
|
+
'no-inline-comments': 'off',
|
|
701
|
+
// https://eslint.org/docs/rules/no-lonely-if
|
|
702
|
+
'no-lonely-if': 'error',
|
|
703
|
+
// https://eslint.org/docs/rules/no-mixed-operators
|
|
704
|
+
'no-mixed-operators': 'off',
|
|
705
|
+
// https://eslint.org/docs/rules/no-mixed-spaces-and-tabs
|
|
706
|
+
'no-mixed-spaces-and-tabs': 'error',
|
|
707
|
+
// https://eslint.org/docs/rules/no-multi-assign
|
|
708
|
+
'no-multi-assign': 'error',
|
|
709
|
+
// https://eslint.org/docs/rules/no-multiple-empty-lines
|
|
710
|
+
'no-multiple-empty-lines': [
|
|
711
|
+
'error',
|
|
712
|
+
{
|
|
713
|
+
max: 1,
|
|
714
|
+
maxEOF: 1,
|
|
715
|
+
maxBOF: 1,
|
|
716
|
+
},
|
|
717
|
+
],
|
|
718
|
+
// https://eslint.org/docs/rules/no-negated-condition
|
|
719
|
+
'no-negated-condition': 'off',
|
|
720
|
+
// https://eslint.org/docs/rules/no-nested-ternary
|
|
721
|
+
'no-nested-ternary': 'error',
|
|
722
|
+
// https://eslint.org/docs/rules/no-new-object
|
|
723
|
+
'no-new-object': 'error',
|
|
724
|
+
// https://eslint.org/docs/rules/no-plusplus
|
|
725
|
+
'no-plusplus': 'off',
|
|
726
|
+
|
|
727
|
+
/*
|
|
728
|
+
* "no-plusplus": [
|
|
729
|
+
* "error",
|
|
730
|
+
* {
|
|
731
|
+
* "allowForLoopAfterthoughts": true
|
|
732
|
+
* }
|
|
733
|
+
* ],
|
|
734
|
+
* https://eslint.org/docs/rules/no-restricted-syntax
|
|
735
|
+
*/
|
|
736
|
+
'no-restricted-syntax': 'off',
|
|
737
|
+
// https://eslint.org/docs/rules/no-tabs
|
|
738
|
+
'no-tabs': 'error',
|
|
739
|
+
// https://eslint.org/docs/rules/no-ternary
|
|
740
|
+
'no-ternary': 'off',
|
|
741
|
+
// https://eslint.org/docs/rules/no-trailing-spaces
|
|
742
|
+
'no-trailing-spaces': [
|
|
743
|
+
'error',
|
|
744
|
+
{
|
|
745
|
+
skipBlankLines: false,
|
|
746
|
+
ignoreComments: false,
|
|
747
|
+
},
|
|
748
|
+
],
|
|
749
|
+
// https://eslint.org/docs/rules/no-underscore-dangle
|
|
750
|
+
'no-underscore-dangle': 'off',
|
|
751
|
+
|
|
752
|
+
/*
|
|
753
|
+
* "no-underscore-dangle": [
|
|
754
|
+
* "error",
|
|
755
|
+
* {
|
|
756
|
+
* "allowAfterThis": true,
|
|
757
|
+
* "allowAfterSuper": true,
|
|
758
|
+
* "enforceInMethodNames": true
|
|
759
|
+
* }
|
|
760
|
+
* ],
|
|
761
|
+
* https://eslint.org/docs/rules/no-unneeded-ternary
|
|
762
|
+
*/
|
|
763
|
+
'no-unneeded-ternary': ['error', { defaultAssignment: true }],
|
|
764
|
+
// https://eslint.org/docs/rules/no-whitespace-before-property
|
|
765
|
+
'no-whitespace-before-property': 'error',
|
|
766
|
+
// https://eslint.org/docs/rules/nonblock-statement-body-position
|
|
767
|
+
'nonblock-statement-body-position': ['error', 'below'],
|
|
768
|
+
// https://eslint.org/docs/rules/object-curly-newline
|
|
769
|
+
'object-curly-newline': ['error', { multiline: true }],
|
|
770
|
+
// https://eslint.org/docs/rules/object-curly-spacing
|
|
771
|
+
'object-curly-spacing': ['error', 'always'],
|
|
772
|
+
'@babel/object-curly-spacing': 'off',
|
|
773
|
+
// https://eslint.org/docs/rules/object-property-newline
|
|
774
|
+
'object-property-newline': 'off',
|
|
775
|
+
// https://eslint.org/docs/rules/one-var
|
|
776
|
+
'one-var': [
|
|
777
|
+
'error',
|
|
778
|
+
{
|
|
779
|
+
// var: 'consecutive',
|
|
780
|
+
// let: 'consecutive',
|
|
781
|
+
// const: 'consecutive',
|
|
782
|
+
// separateRequires: true,
|
|
783
|
+
initialized: 'never',
|
|
784
|
+
uninitialized: 'consecutive',
|
|
785
|
+
},
|
|
786
|
+
],
|
|
787
|
+
// https://eslint.org/docs/rules/one-var-declaration-per-line
|
|
788
|
+
'one-var-declaration-per-line': ['error', 'initializations'],
|
|
789
|
+
// https://eslint.org/docs/rules/operator-assignment
|
|
790
|
+
'operator-assignment': ['error', 'always'],
|
|
791
|
+
// https://eslint.org/docs/rules/operator-linebreak
|
|
792
|
+
'operator-linebreak': ['error', 'before'],
|
|
793
|
+
// https://eslint.org/docs/rules/padded-blocks
|
|
794
|
+
'padded-blocks': [
|
|
795
|
+
'error',
|
|
796
|
+
{
|
|
797
|
+
blocks: 'never',
|
|
798
|
+
classes: 'always',
|
|
799
|
+
switches: 'never',
|
|
800
|
+
},
|
|
801
|
+
],
|
|
802
|
+
// https://eslint.org/docs/rules/padding-line-between-statements
|
|
803
|
+
'padding-line-between-statements': 'off',
|
|
804
|
+
// https://eslint.org/docs/rules/prefer-object-spread
|
|
805
|
+
'prefer-object-spread': 'error',
|
|
806
|
+
// https://eslint.org/docs/rules/quote-props
|
|
807
|
+
'quote-props': ['error', 'as-needed'],
|
|
808
|
+
// https://eslint.org/docs/rules/quotes
|
|
809
|
+
quotes: [
|
|
810
|
+
'error',
|
|
811
|
+
'single',
|
|
812
|
+
{ avoidEscape: true, allowTemplateLiterals: true },
|
|
813
|
+
],
|
|
814
|
+
// https://eslint.org/docs/rules/semi
|
|
815
|
+
semi: ['error', 'always'],
|
|
816
|
+
'@babel/semi': 'off',
|
|
817
|
+
// https://eslint.org/docs/rules/semi-spacing
|
|
818
|
+
'semi-spacing': 'error',
|
|
819
|
+
// https://eslint.org/docs/rules/semi-style
|
|
820
|
+
'semi-style': ['error', 'last'],
|
|
821
|
+
// https://eslint.org/docs/rules/sort-keys
|
|
822
|
+
'sort-keys': 'off',
|
|
823
|
+
// https://eslint.org/docs/rules/sort-vars
|
|
824
|
+
'sort-vars': 'off',
|
|
825
|
+
// https://eslint.org/docs/rules/space-before-blocks
|
|
826
|
+
'space-before-blocks': 'error',
|
|
827
|
+
// https://eslint.org/docs/rules/space-before-function-paren
|
|
828
|
+
'space-before-function-paren': [
|
|
829
|
+
'error',
|
|
830
|
+
{
|
|
831
|
+
anonymous: 'always',
|
|
832
|
+
named: 'never',
|
|
833
|
+
asyncArrow: 'always',
|
|
834
|
+
},
|
|
835
|
+
],
|
|
836
|
+
// https://eslint.org/docs/rules/space-in-parens
|
|
837
|
+
'space-in-parens': ['error', 'never'],
|
|
838
|
+
// https://eslint.org/docs/rules/space-infix-ops
|
|
839
|
+
'space-infix-ops': 'error',
|
|
840
|
+
// https://eslint.org/docs/rules/space-unary-ops
|
|
841
|
+
'space-unary-ops': [
|
|
842
|
+
'error',
|
|
843
|
+
{
|
|
844
|
+
words: true,
|
|
845
|
+
nonwords: false,
|
|
846
|
+
},
|
|
847
|
+
],
|
|
848
|
+
// https://eslint.org/docs/rules/spaced-comment
|
|
849
|
+
'spaced-comment': [
|
|
850
|
+
'error',
|
|
851
|
+
'always',
|
|
852
|
+
{
|
|
853
|
+
line: {
|
|
854
|
+
markers: ['/', '!'],
|
|
855
|
+
exceptions: ['-', '+', '-+', '=', '*'],
|
|
856
|
+
},
|
|
857
|
+
block: {
|
|
858
|
+
markers: ['/', '!'],
|
|
859
|
+
exceptions: ['-', '+', '-+', '=', '*'],
|
|
860
|
+
balanced: true,
|
|
861
|
+
},
|
|
862
|
+
},
|
|
863
|
+
],
|
|
864
|
+
// https://eslint.org/docs/rules/switch-colon-spacing
|
|
865
|
+
'switch-colon-spacing': 'error',
|
|
866
|
+
// https://eslint.org/docs/rules/template-tag-spacing
|
|
867
|
+
'template-tag-spacing': ['error', 'never'],
|
|
868
|
+
// https://eslint.org/docs/rules/unicode-bom
|
|
869
|
+
'unicode-bom': 'error',
|
|
870
|
+
// https://eslint.org/docs/rules/wrap-regex
|
|
871
|
+
'wrap-regex': 'off',
|
|
872
|
+
|
|
873
|
+
/*
|
|
874
|
+
* ECMAScript 6
|
|
875
|
+
* https://eslint.org/docs/rules/arrow-body-style
|
|
876
|
+
*/
|
|
877
|
+
'arrow-body-style': ['error', 'as-needed'],
|
|
878
|
+
// https://eslint.org/docs/rules/arrow-parens
|
|
879
|
+
'arrow-parens': ['error', 'as-needed', { requireForBlockBody: true }],
|
|
880
|
+
// https://eslint.org/docs/rules/arrow-spacing
|
|
881
|
+
'arrow-spacing': 'error',
|
|
882
|
+
// https://eslint.org/docs/rules/constructor-super
|
|
883
|
+
'constructor-super': 'error',
|
|
884
|
+
// https://eslint.org/docs/rules/generator-star-spacing
|
|
885
|
+
'generator-star-spacing': [
|
|
886
|
+
'error',
|
|
887
|
+
{
|
|
888
|
+
before: false,
|
|
889
|
+
after: true,
|
|
890
|
+
},
|
|
891
|
+
],
|
|
892
|
+
// https://eslint.org/docs/rules/no-class-assign
|
|
893
|
+
'no-class-assign': 'error',
|
|
894
|
+
// https://eslint.org/docs/rules/no-confusing-arrow
|
|
895
|
+
'no-confusing-arrow': 'off',
|
|
896
|
+
|
|
897
|
+
/*
|
|
898
|
+
* "no-confusing-arrow": [
|
|
899
|
+
* "error",
|
|
900
|
+
* {
|
|
901
|
+
* "allowParens": true
|
|
902
|
+
* }
|
|
903
|
+
* ],
|
|
904
|
+
* https://eslint.org/docs/rules/no-const-assign
|
|
905
|
+
*/
|
|
906
|
+
'no-const-assign': 'error',
|
|
907
|
+
// https://eslint.org/docs/rules/no-dupe-class-members
|
|
908
|
+
'no-dupe-class-members': 'error',
|
|
909
|
+
// https://eslint.org/docs/rules/no-duplicate-imports
|
|
910
|
+
// @bug 支持 TypeScript 3.8 新语法
|
|
911
|
+
// no-duplicate-imports,不允许一个引用存在多个引用。由于 import type 和 import 存在行为差异,不能放到一个 import 里面进行,因此就会产生两个 import
|
|
912
|
+
'no-duplicate-imports': 'off',
|
|
913
|
+
// 'no-duplicate-imports': [
|
|
914
|
+
// 'error',
|
|
915
|
+
// {
|
|
916
|
+
// includeExports: true,
|
|
917
|
+
// },
|
|
918
|
+
// ],
|
|
919
|
+
// https://eslint.org/docs/rules/no-new-symbol
|
|
920
|
+
'no-new-symbol': 'error',
|
|
921
|
+
// https://eslint.org/docs/rules/no-restricted-imports
|
|
922
|
+
'no-restricted-imports': [
|
|
923
|
+
'error',
|
|
924
|
+
// @CUSTOM
|
|
925
|
+
],
|
|
926
|
+
// https://eslint.org/docs/rules/no-this-before-super
|
|
927
|
+
'no-this-before-super': 'error',
|
|
928
|
+
// https://eslint.org/docs/rules/no-useless-computed-key
|
|
929
|
+
'no-useless-computed-key': 'error',
|
|
930
|
+
// https://eslint.org/docs/rules/no-useless-constructor
|
|
931
|
+
'no-useless-constructor': 'error',
|
|
932
|
+
// https://eslint.org/docs/rules/no-useless-rename
|
|
933
|
+
'no-useless-rename': 'error',
|
|
934
|
+
// https://eslint.org/docs/rules/no-var
|
|
935
|
+
'no-var': 'error',
|
|
936
|
+
// https://eslint.org/docs/rules/object-shorthand
|
|
937
|
+
'object-shorthand': ['error', 'always'],
|
|
938
|
+
// https://eslint.org/docs/rules/prefer-arrow-callback
|
|
939
|
+
'prefer-arrow-callback': ['error', { allowNamedFunctions: true }],
|
|
940
|
+
// https://eslint.org/docs/rules/prefer-const
|
|
941
|
+
'prefer-const': [
|
|
942
|
+
'error',
|
|
943
|
+
{
|
|
944
|
+
destructuring: 'any',
|
|
945
|
+
ignoreReadBeforeAssign: true,
|
|
946
|
+
},
|
|
947
|
+
],
|
|
948
|
+
// https://eslint.org/docs/rules/prefer-destructuring
|
|
949
|
+
'prefer-destructuring': [
|
|
950
|
+
'error',
|
|
951
|
+
{
|
|
952
|
+
array: false,
|
|
953
|
+
object: true,
|
|
954
|
+
},
|
|
955
|
+
{ enforceForRenamedProperties: false },
|
|
956
|
+
],
|
|
957
|
+
// https://eslint.org/docs/rules/prefer-numeric-literals
|
|
958
|
+
'prefer-numeric-literals': 'error',
|
|
959
|
+
// https://eslint.org/docs/rules/prefer-rest-params
|
|
960
|
+
'prefer-rest-params': 'error',
|
|
961
|
+
// https://eslint.org/docs/rules/prefer-spread
|
|
962
|
+
'prefer-spread': 'error',
|
|
963
|
+
// https://eslint.org/docs/rules/prefer-template
|
|
964
|
+
'prefer-template': 'error',
|
|
965
|
+
// https://eslint.org/docs/rules/require-yield
|
|
966
|
+
'require-yield': 'error',
|
|
967
|
+
// https://eslint.org/docs/rules/rest-spread-spacing
|
|
968
|
+
'rest-spread-spacing': ['error', 'never'],
|
|
969
|
+
|
|
970
|
+
/*
|
|
971
|
+
* https://eslint.org/docs/rules/sort-imports
|
|
972
|
+
* prefer import/order
|
|
973
|
+
*/
|
|
974
|
+
'sort-imports': 'off',
|
|
975
|
+
// https://eslint.org/docs/rules/symbol-description
|
|
976
|
+
'symbol-description': 'error',
|
|
977
|
+
// https://eslint.org/docs/rules/template-curly-spacing
|
|
978
|
+
'template-curly-spacing': ['error', 'never'],
|
|
979
|
+
// https://eslint.org/docs/rules/yield-star-spacing
|
|
980
|
+
'yield-star-spacing': ['error', 'after'],
|
|
981
|
+
// https://eslint.org/docs/rules/function-call-argument-newline
|
|
982
|
+
'function-call-argument-newline': ['error', 'consistent'],
|
|
983
|
+
|
|
984
|
+
/*
|
|
985
|
+
* prettier
|
|
986
|
+
* https://github.com/prettier/prettier#options
|
|
987
|
+
*/
|
|
988
|
+
'prettier/prettier': [
|
|
989
|
+
'error',
|
|
990
|
+
{
|
|
991
|
+
printWidth: 80,
|
|
992
|
+
tabWidth: 2,
|
|
993
|
+
useTabs: false,
|
|
994
|
+
semi: true,
|
|
995
|
+
singleQuote: true,
|
|
996
|
+
trailingComma: 'all',
|
|
997
|
+
bracketSpacing: true,
|
|
998
|
+
jsxBracketSameLine: true,
|
|
999
|
+
arrowParens: 'avoid',
|
|
1000
|
+
},
|
|
1001
|
+
],
|
|
1002
|
+
|
|
1003
|
+
/*
|
|
1004
|
+
* react
|
|
1005
|
+
* https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/boolean-prop-naming.md
|
|
1006
|
+
*/
|
|
1007
|
+
'react/boolean-prop-naming': [
|
|
1008
|
+
'error',
|
|
1009
|
+
{
|
|
1010
|
+
propTypeNames: ['bool'],
|
|
1011
|
+
rule: '^(is|has|should)[A-Z]([A-Za-z0-9]?)+',
|
|
1012
|
+
},
|
|
1013
|
+
],
|
|
1014
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/button-has-type.md
|
|
1015
|
+
'react/button-has-type': 'error',
|
|
1016
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/default-props-match-prop-types.md
|
|
1017
|
+
'react/default-props-match-prop-types': 'error',
|
|
1018
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/destructuring-assignment.md
|
|
1019
|
+
'react/destructuring-assignment': [
|
|
1020
|
+
'error',
|
|
1021
|
+
'always',
|
|
1022
|
+
{ ignoreClassFields: true },
|
|
1023
|
+
],
|
|
1024
|
+
|
|
1025
|
+
/*
|
|
1026
|
+
* https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/display-name.md
|
|
1027
|
+
* @TODO
|
|
1028
|
+
* @TIPS
|
|
1029
|
+
* for stateless component: use named function for now
|
|
1030
|
+
* const Dialog = ({ children }) => (
|
|
1031
|
+
* <div className="dialog">{children}</div>
|
|
1032
|
+
* )
|
|
1033
|
+
* ->
|
|
1034
|
+
* const Dialog = function Dialog({ children }) {
|
|
1035
|
+
* return (
|
|
1036
|
+
* <div className="dialog">{children}</div>
|
|
1037
|
+
* )
|
|
1038
|
+
* }
|
|
1039
|
+
* issues:
|
|
1040
|
+
* https://github.com/yannickcr/eslint-plugin-react/issues/1297
|
|
1041
|
+
* https://github.com/yannickcr/eslint-plugin-react/issues/412
|
|
1042
|
+
* feedback:
|
|
1043
|
+
* - 把一个render 作为props传入组件还是比较常见的
|
|
1044
|
+
* - 嗯ok,这个规则现在的性价比是不太高了…
|
|
1045
|
+
*/
|
|
1046
|
+
'react/display-name': 'off',
|
|
1047
|
+
// 'react/display-name': [
|
|
1048
|
+
// 'error',
|
|
1049
|
+
// {
|
|
1050
|
+
// ignoreTranspilerName: false,
|
|
1051
|
+
// },
|
|
1052
|
+
// ],
|
|
1053
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/forbid-component-props.md
|
|
1054
|
+
'react/forbid-component-props': 'off',
|
|
1055
|
+
|
|
1056
|
+
/*
|
|
1057
|
+
* @CUSTOM
|
|
1058
|
+
* "react/forbid-component-props": [
|
|
1059
|
+
* "error",
|
|
1060
|
+
* {
|
|
1061
|
+
* "forbid": [
|
|
1062
|
+
* "className",
|
|
1063
|
+
* "style"
|
|
1064
|
+
* ]
|
|
1065
|
+
* }
|
|
1066
|
+
* ],
|
|
1067
|
+
* https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/forbid-dom-props.md
|
|
1068
|
+
*/
|
|
1069
|
+
'react/forbid-dom-props': 'off',
|
|
1070
|
+
|
|
1071
|
+
/*
|
|
1072
|
+
* @CUSTOM
|
|
1073
|
+
* "react/forbid-dom-props": [
|
|
1074
|
+
* "error",
|
|
1075
|
+
* {
|
|
1076
|
+
* "forbid": []
|
|
1077
|
+
* }
|
|
1078
|
+
* ],
|
|
1079
|
+
* https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/forbid-elements.md
|
|
1080
|
+
*/
|
|
1081
|
+
'react/forbid-elements': 'off',
|
|
1082
|
+
|
|
1083
|
+
/*
|
|
1084
|
+
* @CUSTOM
|
|
1085
|
+
* "react/forbid-elements": [
|
|
1086
|
+
* "error",
|
|
1087
|
+
* {
|
|
1088
|
+
* "forbid": [
|
|
1089
|
+
* {
|
|
1090
|
+
* "element": "button",
|
|
1091
|
+
* "message": "use <Button> instead"
|
|
1092
|
+
* }
|
|
1093
|
+
* ]
|
|
1094
|
+
* }
|
|
1095
|
+
* ],
|
|
1096
|
+
* https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/forbid-prop-types.md
|
|
1097
|
+
*/
|
|
1098
|
+
'react/forbid-prop-types': 'off',
|
|
1099
|
+
|
|
1100
|
+
/*
|
|
1101
|
+
* @CUSTOM
|
|
1102
|
+
* "react/forbid-prop-types": [
|
|
1103
|
+
* "error",
|
|
1104
|
+
* {
|
|
1105
|
+
* "forbid": [],
|
|
1106
|
+
* "allowInPropTypes": []
|
|
1107
|
+
* }
|
|
1108
|
+
* ],
|
|
1109
|
+
* https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/forbid-foreign-prop-types.md
|
|
1110
|
+
*/
|
|
1111
|
+
'react/forbid-foreign-prop-types': 'error',
|
|
1112
|
+
|
|
1113
|
+
/*
|
|
1114
|
+
* https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-access-state-in-setstate.md
|
|
1115
|
+
* @TIPS
|
|
1116
|
+
* this.setState({value: this.state.value + 1});
|
|
1117
|
+
* ->
|
|
1118
|
+
* this.setState(prevState => ({value: prevState.value + 1}));
|
|
1119
|
+
*/
|
|
1120
|
+
'react/no-access-state-in-setstate': 'error',
|
|
1121
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/no-array-index-key.md
|
|
1122
|
+
'react/no-array-index-key': 'warn',
|
|
1123
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/no-children-prop.md
|
|
1124
|
+
'react/no-children-prop': 'error',
|
|
1125
|
+
|
|
1126
|
+
/*
|
|
1127
|
+
* https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/no-danger.md
|
|
1128
|
+
* @TIPS
|
|
1129
|
+
* explicitly declare `eslint-disable` when truly necessary
|
|
1130
|
+
*/
|
|
1131
|
+
'react/no-danger': 'error',
|
|
1132
|
+
|
|
1133
|
+
/*
|
|
1134
|
+
* https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/no-danger-with-children.md
|
|
1135
|
+
* @TIPS
|
|
1136
|
+
* explicitly declare `eslint-disable` when truly necessary
|
|
1137
|
+
*/
|
|
1138
|
+
'react/no-danger-with-children': 'error',
|
|
1139
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/no-deprecated.md
|
|
1140
|
+
'react/no-deprecated': 'error',
|
|
1141
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/no-did-mount-set-state.md
|
|
1142
|
+
'react/no-did-mount-set-state': 'error',
|
|
1143
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/no-did-update-set-state.md
|
|
1144
|
+
'react/no-did-update-set-state': 'off',
|
|
1145
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/no-direct-mutation-state.md
|
|
1146
|
+
'react/no-direct-mutation-state': 'error',
|
|
1147
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/no-find-dom-node.md
|
|
1148
|
+
'react/no-find-dom-node': 'error',
|
|
1149
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/no-is-mounted.md
|
|
1150
|
+
'react/no-is-mounted': 'error',
|
|
1151
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/no-multi-comp.md
|
|
1152
|
+
'react/no-multi-comp': ['error', { ignoreStateless: true }],
|
|
1153
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/no-redundant-should-component-update.md
|
|
1154
|
+
'react/no-redundant-should-component-update': 'error',
|
|
1155
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/no-render-return-value.md
|
|
1156
|
+
'react/no-render-return-value': 'error',
|
|
1157
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/no-set-state.md
|
|
1158
|
+
'react/no-set-state': 'off',
|
|
1159
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/no-typos.md
|
|
1160
|
+
'react/no-typos': 'error',
|
|
1161
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/no-string-refs.md
|
|
1162
|
+
'react/no-string-refs': 'error',
|
|
1163
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-this-in-sfc.md
|
|
1164
|
+
'react/no-this-in-sfc': 'error',
|
|
1165
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/no-unescaped-entities.md
|
|
1166
|
+
'react/no-unescaped-entities': 'error',
|
|
1167
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/no-unknown-property.md
|
|
1168
|
+
'react/no-unknown-property': 'error',
|
|
1169
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-unsafe.md
|
|
1170
|
+
'react/no-unsafe': ['error', { checkAliases: true }],
|
|
1171
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/no-unused-prop-types.md
|
|
1172
|
+
'react/no-unused-prop-types': 'error',
|
|
1173
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/no-will-update-set-state.md
|
|
1174
|
+
'react/no-will-update-set-state': 'error',
|
|
1175
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/prefer-es6-class.md
|
|
1176
|
+
'react/prefer-es6-class': 'error',
|
|
1177
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/prefer-stateless-function.md
|
|
1178
|
+
'react/prefer-stateless-function': [
|
|
1179
|
+
'error',
|
|
1180
|
+
{ ignorePureComponents: false },
|
|
1181
|
+
],
|
|
1182
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/prop-types.md
|
|
1183
|
+
'react/prop-types': [
|
|
1184
|
+
'error',
|
|
1185
|
+
{
|
|
1186
|
+
skipUndeclared: true,
|
|
1187
|
+
ignore: ['children', 'className'],
|
|
1188
|
+
},
|
|
1189
|
+
],
|
|
1190
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/react-in-jsx-scope.md
|
|
1191
|
+
// react 17
|
|
1192
|
+
'react/react-in-jsx-scope': 'off',
|
|
1193
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/require-default-props.md
|
|
1194
|
+
'react/require-default-props': [
|
|
1195
|
+
'error',
|
|
1196
|
+
{ forbidDefaultForRequired: true },
|
|
1197
|
+
],
|
|
1198
|
+
|
|
1199
|
+
/*
|
|
1200
|
+
* https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/require-optimization.md
|
|
1201
|
+
* https://github.com/facebook/react/pull/7195#issuecomment-236361372
|
|
1202
|
+
* https://hackernoon.com/react-purecomponent-considered-harmful-8155b5c1d4bc
|
|
1203
|
+
*/
|
|
1204
|
+
'react/require-optimization': 'off',
|
|
1205
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/require-render-return.md
|
|
1206
|
+
'react/require-render-return': 'error',
|
|
1207
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/self-closing-comp.md
|
|
1208
|
+
'react/self-closing-comp': [
|
|
1209
|
+
'error',
|
|
1210
|
+
{
|
|
1211
|
+
component: true,
|
|
1212
|
+
html: false,
|
|
1213
|
+
},
|
|
1214
|
+
],
|
|
1215
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/sort-comp.md
|
|
1216
|
+
'react/sort-comp': [
|
|
1217
|
+
'error',
|
|
1218
|
+
{
|
|
1219
|
+
order: [
|
|
1220
|
+
'type-annotations',
|
|
1221
|
+
'class-properties-and-methods',
|
|
1222
|
+
'instance-variables',
|
|
1223
|
+
'state',
|
|
1224
|
+
'getInitialState',
|
|
1225
|
+
'getChildContext',
|
|
1226
|
+
'getDefaultProps',
|
|
1227
|
+
'constructor',
|
|
1228
|
+
'lifecycle',
|
|
1229
|
+
'/^is.+$/',
|
|
1230
|
+
'/^_is.+$/',
|
|
1231
|
+
'/^has.+$/',
|
|
1232
|
+
'/^_has.+$/',
|
|
1233
|
+
'/^should.+$/',
|
|
1234
|
+
'/^_should.+$/',
|
|
1235
|
+
'/^get.+$/',
|
|
1236
|
+
'/^_get.+$/',
|
|
1237
|
+
'getters',
|
|
1238
|
+
'/^set.+$/',
|
|
1239
|
+
'/^_set.+$/',
|
|
1240
|
+
'setters',
|
|
1241
|
+
'/^on.+$/',
|
|
1242
|
+
'/^_on.+$/',
|
|
1243
|
+
'/^handle.+$/',
|
|
1244
|
+
'/^_handle.+$/',
|
|
1245
|
+
'instance-methods',
|
|
1246
|
+
'everything-else',
|
|
1247
|
+
'rendering',
|
|
1248
|
+
],
|
|
1249
|
+
groups: {
|
|
1250
|
+
'class-properties-and-methods': [
|
|
1251
|
+
'displayName',
|
|
1252
|
+
'propTypes',
|
|
1253
|
+
'contextTypes',
|
|
1254
|
+
'childContextTypes',
|
|
1255
|
+
'mixins',
|
|
1256
|
+
'statics',
|
|
1257
|
+
'defaultProps',
|
|
1258
|
+
'getDerivedStateFromProps',
|
|
1259
|
+
'static-methods',
|
|
1260
|
+
],
|
|
1261
|
+
lifecycle: [
|
|
1262
|
+
'UNSAFE_componentWillMount',
|
|
1263
|
+
'componentWillMount',
|
|
1264
|
+
'componentDidMount',
|
|
1265
|
+
'UNSAFE_componentWillReceiveProps',
|
|
1266
|
+
'componentWillReceiveProps',
|
|
1267
|
+
'shouldComponentUpdate',
|
|
1268
|
+
'getSnapshotBeforeUpdate',
|
|
1269
|
+
'UNSAFE_componentWillUpdate',
|
|
1270
|
+
'componentWillUpdate',
|
|
1271
|
+
'componentDidUpdate',
|
|
1272
|
+
'componentWillUnmount',
|
|
1273
|
+
],
|
|
1274
|
+
rendering: ['/^render.+$/', 'render'],
|
|
1275
|
+
},
|
|
1276
|
+
},
|
|
1277
|
+
],
|
|
1278
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/sort-prop-types.md
|
|
1279
|
+
'react/sort-prop-types': 'off',
|
|
1280
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/style-prop-object.md
|
|
1281
|
+
'react/style-prop-object': 'error',
|
|
1282
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/void-dom-elements-no-children.md
|
|
1283
|
+
'react/void-dom-elements-no-children': 'error',
|
|
1284
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-boolean-value.md
|
|
1285
|
+
'react/jsx-boolean-value': ['error', 'always'],
|
|
1286
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-child-element-spacing.md
|
|
1287
|
+
'react/jsx-child-element-spacing': 'error',
|
|
1288
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-closing-bracket-location.md
|
|
1289
|
+
'react/jsx-closing-bracket-location': [
|
|
1290
|
+
'error',
|
|
1291
|
+
{
|
|
1292
|
+
// "selfClosing": "props-aligned",
|
|
1293
|
+
selfClosing: 'after-props',
|
|
1294
|
+
// "nonEmpty": "props-aligned"
|
|
1295
|
+
nonEmpty: 'after-props',
|
|
1296
|
+
},
|
|
1297
|
+
],
|
|
1298
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-closing-tag-location.md
|
|
1299
|
+
'react/jsx-closing-tag-location': 'error',
|
|
1300
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-curly-spacing.md
|
|
1301
|
+
'react/jsx-curly-spacing': ['error', { when: 'never' }],
|
|
1302
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-equals-spacing.md
|
|
1303
|
+
'react/jsx-equals-spacing': ['error', 'never'],
|
|
1304
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-filename-extension.md
|
|
1305
|
+
'react/jsx-filename-extension': [
|
|
1306
|
+
'error',
|
|
1307
|
+
{ extensions: ['.jsx', '.tsx', '.mjsx', '.cjsx'] },
|
|
1308
|
+
],
|
|
1309
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-first-prop-new-line.md
|
|
1310
|
+
'react/jsx-first-prop-new-line': ['error', 'multiline'],
|
|
1311
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-handler-names.md
|
|
1312
|
+
'react/jsx-handler-names': [
|
|
1313
|
+
'error',
|
|
1314
|
+
{
|
|
1315
|
+
eventHandlerPrefix: '',
|
|
1316
|
+
// eventHandlerPrefix: 'handle',
|
|
1317
|
+
eventHandlerPropPrefix: 'on',
|
|
1318
|
+
},
|
|
1319
|
+
],
|
|
1320
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-indent.md
|
|
1321
|
+
'react/jsx-indent': ['error', 2],
|
|
1322
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-indent-props.md
|
|
1323
|
+
'react/jsx-indent-props': ['error', 2],
|
|
1324
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-key.md
|
|
1325
|
+
'react/jsx-key': 'error',
|
|
1326
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-max-depth.md
|
|
1327
|
+
'react/jsx-max-depth': 'off',
|
|
1328
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-max-props-per-line.md
|
|
1329
|
+
'react/jsx-max-props-per-line': [
|
|
1330
|
+
'error',
|
|
1331
|
+
{
|
|
1332
|
+
maximum: 1,
|
|
1333
|
+
when: 'always',
|
|
1334
|
+
},
|
|
1335
|
+
],
|
|
1336
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-bind.md
|
|
1337
|
+
'react/jsx-no-bind': [
|
|
1338
|
+
'error',
|
|
1339
|
+
{
|
|
1340
|
+
ignoreRefs: true,
|
|
1341
|
+
allowArrowFunctions: true,
|
|
1342
|
+
},
|
|
1343
|
+
],
|
|
1344
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-comment-textnodes.md
|
|
1345
|
+
'react/jsx-no-comment-textnodes': 'error',
|
|
1346
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-duplicate-props.md
|
|
1347
|
+
'react/jsx-no-duplicate-props': ['error', { ignoreCase: true }],
|
|
1348
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-literals.md
|
|
1349
|
+
'react/jsx-no-literals': 'off',
|
|
1350
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-target-blank.md
|
|
1351
|
+
'react/jsx-no-target-blank': 'off',
|
|
1352
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-undef.md
|
|
1353
|
+
'react/jsx-no-undef': ['error', { allowGlobals: true }],
|
|
1354
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-one-expression-per-line.md
|
|
1355
|
+
'react/jsx-one-expression-per-line': ['error', { allow: 'single-child' }],
|
|
1356
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-curly-brace-presence.md
|
|
1357
|
+
'react/jsx-curly-brace-presence': 'off',
|
|
1358
|
+
|
|
1359
|
+
/*
|
|
1360
|
+
* "react/jsx-curly-brace-presence": [
|
|
1361
|
+
* "error",
|
|
1362
|
+
* "never"
|
|
1363
|
+
* ],
|
|
1364
|
+
* https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-fragments.md
|
|
1365
|
+
* @TODO bug
|
|
1366
|
+
*/
|
|
1367
|
+
'react/jsx-fragments': 'off', // ['error', 'syntax'],
|
|
1368
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-pascal-case.md
|
|
1369
|
+
'react/jsx-pascal-case': 'error',
|
|
1370
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-props-no-multi-spaces.md
|
|
1371
|
+
'react/jsx-props-no-multi-spaces': 'error',
|
|
1372
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-sort-default-props.md
|
|
1373
|
+
'react/jsx-sort-default-props': 'off',
|
|
1374
|
+
|
|
1375
|
+
/*
|
|
1376
|
+
* https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-sort-props.md
|
|
1377
|
+
* @TODO bug: conflict with prettier
|
|
1378
|
+
*/
|
|
1379
|
+
'react/jsx-sort-props': 'off',
|
|
1380
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-tag-spacing.md
|
|
1381
|
+
'react/jsx-tag-spacing': [
|
|
1382
|
+
'error',
|
|
1383
|
+
{
|
|
1384
|
+
closingSlash: 'never',
|
|
1385
|
+
beforeSelfClosing: 'always',
|
|
1386
|
+
afterOpening: 'never',
|
|
1387
|
+
beforeClosing: 'never',
|
|
1388
|
+
},
|
|
1389
|
+
],
|
|
1390
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-uses-react.md
|
|
1391
|
+
// react 17
|
|
1392
|
+
'react/jsx-uses-react': 'error',
|
|
1393
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-uses-vars.md
|
|
1394
|
+
'react/jsx-uses-vars': 'error',
|
|
1395
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-wrap-multilines.md
|
|
1396
|
+
'react/jsx-wrap-multilines': [
|
|
1397
|
+
'error',
|
|
1398
|
+
{
|
|
1399
|
+
declaration: true,
|
|
1400
|
+
assignment: true,
|
|
1401
|
+
return: true,
|
|
1402
|
+
arrow: true,
|
|
1403
|
+
condition: 'parens-new-line',
|
|
1404
|
+
logical: 'parens-new-line',
|
|
1405
|
+
prop: 'parens-new-line',
|
|
1406
|
+
},
|
|
1407
|
+
],
|
|
1408
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-unused-state.md
|
|
1409
|
+
'react/no-unused-state': 'error',
|
|
1410
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-props-no-spreading.md
|
|
1411
|
+
'react/jsx-props-no-spreading': 'off',
|
|
1412
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prefer-read-only-props.md
|
|
1413
|
+
'react/prefer-read-only-props': 'off',
|
|
1414
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/state-in-constructor.md
|
|
1415
|
+
'react/state-in-constructor': ['error', 'never'],
|
|
1416
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/static-property-placement.md
|
|
1417
|
+
'react/static-property-placement': 'error',
|
|
1418
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-curly-newline.md
|
|
1419
|
+
'react/jsx-curly-newline': [
|
|
1420
|
+
'error',
|
|
1421
|
+
{ multiline: 'require', singleline: 'forbid' },
|
|
1422
|
+
],
|
|
1423
|
+
// https://reactjs.org/docs/hooks-rules.html
|
|
1424
|
+
'react-hooks/rules-of-hooks': 'error',
|
|
1425
|
+
// https://github.com/facebook/react/issues/16006
|
|
1426
|
+
'react-hooks/exhaustive-deps': 'off',
|
|
1427
|
+
|
|
1428
|
+
/*
|
|
1429
|
+
* import
|
|
1430
|
+
* Static analysis
|
|
1431
|
+
* https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-unresolved.md
|
|
1432
|
+
*/
|
|
1433
|
+
'import/no-unresolved': 'off',
|
|
1434
|
+
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/named.md
|
|
1435
|
+
// @bug
|
|
1436
|
+
'import/named': 'off',
|
|
1437
|
+
// 'import/named': 'error',
|
|
1438
|
+
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/default.md
|
|
1439
|
+
'import/default': 'error',
|
|
1440
|
+
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/namespace.md
|
|
1441
|
+
'import/namespace': ['error', { allowComputed: true }],
|
|
1442
|
+
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-restricted-paths.md
|
|
1443
|
+
'import/no-restricted-paths': 'warn',
|
|
1444
|
+
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-absolute-path.md
|
|
1445
|
+
'import/no-absolute-path': 'error',
|
|
1446
|
+
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-dynamic-require.md
|
|
1447
|
+
'import/no-dynamic-require': 'error',
|
|
1448
|
+
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-internal-modules.md
|
|
1449
|
+
'import/no-internal-modules': 'off',
|
|
1450
|
+
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-unused-modules.md
|
|
1451
|
+
// @BUG
|
|
1452
|
+
'import/no-unused-modules': 'off',
|
|
1453
|
+
// 'import/no-unused-modules': [
|
|
1454
|
+
// 'error',
|
|
1455
|
+
// {
|
|
1456
|
+
// missingExports: false,
|
|
1457
|
+
// unusedExports: true,
|
|
1458
|
+
// },
|
|
1459
|
+
// ],
|
|
1460
|
+
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-webpack-loader-syntax.md
|
|
1461
|
+
'import/no-webpack-loader-syntax': 'off',
|
|
1462
|
+
|
|
1463
|
+
/*
|
|
1464
|
+
* Helpful warnings
|
|
1465
|
+
* https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/export.md
|
|
1466
|
+
*/
|
|
1467
|
+
'import/export': 'error',
|
|
1468
|
+
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-named-as-default.md
|
|
1469
|
+
'import/no-named-as-default': 'error',
|
|
1470
|
+
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-named-as-default-member.md
|
|
1471
|
+
'import/no-named-as-default-member': 'error',
|
|
1472
|
+
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-deprecated.md
|
|
1473
|
+
'import/no-deprecated': 'warn',
|
|
1474
|
+
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-extraneous-dependencies.md
|
|
1475
|
+
'import/no-extraneous-dependencies': 'off',
|
|
1476
|
+
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-mutable-exports.md
|
|
1477
|
+
'import/no-mutable-exports': 'error',
|
|
1478
|
+
|
|
1479
|
+
/*
|
|
1480
|
+
* Module systems
|
|
1481
|
+
* https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/unambiguous.md
|
|
1482
|
+
*/
|
|
1483
|
+
'import/unambiguous': 'off',
|
|
1484
|
+
|
|
1485
|
+
/*
|
|
1486
|
+
* https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-commonjs.md
|
|
1487
|
+
* @TIPS
|
|
1488
|
+
* for the following 'require' usages:
|
|
1489
|
+
* 1. dynamic module path -
|
|
1490
|
+
* explicitly declare `eslint-disable` when truly necessary
|
|
1491
|
+
* 2. dependencies determined at runtime -
|
|
1492
|
+
* dynamic import,
|
|
1493
|
+
* or es6 import + tree shaking,
|
|
1494
|
+
* or explicitly declare `eslint-disable` when truly necessary
|
|
1495
|
+
* 3. side effect module -
|
|
1496
|
+
* `import 'xxx'` (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import#Import_a_module_for_its_side_effects_only)
|
|
1497
|
+
* 4. async require or promise-loader -
|
|
1498
|
+
* dynamic import (`import('xxx').then()`)
|
|
1499
|
+
* for 'modules.exports = jsonData' usage:
|
|
1500
|
+
* solutions:
|
|
1501
|
+
* #1: use JSON format
|
|
1502
|
+
* #2: use es6 export
|
|
1503
|
+
* export const wechatPayGray = 'xxxx'
|
|
1504
|
+
* #3: export named object
|
|
1505
|
+
* const iconPath = {
|
|
1506
|
+
* wechatPayGray: 'xxxx',
|
|
1507
|
+
* // ...
|
|
1508
|
+
* }
|
|
1509
|
+
* export default iconPath
|
|
1510
|
+
*/
|
|
1511
|
+
'import/no-commonjs': 'error',
|
|
1512
|
+
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-amd.md
|
|
1513
|
+
'import/no-amd': 'error',
|
|
1514
|
+
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-nodejs-modules.md
|
|
1515
|
+
'import/no-nodejs-modules': 'off',
|
|
1516
|
+
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/first.md
|
|
1517
|
+
'import/first': 'error',
|
|
1518
|
+
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/exports-last.md
|
|
1519
|
+
'import/exports-last': 'off',
|
|
1520
|
+
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-duplicates.md
|
|
1521
|
+
'import/no-duplicates': 'error',
|
|
1522
|
+
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-namespace.md
|
|
1523
|
+
'import/no-namespace': 'off',
|
|
1524
|
+
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/extensions.md
|
|
1525
|
+
// @bug
|
|
1526
|
+
'import/extensions': 'off',
|
|
1527
|
+
// 'import/extensions': [
|
|
1528
|
+
// 'error',
|
|
1529
|
+
// 'always',
|
|
1530
|
+
// {
|
|
1531
|
+
// js: 'never',
|
|
1532
|
+
// jsx: 'never',
|
|
1533
|
+
// ts: 'never',
|
|
1534
|
+
// tsx: 'never',
|
|
1535
|
+
// mjs: 'never',
|
|
1536
|
+
// mjsx: 'never',
|
|
1537
|
+
// cjs: 'never',
|
|
1538
|
+
// cjsx: 'never',
|
|
1539
|
+
// },
|
|
1540
|
+
// ],
|
|
1541
|
+
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/order.md
|
|
1542
|
+
'import/order': [
|
|
1543
|
+
'error',
|
|
1544
|
+
{
|
|
1545
|
+
groups: [
|
|
1546
|
+
'builtin',
|
|
1547
|
+
'external',
|
|
1548
|
+
'internal',
|
|
1549
|
+
'parent',
|
|
1550
|
+
'sibling',
|
|
1551
|
+
'index',
|
|
1552
|
+
],
|
|
1553
|
+
'newlines-between': 'ignore',
|
|
1554
|
+
},
|
|
1555
|
+
],
|
|
1556
|
+
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/newline-after-import.md
|
|
1557
|
+
'import/newline-after-import': 'error',
|
|
1558
|
+
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/prefer-default-export.md
|
|
1559
|
+
'import/prefer-default-export': 'off',
|
|
1560
|
+
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/max-dependencies.md
|
|
1561
|
+
'import/max-dependencies': 'off',
|
|
1562
|
+
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-unassigned-import.md
|
|
1563
|
+
'import/no-unassigned-import': 'off',
|
|
1564
|
+
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-named-default.md
|
|
1565
|
+
'import/no-named-default': 'error',
|
|
1566
|
+
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-anonymous-default-export.md
|
|
1567
|
+
'import/no-anonymous-default-export': [
|
|
1568
|
+
'error',
|
|
1569
|
+
{
|
|
1570
|
+
allowArrowFunction: true,
|
|
1571
|
+
allowAnonymousFunction: true,
|
|
1572
|
+
},
|
|
1573
|
+
],
|
|
1574
|
+
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/group-exports.md
|
|
1575
|
+
'import/group-exports': 'off',
|
|
1576
|
+
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-self-import.md
|
|
1577
|
+
'import/no-self-import': 'error',
|
|
1578
|
+
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-default-export.md
|
|
1579
|
+
'import/no-default-export': 'off',
|
|
1580
|
+
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-named-export.md
|
|
1581
|
+
'import/no-named-export': 'off',
|
|
1582
|
+
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-useless-path-segments.md
|
|
1583
|
+
'import/no-useless-path-segments': ['error', { noUselessIndex: true }],
|
|
1584
|
+
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-cycle.md
|
|
1585
|
+
'import/no-cycle': 'off',
|
|
1586
|
+
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/dynamic-import-chunkname.md
|
|
1587
|
+
// @TODO
|
|
1588
|
+
'import/dynamic-import-chunkname': 'off',
|
|
1589
|
+
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-relative-parent-imports.md
|
|
1590
|
+
// @BUG `import { createModel } from '@modern-js-reduck/core'` in monorepo
|
|
1591
|
+
'import/no-relative-parent-imports': 'off',
|
|
1592
|
+
// 'import/no-relative-parent-imports': 'error',
|
|
1593
|
+
// eslint-comments
|
|
1594
|
+
// https://github.com/mysticatea/eslint-plugin-eslint-comments/blob/HEAD/docs/rules/disable-enable-pair.md
|
|
1595
|
+
'eslint-comments/disable-enable-pair': ['error', { allowWholeFile: false }],
|
|
1596
|
+
// https://github.com/mysticatea/eslint-plugin-eslint-comments/blob/HEAD/docs/rules/no-duplicate-disable.md
|
|
1597
|
+
'eslint-comments/no-duplicate-disable': 'error',
|
|
1598
|
+
|
|
1599
|
+
/*
|
|
1600
|
+
* https://github.com/mysticatea/eslint-plugin-eslint-comments/blob/HEAD/docs/rules/no-unlimited-disable.md
|
|
1601
|
+
* @TIPS
|
|
1602
|
+
* move code into a dedicated directory with its own .eslintrc
|
|
1603
|
+
*/
|
|
1604
|
+
'eslint-comments/no-unlimited-disable': 'error',
|
|
1605
|
+
// https://github.com/mysticatea/eslint-plugin-eslint-comments/blob/HEAD/docs/rules/no-unused-disable.md
|
|
1606
|
+
'eslint-comments/no-unused-disable': 'error',
|
|
1607
|
+
// https://github.com/mysticatea/eslint-plugin-eslint-comments/blob/HEAD/docs/rules/no-unused-enable.md
|
|
1608
|
+
'eslint-comments/no-unused-enable': 'error',
|
|
1609
|
+
// https://github.com/mysticatea/eslint-plugin-eslint-comments/blob/HEAD/docs/rules/no-use.md
|
|
1610
|
+
'eslint-comments/no-use': [
|
|
1611
|
+
'error',
|
|
1612
|
+
{
|
|
1613
|
+
allow: [
|
|
1614
|
+
// 'eslint',
|
|
1615
|
+
'eslint-disable',
|
|
1616
|
+
'eslint-disable-line',
|
|
1617
|
+
'eslint-disable-next-line',
|
|
1618
|
+
'eslint-enable',
|
|
1619
|
+
'eslint-env',
|
|
1620
|
+
// "exported",
|
|
1621
|
+
// "global",
|
|
1622
|
+
// "globals",
|
|
1623
|
+
],
|
|
1624
|
+
},
|
|
1625
|
+
],
|
|
1626
|
+
// https://github.com/mysticatea/eslint-plugin-eslint-comments/blob/HEAD/docs/rules/no-aggregating-enable.md
|
|
1627
|
+
'eslint-comments/no-aggregating-enable': 'error',
|
|
1628
|
+
// https://github.com/mysticatea/eslint-plugin-eslint-comments/blob/HEAD/docs/rules/no-restricted-disable.md
|
|
1629
|
+
'eslint-comments/no-restricted-disable': 'off',
|
|
1630
|
+
|
|
1631
|
+
/*
|
|
1632
|
+
* filenames
|
|
1633
|
+
* https://www.npmjs.com/package/eslint-plugin-filenames#consistent-filenames-via-regex-match-regex
|
|
1634
|
+
* @TIPS
|
|
1635
|
+
* use Pascal Case for class and react component
|
|
1636
|
+
* use Camel Case for others
|
|
1637
|
+
*/
|
|
1638
|
+
'filenames/match-regex': ['error', '^[a-zA-Z0-9.-]+$'],
|
|
1639
|
+
// https://www.npmjs.com/package/eslint-plugin-filenames#matching-exported-values-match-exported
|
|
1640
|
+
'filenames/match-exported': ['error', ['kebab', 'camel', 'pascal']],
|
|
1641
|
+
// https://www.npmjs.com/package/eslint-plugin-filenames#dont-allow-indexjs-files-no-index
|
|
1642
|
+
'filenames/no-index': 'off',
|
|
1643
|
+
|
|
1644
|
+
/*
|
|
1645
|
+
* promise
|
|
1646
|
+
* https://github.com/xjamundx/eslint-plugin-promise/blob/master/docs/rules/catch-or-return.md
|
|
1647
|
+
*/
|
|
1648
|
+
'promise/catch-or-return': 'off',
|
|
1649
|
+
// https://github.com/xjamundx/eslint-plugin-promise/blob/master/docs/rules/no-return-wrap.md
|
|
1650
|
+
'promise/no-return-wrap': 'error',
|
|
1651
|
+
// https://github.com/xjamundx/eslint-plugin-promise/blob/master/docs/rules/param-names.md
|
|
1652
|
+
'promise/param-names': 'error',
|
|
1653
|
+
// https://github.com/xjamundx/eslint-plugin-promise/blob/master/docs/rules/always-return.md
|
|
1654
|
+
'promise/always-return': 'off',
|
|
1655
|
+
// https://github.com/xjamundx/eslint-plugin-promise/blob/master/docs/rules/no-native.md
|
|
1656
|
+
'promise/no-native': 'off',
|
|
1657
|
+
// https://github.com/xjamundx/eslint-plugin-promise/blob/master/docs/rules/no-nesting.md
|
|
1658
|
+
'promise/no-nesting': 'warn',
|
|
1659
|
+
// https://github.com/xjamundx/eslint-plugin-promise/blob/master/docs/rules/no-promise-in-callback.md
|
|
1660
|
+
'promise/no-promise-in-callback': 'warn',
|
|
1661
|
+
// https://github.com/xjamundx/eslint-plugin-promise/blob/master/docs/rules/no-callback-in-promise.md
|
|
1662
|
+
'promise/no-callback-in-promise': 'off',
|
|
1663
|
+
// https://github.com/xjamundx/eslint-plugin-promise/blob/master/docs/rules/avoid-new.md
|
|
1664
|
+
'promise/avoid-new': 'off',
|
|
1665
|
+
// https://github.com/xjamundx/eslint-plugin-promise/blob/master/docs/rules/no-new-statics.md
|
|
1666
|
+
'promise/no-new-statics': 'error',
|
|
1667
|
+
// https://github.com/xjamundx/eslint-plugin-promise/blob/master/docs/rules/valid-params.md
|
|
1668
|
+
'promise/valid-params': 'error',
|
|
1669
|
+
|
|
1670
|
+
/*
|
|
1671
|
+
* https://github.com/xjamundx/eslint-plugin-promise/blob/master/docs/rules/prefer-await-to-then.md
|
|
1672
|
+
* @CUSTOM
|
|
1673
|
+
*/
|
|
1674
|
+
'promise/prefer-await-to-then': 'error',
|
|
1675
|
+
|
|
1676
|
+
/*
|
|
1677
|
+
* https://github.com/xjamundx/eslint-plugin-promise/blob/master/docs/rules/prefer-await-to-callbacks.md
|
|
1678
|
+
* @CUSTOM
|
|
1679
|
+
*/
|
|
1680
|
+
'promise/prefer-await-to-callbacks': 'off',
|
|
1681
|
+
|
|
1682
|
+
/*
|
|
1683
|
+
* node
|
|
1684
|
+
*/
|
|
1685
|
+
// https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/no-restricted-import.md
|
|
1686
|
+
'node/no-restricted-import': 'off',
|
|
1687
|
+
// https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/no-exports-assign.md
|
|
1688
|
+
'node/no-exports-assign': 'error',
|
|
1689
|
+
// https://github.com/mysticatea/eslint-plugin-node/blob/HEAD/docs/rules/no-extraneous-import.md
|
|
1690
|
+
'node/no-extraneous-import': 'off',
|
|
1691
|
+
// https://github.com/mysticatea/eslint-plugin-node/blob/HEAD/docs/rules/no-extraneous-require.md
|
|
1692
|
+
'node/no-extraneous-require': 'off',
|
|
1693
|
+
// https://github.com/mysticatea/eslint-plugin-node/blob/HEAD/docs/rules/no-missing-import.md
|
|
1694
|
+
'node/no-missing-import': 'off',
|
|
1695
|
+
// https://github.com/mysticatea/eslint-plugin-node/blob/HEAD/docs/rules/no-missing-require.md
|
|
1696
|
+
'node/no-missing-require': 'off',
|
|
1697
|
+
// https://github.com/mysticatea/eslint-plugin-node/blob/HEAD/docs/rules/no-unpublished-import.md
|
|
1698
|
+
'node/no-unpublished-import': 'off',
|
|
1699
|
+
// https://github.com/mysticatea/eslint-plugin-node/blob/HEAD/docs/rules/no-unpublished-require.md
|
|
1700
|
+
'node/no-unpublished-require': 'off',
|
|
1701
|
+
// https://github.com/mysticatea/eslint-plugin-node/blob/HEAD/docs/rules/no-unpublished-bin.md
|
|
1702
|
+
'node/no-unpublished-bin': 'error',
|
|
1703
|
+
// https://github.com/mysticatea/eslint-plugin-node/blob/v7.0.0/docs/rules/no-unsupported-features/es-builtins.md
|
|
1704
|
+
'node/no-unsupported-features/es-builtins': 'off',
|
|
1705
|
+
// https://github.com/mysticatea/eslint-plugin-node/blob/v7.0.0/docs/rules/no-unsupported-features/es-syntax.md
|
|
1706
|
+
'node/no-unsupported-features/es-syntax': 'off',
|
|
1707
|
+
// https://github.com/mysticatea/eslint-plugin-node/blob/v7.0.0/docs/rules/no-unsupported-features/node-builtins.md
|
|
1708
|
+
'node/no-unsupported-features/node-builtins': 'off',
|
|
1709
|
+
// https://github.com/mysticatea/eslint-plugin-node/blob/v7.0.0/docs/rules/prefer-global/process.md
|
|
1710
|
+
'node/prefer-global/process': ['error', 'always'],
|
|
1711
|
+
// https://github.com/mysticatea/eslint-plugin-node/blob/v7.0.0/docs/rules/prefer-global/console.md
|
|
1712
|
+
'node/prefer-global/console': ['error', 'always'],
|
|
1713
|
+
// https://github.com/mysticatea/eslint-plugin-node/blob/v7.0.0/docs/rules/prefer-global/url.md
|
|
1714
|
+
'node/prefer-global/url': 'off',
|
|
1715
|
+
// https://github.com/mysticatea/eslint-plugin-node/blob/v7.0.0/docs/rules/prefer-global/url-search-params.md
|
|
1716
|
+
'node/prefer-global/url-search-params': 'off',
|
|
1717
|
+
// https://github.com/mysticatea/eslint-plugin-node/blob/v7.0.0/docs/rules/prefer-global/buffer.md
|
|
1718
|
+
'node/prefer-global/buffer': 'off',
|
|
1719
|
+
// https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/prefer-global/text-decoder.md
|
|
1720
|
+
'node/prefer-global/text-decoder': 'off',
|
|
1721
|
+
// https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/prefer-global/text-encoder.md
|
|
1722
|
+
'node/prefer-global/text-encoder': 'off',
|
|
1723
|
+
// https://github.com/mysticatea/eslint-plugin-node/blob/HEAD/docs/rules/process-exit-as-throw.md
|
|
1724
|
+
'node/process-exit-as-throw': 'off',
|
|
1725
|
+
// https://github.com/mysticatea/eslint-plugin-node/blob/HEAD/docs/rules/shebang.md
|
|
1726
|
+
'node/shebang': 'error',
|
|
1727
|
+
// https://github.com/mysticatea/eslint-plugin-node/blob/HEAD/docs/rules/no-deprecated-api.md
|
|
1728
|
+
'node/no-deprecated-api': 'off',
|
|
1729
|
+
// https://github.com/mysticatea/eslint-plugin-node/blob/HEAD/docs/rules/exports-style.md
|
|
1730
|
+
'node/exports-style': 'off',
|
|
1731
|
+
// https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/file-extension-in-import.md
|
|
1732
|
+
'node/file-extension-in-import': [
|
|
1733
|
+
'error',
|
|
1734
|
+
'always',
|
|
1735
|
+
{
|
|
1736
|
+
'.js': 'never',
|
|
1737
|
+
'.jsx': 'never',
|
|
1738
|
+
'.ts': 'never',
|
|
1739
|
+
'.d.ts': 'never',
|
|
1740
|
+
'.tsx': 'never',
|
|
1741
|
+
'.mjs': 'never',
|
|
1742
|
+
'.mjsx': 'never',
|
|
1743
|
+
'.cjs': 'never',
|
|
1744
|
+
'.cjsx': 'never',
|
|
1745
|
+
tryExtensions: [...jsExtensions, '.json', '.node'],
|
|
1746
|
+
},
|
|
1747
|
+
],
|
|
1748
|
+
// https://github.com/mysticatea/eslint-plugin-node/blob/v9.0.0/docs/rules/prefer-promises/dns.md
|
|
1749
|
+
'node/prefer-promises/dns': 'off',
|
|
1750
|
+
// https://github.com/mysticatea/eslint-plugin-node/blob/v9.0.0/docs/rules/prefer-promises/fs.md
|
|
1751
|
+
'node/prefer-promises/fs': 'off',
|
|
1752
|
+
|
|
1753
|
+
/*
|
|
1754
|
+
* JSDoc
|
|
1755
|
+
* @TIPS
|
|
1756
|
+
* if your block comments are not JSDoc,
|
|
1757
|
+
* change `/**` into `/*`
|
|
1758
|
+
* https://github.com/gajus/eslint-plugin-jsdoc#check-alignment
|
|
1759
|
+
*/
|
|
1760
|
+
// 'jsdoc/check-alignment': 'error',
|
|
1761
|
+
// // https://github.com/gajus/eslint-plugin-jsdoc#check-examples
|
|
1762
|
+
// 'jsdoc/check-examples': 'off',
|
|
1763
|
+
// // https://github.com/gajus/eslint-plugin-jsdoc#check-indentation
|
|
1764
|
+
// 'jsdoc/check-indentation': 'off',
|
|
1765
|
+
// // https://github.com/gajus/eslint-plugin-jsdoc#check-param-names
|
|
1766
|
+
// 'jsdoc/check-param-names': 'error',
|
|
1767
|
+
// // https://github.com/gajus/eslint-plugin-jsdoc#check-syntax
|
|
1768
|
+
// 'jsdoc/check-syntax': 'error',
|
|
1769
|
+
// // https://github.com/gajus/eslint-plugin-jsdoc#check-tag-names
|
|
1770
|
+
// 'jsdoc/check-tag-names': 'error',
|
|
1771
|
+
// // https://github.com/gajus/eslint-plugin-jsdoc#check-types
|
|
1772
|
+
// 'jsdoc/check-types': 'error',
|
|
1773
|
+
// // https://github.com/gajus/eslint-plugin-jsdoc#implements-on-classes
|
|
1774
|
+
// 'jsdoc/implements-on-classes': 'error',
|
|
1775
|
+
// // https://github.com/gajus/eslint-plugin-jsdoc#match-description
|
|
1776
|
+
// 'jsdoc/match-description': 'off',
|
|
1777
|
+
// // https://github.com/gajus/eslint-plugin-jsdoc#newline-after-description
|
|
1778
|
+
// 'jsdoc/newline-after-description': ['error', 'always'],
|
|
1779
|
+
// // https://github.com/gajus/eslint-plugin-jsdoc#no-types
|
|
1780
|
+
// 'jsdoc/no-types': 'off',
|
|
1781
|
+
// // https://github.com/gajus/eslint-plugin-jsdoc#no-undefined-types
|
|
1782
|
+
// 'jsdoc/no-undefined-types': 'error',
|
|
1783
|
+
// // https://github.com/gajus/eslint-plugin-jsdoc#require-description-complete-sentence
|
|
1784
|
+
// 'jsdoc/require-description-complete-sentence': 'off',
|
|
1785
|
+
// // https://github.com/gajus/eslint-plugin-jsdoc#require-description
|
|
1786
|
+
// 'jsdoc/require-description': 'error',
|
|
1787
|
+
// // https://github.com/gajus/eslint-plugin-jsdoc#require-example
|
|
1788
|
+
// 'jsdoc/require-example': 'off',
|
|
1789
|
+
// // https://github.com/gajus/eslint-plugin-jsdoc#require-hyphen-before-param-description
|
|
1790
|
+
// 'jsdoc/require-hyphen-before-param-description': ['error', 'always'],
|
|
1791
|
+
// // https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-require-jsdoc
|
|
1792
|
+
// 'jsdoc/require-jsdoc': 'off',
|
|
1793
|
+
// // https://github.com/gajus/eslint-plugin-jsdoc#require-param-description
|
|
1794
|
+
// 'jsdoc/require-param-description': 'error',
|
|
1795
|
+
// // https://github.com/gajus/eslint-plugin-jsdoc#require-param-name
|
|
1796
|
+
// 'jsdoc/require-param-name': 'error',
|
|
1797
|
+
// // https://github.com/gajus/eslint-plugin-jsdoc#require-param-type
|
|
1798
|
+
// 'jsdoc/require-param-type': 'off',
|
|
1799
|
+
// // https://github.com/gajus/eslint-plugin-jsdoc#require-param
|
|
1800
|
+
// 'jsdoc/require-param': 'off',
|
|
1801
|
+
// // https://github.com/gajus/eslint-plugin-jsdoc#require-returns-check
|
|
1802
|
+
// 'jsdoc/require-returns-check': 'error',
|
|
1803
|
+
// // https://github.com/gajus/eslint-plugin-jsdoc#require-returns-description
|
|
1804
|
+
// 'jsdoc/require-returns-description': 'error',
|
|
1805
|
+
// // https://github.com/gajus/eslint-plugin-jsdoc#require-returns-type
|
|
1806
|
+
// 'jsdoc/require-returns-type': 'off',
|
|
1807
|
+
// // https://github.com/gajus/eslint-plugin-jsdoc#require-returns
|
|
1808
|
+
// 'jsdoc/require-returns': 'off',
|
|
1809
|
+
// // https://github.com/gajus/eslint-plugin-jsdoc#valid-types
|
|
1810
|
+
// 'jsdoc/valid-types': 'off',
|
|
1811
|
+
},
|
|
1812
|
+
settings: {
|
|
1813
|
+
'import/resolver': 'webpack',
|
|
1814
|
+
'import/extensions': jsExtensions,
|
|
1815
|
+
'import/ignore': ['\\.coffee$'],
|
|
1816
|
+
react: { version: '16.0' },
|
|
1817
|
+
},
|
|
1818
|
+
// https://eslint.org/docs/user-guide/configuring#configuration-based-on-glob-patterns
|
|
1819
|
+
// https://eslint.org/docs/user-guide/migrating-to-6.0.0#-overrides-in-an-extended-config-file-can-now-be-overridden-by-a-parent-config-file
|
|
1820
|
+
overrides: [
|
|
1821
|
+
{
|
|
1822
|
+
files: ['*.ts', '*.d.ts', '*.tsx'],
|
|
1823
|
+
|
|
1824
|
+
/*
|
|
1825
|
+
* https://eslint.org/blog/2019/01/future-typescript-eslint
|
|
1826
|
+
* https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/parser
|
|
1827
|
+
*/
|
|
1828
|
+
parser: '@typescript-eslint/parser',
|
|
1829
|
+
parserOptions: {
|
|
1830
|
+
ecmaFeatures: { jsx: true },
|
|
1831
|
+
project: './tsconfig.json',
|
|
1832
|
+
// createDefaultProgram: true,
|
|
1833
|
+
// project: 'node_modules/@modern/config/defaults/tsconfig.json',
|
|
1834
|
+
// tsconfigRootDir: path.resolve(
|
|
1835
|
+
// path.dirname(require.resolve('eslint/package.json')),
|
|
1836
|
+
// '../..',
|
|
1837
|
+
// ),
|
|
1838
|
+
},
|
|
1839
|
+
// https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/eslint-plugin
|
|
1840
|
+
plugins: [
|
|
1841
|
+
'@typescript-eslint',
|
|
1842
|
+
// 'tsdoc'
|
|
1843
|
+
],
|
|
1844
|
+
// @BUG
|
|
1845
|
+
// extends: ['plugin:@typescript-eslint/recommended'],
|
|
1846
|
+
// https://github.com/benmosher/eslint-plugin-import/blob/master/config/typescript.js
|
|
1847
|
+
settings: {
|
|
1848
|
+
'import/external-module-folders': [
|
|
1849
|
+
'node_modules',
|
|
1850
|
+
'node_modules/@types',
|
|
1851
|
+
],
|
|
1852
|
+
'import/parsers': {
|
|
1853
|
+
'@typescript-eslint/parser': ['.ts', '.tsx', '.d.ts'],
|
|
1854
|
+
},
|
|
1855
|
+
'import/resolver': { node: { extensions: jsExtensions } },
|
|
1856
|
+
},
|
|
1857
|
+
rules: {
|
|
1858
|
+
// https://github.com/benmosher/eslint-plugin-import/blob/master/config/typescript.js
|
|
1859
|
+
'import/named': 'off',
|
|
1860
|
+
camelcase: 'off',
|
|
1861
|
+
indent: 'off',
|
|
1862
|
+
'no-unused-vars': 'off',
|
|
1863
|
+
'no-use-before-define': 'off',
|
|
1864
|
+
// type A = { foo: string; }; export { A };
|
|
1865
|
+
'no-undef': 'off',
|
|
1866
|
+
'prefer-named-capture-group': 'off',
|
|
1867
|
+
'no-useless-constructor': 'off',
|
|
1868
|
+
'no-array-constructor': 'off',
|
|
1869
|
+
'func-call-spacing': 'off',
|
|
1870
|
+
// @BUG no ignore
|
|
1871
|
+
'no-magic-numbers': 'off',
|
|
1872
|
+
semi: 'off',
|
|
1873
|
+
'no-empty-function': 'off',
|
|
1874
|
+
'equire-await': 'off',
|
|
1875
|
+
'require-await': 'off',
|
|
1876
|
+
'one-var': ['error', 'never'],
|
|
1877
|
+
// 'jsdoc/no-types': 'error',
|
|
1878
|
+
'react/require-default-props': 'off',
|
|
1879
|
+
// 'jsdoc/check-tag-names': 'off',
|
|
1880
|
+
// https://github.com/microsoft/tsdoc/tree/master/eslint-plugin
|
|
1881
|
+
// 'tsdoc/syntax': 'warn',
|
|
1882
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-non-null-asserted-optional-chain.md
|
|
1883
|
+
'@typescript-eslint/no-non-null-asserted-optional-chain': 'error',
|
|
1884
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/adjacent-overload-signatures.md
|
|
1885
|
+
'@typescript-eslint/adjacent-overload-signatures': 'error',
|
|
1886
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/array-type.md
|
|
1887
|
+
'@typescript-eslint/array-type': 'off',
|
|
1888
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/await-thenable.md
|
|
1889
|
+
'@typescript-eslint/await-thenable': 'error',
|
|
1890
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/ban-ts-comment.md
|
|
1891
|
+
'@typescript-eslint/ban-ts-comment': [
|
|
1892
|
+
'error',
|
|
1893
|
+
{
|
|
1894
|
+
'ts-expect-error': true,
|
|
1895
|
+
'ts-ignore': true,
|
|
1896
|
+
'ts-nocheck': true,
|
|
1897
|
+
'ts-check': false,
|
|
1898
|
+
},
|
|
1899
|
+
],
|
|
1900
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/ban-types.md
|
|
1901
|
+
'@typescript-eslint/ban-types': 'error',
|
|
1902
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/ban-ts-comment.md
|
|
1903
|
+
'@typescript-eslint/ban-tslint-comment': 'error',
|
|
1904
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/class-literal-property-style.md
|
|
1905
|
+
'@typescript-eslint/class-literal-property-style': ['error', 'fields'],
|
|
1906
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/consistent-indexed-object-style.md
|
|
1907
|
+
'@typescript-eslint/consistent-indexed-object-style': 'off',
|
|
1908
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/consistent-type-assertions.md
|
|
1909
|
+
'@typescript-eslint/consistent-type-assertions': 'error',
|
|
1910
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/consistent-type-definitions.md
|
|
1911
|
+
'@typescript-eslint/consistent-type-definitions': 'off',
|
|
1912
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/consistent-type-imports.md
|
|
1913
|
+
'@typescript-eslint/consistent-type-imports': 'off',
|
|
1914
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/explicit-function-return-type.md
|
|
1915
|
+
'@typescript-eslint/explicit-function-return-type': 'off',
|
|
1916
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/explicit-member-accessibility.md
|
|
1917
|
+
'@typescript-eslint/explicit-member-accessibility': 'off',
|
|
1918
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/explicit-module-boundary-types.md
|
|
1919
|
+
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
|
1920
|
+
'@typescript-eslint/indent': [
|
|
1921
|
+
'error',
|
|
1922
|
+
2,
|
|
1923
|
+
{
|
|
1924
|
+
SwitchCase: 1,
|
|
1925
|
+
VariableDeclarator: 'first',
|
|
1926
|
+
outerIIFEBody: 0,
|
|
1927
|
+
MemberExpression: 1,
|
|
1928
|
+
FunctionDeclaration: { parameters: 'first' },
|
|
1929
|
+
FunctionExpression: { parameters: 'first' },
|
|
1930
|
+
CallExpression: { arguments: 'first' },
|
|
1931
|
+
ArrayExpression: 1,
|
|
1932
|
+
ObjectExpression: 1,
|
|
1933
|
+
ImportDeclaration: 1,
|
|
1934
|
+
flatTernaryExpressions: false,
|
|
1935
|
+
},
|
|
1936
|
+
],
|
|
1937
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/member-delimiter-style.md
|
|
1938
|
+
'@typescript-eslint/member-delimiter-style': [
|
|
1939
|
+
'error',
|
|
1940
|
+
{
|
|
1941
|
+
multiline: {
|
|
1942
|
+
delimiter: 'semi',
|
|
1943
|
+
requireLast: true,
|
|
1944
|
+
},
|
|
1945
|
+
singleline: {
|
|
1946
|
+
delimiter: 'semi',
|
|
1947
|
+
requireLast: true,
|
|
1948
|
+
},
|
|
1949
|
+
},
|
|
1950
|
+
],
|
|
1951
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/member-ordering.md
|
|
1952
|
+
'@typescript-eslint/member-ordering': [
|
|
1953
|
+
'error',
|
|
1954
|
+
{
|
|
1955
|
+
default: [
|
|
1956
|
+
'public-static-field',
|
|
1957
|
+
'protected-static-field',
|
|
1958
|
+
'private-static-field',
|
|
1959
|
+
'static-field',
|
|
1960
|
+
'public-static-method',
|
|
1961
|
+
'protected-static-method',
|
|
1962
|
+
'private-static-method',
|
|
1963
|
+
'static-method',
|
|
1964
|
+
'public-instance-field',
|
|
1965
|
+
'protected-instance-field',
|
|
1966
|
+
'private-instance-field',
|
|
1967
|
+
'instance-field',
|
|
1968
|
+
'public-field',
|
|
1969
|
+
'protected-field',
|
|
1970
|
+
'private-field',
|
|
1971
|
+
'field',
|
|
1972
|
+
'constructor',
|
|
1973
|
+
// 'public-instance-method',
|
|
1974
|
+
// 'protected-instance-method',
|
|
1975
|
+
// 'private-instance-method',
|
|
1976
|
+
'instance-method',
|
|
1977
|
+
// 'public-method',
|
|
1978
|
+
// 'protected-method',
|
|
1979
|
+
// 'private-method',
|
|
1980
|
+
'method',
|
|
1981
|
+
],
|
|
1982
|
+
},
|
|
1983
|
+
],
|
|
1984
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/method-signature-style.md
|
|
1985
|
+
'@typescript-eslint/method-signature-style': 'error',
|
|
1986
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/naming-convention.md
|
|
1987
|
+
'@typescript-eslint/naming-convention': [
|
|
1988
|
+
'error',
|
|
1989
|
+
{
|
|
1990
|
+
selector: 'default',
|
|
1991
|
+
format: ['camelCase', 'PascalCase', 'UPPER_CASE', 'snake_case'],
|
|
1992
|
+
leadingUnderscore: 'allowSingleOrDouble',
|
|
1993
|
+
trailingUnderscore: 'allowSingleOrDouble',
|
|
1994
|
+
},
|
|
1995
|
+
|
|
1996
|
+
{
|
|
1997
|
+
selector: 'variable',
|
|
1998
|
+
format: ['camelCase', 'PascalCase', 'UPPER_CASE', 'snake_case'],
|
|
1999
|
+
leadingUnderscore: 'allowSingleOrDouble',
|
|
2000
|
+
trailingUnderscore: 'allowSingleOrDouble',
|
|
2001
|
+
},
|
|
2002
|
+
|
|
2003
|
+
{
|
|
2004
|
+
selector: 'typeLike',
|
|
2005
|
+
format: ['PascalCase'],
|
|
2006
|
+
},
|
|
2007
|
+
],
|
|
2008
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-array-constructor.md
|
|
2009
|
+
'@typescript-eslint/no-array-constructor': 'error',
|
|
2010
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-empty-interface.md
|
|
2011
|
+
'@typescript-eslint/no-empty-interface': 'error',
|
|
2012
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-explicit-any.md
|
|
2013
|
+
// @TODO disable?
|
|
2014
|
+
'@typescript-eslint/no-explicit-any': 'off',
|
|
2015
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-extraneous-class.md
|
|
2016
|
+
'@typescript-eslint/no-extraneous-class': 'error',
|
|
2017
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-for-in-array.md
|
|
2018
|
+
'@typescript-eslint/no-for-in-array': 'error',
|
|
2019
|
+
// https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/eslint-plugin#supported-rules
|
|
2020
|
+
'@typescript-eslint/no-implicit-any-catch': 'off',
|
|
2021
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-invalid-void-type.md
|
|
2022
|
+
'@typescript-eslint/no-invalid-void-type': 'error',
|
|
2023
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-inferrable-types.md
|
|
2024
|
+
'@typescript-eslint/no-inferrable-types': [
|
|
2025
|
+
'error',
|
|
2026
|
+
{ ignoreProperties: true },
|
|
2027
|
+
],
|
|
2028
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-misused-new.md
|
|
2029
|
+
'@typescript-eslint/no-misused-new': 'error',
|
|
2030
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-namespace.md
|
|
2031
|
+
'@typescript-eslint/no-namespace': 'error',
|
|
2032
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-base-to-string.md
|
|
2033
|
+
'@typescript-eslint/no-base-to-string': 'error',
|
|
2034
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-confusing-non-null-assertion.md
|
|
2035
|
+
'@typescript-eslint/no-confusing-non-null-assertion': 'error',
|
|
2036
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-confusing-void-expression.md
|
|
2037
|
+
'@typescript-eslint/no-confusing-void-expression': 'off',
|
|
2038
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-non-null-assertion.md
|
|
2039
|
+
// @feedback 在 middleware 下,如果有些参数是 optional 的,会在上一层被拦截掉,下一层一定会有这个参数
|
|
2040
|
+
'@typescript-eslint/no-non-null-assertion': 'off',
|
|
2041
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-extra-non-null-assertion.md
|
|
2042
|
+
'@typescript-eslint/no-extra-non-null-assertion': 'error',
|
|
2043
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-parameter-properties.md
|
|
2044
|
+
'@typescript-eslint/no-parameter-properties': 'error',
|
|
2045
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-require-imports.md
|
|
2046
|
+
'@typescript-eslint/no-require-imports': 'error',
|
|
2047
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-this-alias.md
|
|
2048
|
+
'@typescript-eslint/no-this-alias': [
|
|
2049
|
+
'error',
|
|
2050
|
+
{ allowDestructuring: true },
|
|
2051
|
+
],
|
|
2052
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-type-alias.md
|
|
2053
|
+
'@typescript-eslint/no-type-alias': 'off',
|
|
2054
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unnecessary-boolean-literal-compare.md
|
|
2055
|
+
'@typescript-eslint/no-unnecessary-boolean-literal-compare': 'error',
|
|
2056
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unnecessary-condition.md
|
|
2057
|
+
'@typescript-eslint/no-unnecessary-condition': 'off',
|
|
2058
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unnecessary-qualifier.md
|
|
2059
|
+
'@typescript-eslint/no-unnecessary-qualifier': 'error',
|
|
2060
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unnecessary-type-assertion.md
|
|
2061
|
+
'@typescript-eslint/no-unnecessary-type-assertion': 'error',
|
|
2062
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unnecessary-type-constraint.md
|
|
2063
|
+
'@typescript-eslint/no-unnecessary-type-constraint': 'error',
|
|
2064
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unnecessary-type-constraint.md
|
|
2065
|
+
'@typescript-eslint/no-unsafe-assignment': 'off',
|
|
2066
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unsafe-call.md
|
|
2067
|
+
'@typescript-eslint/no-unsafe-call': 'off',
|
|
2068
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unsafe-member-access.md
|
|
2069
|
+
'@typescript-eslint/no-unsafe-member-access': 'off',
|
|
2070
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unsafe-return.md
|
|
2071
|
+
'@typescript-eslint/no-unsafe-return': 'off',
|
|
2072
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unused-vars.md
|
|
2073
|
+
'@typescript-eslint/no-unused-vars': [
|
|
2074
|
+
'error',
|
|
2075
|
+
{
|
|
2076
|
+
vars: 'all',
|
|
2077
|
+
args: 'after-used',
|
|
2078
|
+
ignoreRestSiblings: true,
|
|
2079
|
+
argsIgnorePattern: '^_',
|
|
2080
|
+
caughtErrors: 'none',
|
|
2081
|
+
},
|
|
2082
|
+
],
|
|
2083
|
+
'@babel/no-unused-expressions': 'off',
|
|
2084
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unused-expressions.md
|
|
2085
|
+
'@typescript-eslint/no-unused-expressions': [
|
|
2086
|
+
'error',
|
|
2087
|
+
{
|
|
2088
|
+
allowShortCircuit: true,
|
|
2089
|
+
allowTernary: false,
|
|
2090
|
+
allowTaggedTemplates: true,
|
|
2091
|
+
},
|
|
2092
|
+
],
|
|
2093
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-use-before-define.md
|
|
2094
|
+
'@typescript-eslint/no-use-before-define': [
|
|
2095
|
+
'error',
|
|
2096
|
+
{
|
|
2097
|
+
functions: false,
|
|
2098
|
+
classes: false,
|
|
2099
|
+
variables: false,
|
|
2100
|
+
},
|
|
2101
|
+
],
|
|
2102
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-useless-constructor.md
|
|
2103
|
+
'@typescript-eslint/no-useless-constructor': 'error',
|
|
2104
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-var-requires.md
|
|
2105
|
+
'@typescript-eslint/no-var-requires': 'error',
|
|
2106
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/prefer-as-const.md
|
|
2107
|
+
'@typescript-eslint/prefer-as-const': 'error',
|
|
2108
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/prefer-enum-initializers.md
|
|
2109
|
+
'@typescript-eslint/prefer-enum-initializers': 'off',
|
|
2110
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/prefer-for-of.md
|
|
2111
|
+
'@typescript-eslint/prefer-for-of': 'error',
|
|
2112
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/prefer-function-type.md
|
|
2113
|
+
'@typescript-eslint/prefer-function-type': 'error',
|
|
2114
|
+
// https://github.com/typescript-eslint/typescript-eslint/pull/294
|
|
2115
|
+
'@typescript-eslint/prefer-includes': 'error',
|
|
2116
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/prefer-namespace-keyword.md
|
|
2117
|
+
'@typescript-eslint/prefer-namespace-keyword': 'off',
|
|
2118
|
+
// https://github.com/typescript-eslint/typescript-eslint/pull/289
|
|
2119
|
+
'@typescript-eslint/prefer-string-starts-ends-with': 'error',
|
|
2120
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/prefer-literal-enum-member.md
|
|
2121
|
+
'@typescript-eslint/prefer-literal-enum-member': 'error',
|
|
2122
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/prefer-optional-chain.md
|
|
2123
|
+
'@typescript-eslint/prefer-optional-chain': 'error',
|
|
2124
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/prefer-nullish-coalescing.md
|
|
2125
|
+
'@typescript-eslint/prefer-nullish-coalescing': 'off',
|
|
2126
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/prefer-readonly-parameter-types.md
|
|
2127
|
+
'@typescript-eslint/prefer-readonly-parameter-types': 'off',
|
|
2128
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/prefer-reduce-type-parameter.md
|
|
2129
|
+
'@typescript-eslint/prefer-reduce-type-parameter': 'off',
|
|
2130
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/prefer-ts-expect-error.md
|
|
2131
|
+
'@typescript-eslint/prefer-ts-expect-error': 'error',
|
|
2132
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/promise-function-async.md
|
|
2133
|
+
// @BUG
|
|
2134
|
+
'@typescript-eslint/promise-function-async': 'off',
|
|
2135
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/require-array-sort-compare.md
|
|
2136
|
+
'@typescript-eslint/require-array-sort-compare': 'off',
|
|
2137
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/restrict-plus-operands.md
|
|
2138
|
+
'@typescript-eslint/restrict-plus-operands': 'off',
|
|
2139
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/restrict-template-expressions.md
|
|
2140
|
+
'@typescript-eslint/restrict-template-expressions': [
|
|
2141
|
+
'error',
|
|
2142
|
+
{ allowNumber: true, allowAny: true },
|
|
2143
|
+
],
|
|
2144
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/switch-exhaustiveness-check.md
|
|
2145
|
+
'@typescript-eslint/switch-exhaustiveness-check': 'error',
|
|
2146
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/triple-slash-reference.md
|
|
2147
|
+
'@typescript-eslint/triple-slash-reference': 'off',
|
|
2148
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/type-annotation-spacing.md
|
|
2149
|
+
'@typescript-eslint/type-annotation-spacing': [
|
|
2150
|
+
'error',
|
|
2151
|
+
{
|
|
2152
|
+
before: false,
|
|
2153
|
+
after: true,
|
|
2154
|
+
},
|
|
2155
|
+
],
|
|
2156
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/unbound-method.md
|
|
2157
|
+
'@typescript-eslint/unbound-method': 'off',
|
|
2158
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/unified-signatures.md
|
|
2159
|
+
'@typescript-eslint/unified-signatures': 'error',
|
|
2160
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/func-call-spacing.md
|
|
2161
|
+
'@typescript-eslint/func-call-spacing': 'off',
|
|
2162
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-magic-numbers.md
|
|
2163
|
+
'@typescript-eslint/no-magic-numbers': 'off',
|
|
2164
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/semi.md
|
|
2165
|
+
'@typescript-eslint/semi': ['error', 'always'],
|
|
2166
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/prefer-regexp-exec.md
|
|
2167
|
+
'@typescript-eslint/prefer-regexp-exec': 'error',
|
|
2168
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-empty-function.md
|
|
2169
|
+
'@typescript-eslint/no-empty-function': ['error', { allow: [] }],
|
|
2170
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-floating-promises.md
|
|
2171
|
+
'@typescript-eslint/no-floating-promises': 'off',
|
|
2172
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/strict-boolean-expressions.md
|
|
2173
|
+
'@typescript-eslint/strict-boolean-expressions': 'off',
|
|
2174
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/prefer-readonly.md
|
|
2175
|
+
'@typescript-eslint/prefer-readonly': 'error',
|
|
2176
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-misused-promises.md
|
|
2177
|
+
'@typescript-eslint/no-misused-promises': [
|
|
2178
|
+
'error',
|
|
2179
|
+
{ checksVoidReturn: false },
|
|
2180
|
+
],
|
|
2181
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/require-await.md
|
|
2182
|
+
'@typescript-eslint/require-await': 'error',
|
|
2183
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/55eb0cfac20ccbc2e954083dd554dbcfcbed64fb/packages/eslint-plugin/docs/rules/return-await.md
|
|
2184
|
+
'no-return-await': 'off',
|
|
2185
|
+
'@typescript-eslint/return-await': 'error',
|
|
2186
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/typedef.md
|
|
2187
|
+
'@typescript-eslint/typedef': [
|
|
2188
|
+
'error',
|
|
2189
|
+
{
|
|
2190
|
+
arrayDestructuring: false,
|
|
2191
|
+
arrowParameter: false,
|
|
2192
|
+
memberVariableDeclaration: true,
|
|
2193
|
+
objectDestructuring: false,
|
|
2194
|
+
parameter: false,
|
|
2195
|
+
propertyDeclaration: true,
|
|
2196
|
+
variableDeclaration: false,
|
|
2197
|
+
variableDeclarationIgnoreFunction: true,
|
|
2198
|
+
},
|
|
2199
|
+
],
|
|
2200
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin//docs/rules/no-unnecessary-type-arguments.md
|
|
2201
|
+
'@typescript-eslint/no-unnecessary-type-arguments': 'error',
|
|
2202
|
+
'brace-style': 'off',
|
|
2203
|
+
'@typescript-eslint/brace-style': [
|
|
2204
|
+
'error',
|
|
2205
|
+
'1tbs',
|
|
2206
|
+
{ allowSingleLine: true },
|
|
2207
|
+
],
|
|
2208
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/comma-dangle.md
|
|
2209
|
+
'comma-dangle': 'off',
|
|
2210
|
+
'@typescript-eslint/comma-dangle': 'off',
|
|
2211
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/comma-spacing.md
|
|
2212
|
+
'comma-spacing': 'off',
|
|
2213
|
+
'@typescript-eslint/comma-spacing': [
|
|
2214
|
+
'error',
|
|
2215
|
+
{
|
|
2216
|
+
before: false,
|
|
2217
|
+
after: true,
|
|
2218
|
+
},
|
|
2219
|
+
],
|
|
2220
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/dot-notation.md
|
|
2221
|
+
'dot-notation': 'off',
|
|
2222
|
+
'@typescript-eslint/dot-notation': ['error', { allowKeywords: true }],
|
|
2223
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/keyword-spacing.md
|
|
2224
|
+
'keyword-spacing': 'off',
|
|
2225
|
+
'@typescript-eslint/keyword-spacing': [
|
|
2226
|
+
'error',
|
|
2227
|
+
{
|
|
2228
|
+
before: true,
|
|
2229
|
+
after: true,
|
|
2230
|
+
},
|
|
2231
|
+
],
|
|
2232
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/lines-between-class-members.md
|
|
2233
|
+
'lines-between-class-members': 'off',
|
|
2234
|
+
'@typescript-eslint/lines-between-class-members': ['error', 'always'],
|
|
2235
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-dupe-class-members.md
|
|
2236
|
+
'no-dupe-class-members': 'off',
|
|
2237
|
+
'@typescript-eslint/no-dupe-class-members': 'error',
|
|
2238
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-extra-parens.md
|
|
2239
|
+
'no-extra-parens': 'off',
|
|
2240
|
+
'@typescript-eslint/no-extra-parens': [
|
|
2241
|
+
'error',
|
|
2242
|
+
'all',
|
|
2243
|
+
{ ignoreJSX: 'multi-line' },
|
|
2244
|
+
],
|
|
2245
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-extra-semi.md
|
|
2246
|
+
'no-extra-semi': 'off',
|
|
2247
|
+
'@typescript-eslint/no-extra-semi': 'error',
|
|
2248
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-implied-eval.md
|
|
2249
|
+
'no-implied-eval': 'off',
|
|
2250
|
+
'@typescript-eslint/no-implied-eval': 'error',
|
|
2251
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-loop-func.md
|
|
2252
|
+
'no-loop-func': 'off',
|
|
2253
|
+
'@typescript-eslint/no-loop-func': 'error',
|
|
2254
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-redeclare.md
|
|
2255
|
+
'no-redeclare': 'off',
|
|
2256
|
+
'@typescript-eslint/no-redeclare': ['error', { builtinGlobals: true }],
|
|
2257
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-shadow.md
|
|
2258
|
+
'no-shadow': 'off',
|
|
2259
|
+
'@typescript-eslint/no-shadow': [
|
|
2260
|
+
'error',
|
|
2261
|
+
{
|
|
2262
|
+
builtinGlobals: false,
|
|
2263
|
+
allow: [],
|
|
2264
|
+
},
|
|
2265
|
+
],
|
|
2266
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-throw-literal.md
|
|
2267
|
+
'no-throw-literal': 'off',
|
|
2268
|
+
'@typescript-eslint/no-throw-literal': 'error',
|
|
2269
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/space-before-function-paren.md
|
|
2270
|
+
'space-before-function-paren': 'off',
|
|
2271
|
+
'@typescript-eslint/space-before-function-paren': [
|
|
2272
|
+
'error',
|
|
2273
|
+
{
|
|
2274
|
+
anonymous: 'always',
|
|
2275
|
+
named: 'never',
|
|
2276
|
+
asyncArrow: 'always',
|
|
2277
|
+
},
|
|
2278
|
+
],
|
|
2279
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/space-infix-ops.md
|
|
2280
|
+
'space-infix-ops': 'off',
|
|
2281
|
+
'@typescript-eslint/space-infix-ops': 'error',
|
|
2282
|
+
},
|
|
2283
|
+
},
|
|
2284
|
+
{
|
|
2285
|
+
files: ['*.test.*', '*.spec.*', '**/__test__/**'],
|
|
2286
|
+
env: {
|
|
2287
|
+
mocha: true,
|
|
2288
|
+
jest: true,
|
|
2289
|
+
},
|
|
2290
|
+
rules: {
|
|
2291
|
+
'no-unused-expressions': 'off',
|
|
2292
|
+
'@babel/no-unused-expressions': 'off',
|
|
2293
|
+
},
|
|
2294
|
+
},
|
|
2295
|
+
{
|
|
2296
|
+
files: ['*.worker.*'],
|
|
2297
|
+
env: { worker: true },
|
|
2298
|
+
},
|
|
2299
|
+
{
|
|
2300
|
+
files: ['**/pages/**/_*', '**/pages/**/index.*', '**/pages/**/\\[**'],
|
|
2301
|
+
rules: {
|
|
2302
|
+
'filenames/match-regex': 'off',
|
|
2303
|
+
'filenames/match-exported': 'off',
|
|
2304
|
+
},
|
|
2305
|
+
},
|
|
2306
|
+
{
|
|
2307
|
+
files: ['*.stories.[tj]sx', '*.stories.[tj]s'],
|
|
2308
|
+
rules: { 'import/no-anonymous-default-export': 'off' },
|
|
2309
|
+
},
|
|
2310
|
+
{
|
|
2311
|
+
files: ['**/*.md'],
|
|
2312
|
+
processor: 'markdown/markdown',
|
|
2313
|
+
},
|
|
2314
|
+
],
|
|
2315
|
+
};
|
|
2316
|
+
/* eslint-enable max-lines, no-magic-numbers */
|