@ofk/eslint-config 0.0.2 → 0.0.3
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/dist/index.js +748 -776
- package/dist/index.mjs +748 -776
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,132 +1,138 @@
|
|
|
1
1
|
// src/base.ts
|
|
2
|
-
import
|
|
2
|
+
import pluginTs6 from "typescript-eslint";
|
|
3
3
|
|
|
4
4
|
// src/configs/eslint-comments.ts
|
|
5
5
|
import pluginEslintComments from "@eslint-community/eslint-plugin-eslint-comments/configs";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
|
|
7
|
+
// src/utils.ts
|
|
8
|
+
function mergeRules(config, ...rulesSet) {
|
|
9
|
+
return {
|
|
10
|
+
...config,
|
|
11
|
+
rules: rulesSet.reduce((acc, rules) => ({ ...acc, ...rules }), config.rules)
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
function mergeRuleOptions(rule, options) {
|
|
15
|
+
if (Array.isArray(rule)) {
|
|
16
|
+
return [rule[0], { ...rule[1], ...options }];
|
|
17
|
+
}
|
|
18
|
+
if (rule === "error" || rule === "warn") {
|
|
19
|
+
return [rule, options];
|
|
10
20
|
}
|
|
21
|
+
return rule;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// src/configs/eslint-comments.ts
|
|
25
|
+
var eslintCommentsStrict = mergeRules(pluginEslintComments.recommended, {
|
|
26
|
+
"@eslint-community/eslint-comments/disable-enable-pair": ["error", { allowWholeFile: true }]
|
|
11
27
|
});
|
|
12
28
|
|
|
13
29
|
// src/configs/imports.ts
|
|
14
30
|
import pluginImport from "eslint-plugin-import";
|
|
15
|
-
import
|
|
16
|
-
var importsStrict =
|
|
31
|
+
import pluginTs from "typescript-eslint";
|
|
32
|
+
var importsStrict = mergeRules(
|
|
17
33
|
pluginImport.flatConfigs.recommended,
|
|
18
34
|
// https://github.com/import-js/eslint-plugin-import?tab=readme-ov-file#helpful-warnings
|
|
19
35
|
{
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
"
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
"import/no-unused-modules": "error"
|
|
46
|
-
}
|
|
36
|
+
"import/no-deprecated": "off",
|
|
37
|
+
// discarded
|
|
38
|
+
"import/no-empty-named-blocks": "error",
|
|
39
|
+
// cf. https://github.com/airbnb/javascript/blob/eslint-config-airbnb-v19.0.4/packages/eslint-config-airbnb-base/rules/imports.js#L71
|
|
40
|
+
"import/no-extraneous-dependencies": [
|
|
41
|
+
"error",
|
|
42
|
+
{
|
|
43
|
+
devDependencies: [
|
|
44
|
+
"test/**",
|
|
45
|
+
"tests/**",
|
|
46
|
+
"spec/**",
|
|
47
|
+
"**/__tests__/**",
|
|
48
|
+
"**/__mocks__/**",
|
|
49
|
+
"**/*{.,_}{test,spec}.*",
|
|
50
|
+
"test.*",
|
|
51
|
+
"test-*.*",
|
|
52
|
+
"*.{config,setup,conf}.{js,ts,mjs,mts,cjs,cts}",
|
|
53
|
+
"*.{config,setup,conf}.*.{js,ts,mjs,mts,cjs,cts}",
|
|
54
|
+
".*rc.{js,ts,mjs,mts,cjs,cts}"
|
|
55
|
+
],
|
|
56
|
+
optionalDependencies: false
|
|
57
|
+
}
|
|
58
|
+
],
|
|
59
|
+
"import/no-mutable-exports": "error",
|
|
60
|
+
"import/no-unused-modules": "error"
|
|
47
61
|
},
|
|
48
62
|
// https://github.com/import-js/eslint-plugin-import?tab=readme-ov-file#module-systems
|
|
49
63
|
{
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
"import/unambiguous": "off"
|
|
57
|
-
}
|
|
64
|
+
"import/no-amd": "error",
|
|
65
|
+
"import/no-commonjs": "off",
|
|
66
|
+
// disabled for use in esm
|
|
67
|
+
"import/no-import-module-exports": "error",
|
|
68
|
+
"import/no-nodejs-modules": "error",
|
|
69
|
+
"import/unambiguous": "off"
|
|
58
70
|
},
|
|
59
71
|
// https://github.com/import-js/eslint-plugin-import?tab=readme-ov-file#static-analysis
|
|
60
72
|
{
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
"import/no-webpack-loader-syntax": "error"
|
|
77
|
-
}
|
|
73
|
+
"import/enforce-node-protocol-usage": "off",
|
|
74
|
+
// for node.js
|
|
75
|
+
"import/no-absolute-path": "error",
|
|
76
|
+
"import/no-cycle": "error",
|
|
77
|
+
"import/no-dynamic-require": "error",
|
|
78
|
+
"import/no-internal-modules": "off",
|
|
79
|
+
// discarded
|
|
80
|
+
"import/no-relative-packages": "error",
|
|
81
|
+
"import/no-relative-parent-imports": "off",
|
|
82
|
+
// discarded
|
|
83
|
+
"import/no-restricted-paths": "off",
|
|
84
|
+
// discarded
|
|
85
|
+
"import/no-self-import": "error",
|
|
86
|
+
"import/no-useless-path-segments": "error",
|
|
87
|
+
"import/no-webpack-loader-syntax": "error"
|
|
78
88
|
},
|
|
79
89
|
// https://github.com/import-js/eslint-plugin-import?tab=readme-ov-file#style-guide
|
|
80
90
|
{
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
"
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
"
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
"no-duplicate-imports": "off"
|
|
120
|
-
}
|
|
91
|
+
"import/consistent-type-specifier-style": ["error", "prefer-top-level"],
|
|
92
|
+
"import/dynamic-import-chunkname": "off",
|
|
93
|
+
// don't use webpack
|
|
94
|
+
"import/exports-last": "error",
|
|
95
|
+
"import/extensions": [
|
|
96
|
+
"error",
|
|
97
|
+
"ignorePackages",
|
|
98
|
+
{ cjs: "never", js: "never", jsx: "never", mjs: "never" }
|
|
99
|
+
],
|
|
100
|
+
"import/first": "error",
|
|
101
|
+
"import/group-exports": "off",
|
|
102
|
+
// discarded
|
|
103
|
+
"import/max-dependencies": "off",
|
|
104
|
+
// disabled style rules
|
|
105
|
+
"import/newline-after-import": "error",
|
|
106
|
+
"import/no-anonymous-default-export": [
|
|
107
|
+
"error",
|
|
108
|
+
{
|
|
109
|
+
allowArray: true,
|
|
110
|
+
allowCallExpression: true,
|
|
111
|
+
allowLiteral: true,
|
|
112
|
+
allowNew: true,
|
|
113
|
+
allowObject: true
|
|
114
|
+
}
|
|
115
|
+
],
|
|
116
|
+
"import/no-default-export": "error",
|
|
117
|
+
// disallow default export
|
|
118
|
+
"import/no-duplicates": "error",
|
|
119
|
+
"import/no-named-default": "error",
|
|
120
|
+
"import/no-named-export": "off",
|
|
121
|
+
// disallow default export
|
|
122
|
+
"import/no-namespace": "error",
|
|
123
|
+
"import/no-unassigned-import": "off",
|
|
124
|
+
// allow to use side-effects module
|
|
125
|
+
"import/order": ["error", { groups: [["builtin", "external", "internal"]] }],
|
|
126
|
+
"import/prefer-default-export": "off",
|
|
127
|
+
// discarded
|
|
128
|
+
"no-duplicate-imports": "off"
|
|
121
129
|
},
|
|
122
130
|
// disable slow rules due to bugs
|
|
123
131
|
// https://github.com/import-js/eslint-plugin-import/issues/3148
|
|
124
132
|
{
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
"import/no-deprecated": "off"
|
|
129
|
-
}
|
|
133
|
+
"import/namespace": "off",
|
|
134
|
+
"import/no-cycle": "off",
|
|
135
|
+
"import/no-deprecated": "off"
|
|
130
136
|
}
|
|
131
137
|
);
|
|
132
138
|
function imports({
|
|
@@ -135,7 +141,7 @@ function imports({
|
|
|
135
141
|
typescript = false,
|
|
136
142
|
...config
|
|
137
143
|
}) {
|
|
138
|
-
return
|
|
144
|
+
return pluginTs.config(
|
|
139
145
|
importsStrict,
|
|
140
146
|
config,
|
|
141
147
|
// allow default export in config files
|
|
@@ -197,239 +203,231 @@ function imports({
|
|
|
197
203
|
import pluginJs from "@eslint/js";
|
|
198
204
|
import confusingBrowserGlobals from "confusing-browser-globals";
|
|
199
205
|
import globalVariables from "globals";
|
|
200
|
-
import
|
|
201
|
-
var jsStrict =
|
|
206
|
+
import pluginTs2 from "typescript-eslint";
|
|
207
|
+
var jsStrict = mergeRules(
|
|
202
208
|
pluginJs.configs.recommended,
|
|
203
209
|
{
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
"
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
// override recommended in possible-problems
|
|
225
|
-
}
|
|
210
|
+
"no-empty": "warn",
|
|
211
|
+
// override recommended in suggestions
|
|
212
|
+
"no-empty-static-block": "warn",
|
|
213
|
+
// override recommended in suggestions
|
|
214
|
+
"no-misleading-character-class": ["error", { allowEscape: true }],
|
|
215
|
+
// override recommended in possible-problems
|
|
216
|
+
"no-unsafe-optional-chaining": ["error", { disallowArithmeticOperators: true }],
|
|
217
|
+
// override recommended in possible-problems
|
|
218
|
+
"no-unused-vars": [
|
|
219
|
+
"warn",
|
|
220
|
+
{
|
|
221
|
+
argsIgnorePattern: "^_",
|
|
222
|
+
caughtErrorsIgnorePattern: "^_",
|
|
223
|
+
ignoreRestSiblings: true,
|
|
224
|
+
varsIgnorePattern: "^_"
|
|
225
|
+
}
|
|
226
|
+
],
|
|
227
|
+
// override recommended in possible-problems
|
|
228
|
+
"valid-typeof": ["error", { requireStringLiterals: true }]
|
|
229
|
+
// override recommended in possible-problems
|
|
226
230
|
},
|
|
227
231
|
// https://eslint.org/docs/latest/rules/#possible-problems
|
|
228
232
|
{
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
"require-atomic-updates": "error"
|
|
244
|
-
}
|
|
233
|
+
"array-callback-return": "error",
|
|
234
|
+
"no-await-in-loop": "error",
|
|
235
|
+
"no-cond-assign": "error",
|
|
236
|
+
"no-constructor-return": "error",
|
|
237
|
+
"no-duplicate-imports": "error",
|
|
238
|
+
"no-inner-declarations": "error",
|
|
239
|
+
"no-promise-executor-return": "error",
|
|
240
|
+
"no-self-compare": "error",
|
|
241
|
+
"no-template-curly-in-string": "error",
|
|
242
|
+
"no-unmodified-loop-condition": "error",
|
|
243
|
+
"no-unreachable-loop": "error",
|
|
244
|
+
"no-use-before-define": "error",
|
|
245
|
+
"no-useless-assignment": "error",
|
|
246
|
+
"require-atomic-updates": "error"
|
|
245
247
|
},
|
|
246
248
|
// https://eslint.org/docs/latest/rules/#suggestions
|
|
247
249
|
{
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
"
|
|
345
|
-
|
|
346
|
-
{
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
"
|
|
394
|
-
|
|
395
|
-
{
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
yoda: "error"
|
|
426
|
-
}
|
|
250
|
+
"accessor-pairs": "error",
|
|
251
|
+
"arrow-body-style": "error",
|
|
252
|
+
"block-scoped-var": "error",
|
|
253
|
+
camelcase: ["error", { ignoreDestructuring: false, properties: "never" }],
|
|
254
|
+
"capitalized-comments": "off",
|
|
255
|
+
// disabled style rules
|
|
256
|
+
"class-methods-use-this": "error",
|
|
257
|
+
complexity: "off",
|
|
258
|
+
// disabled metrics rules
|
|
259
|
+
"consistent-return": "error",
|
|
260
|
+
"consistent-this": "error",
|
|
261
|
+
curly: ["error", "multi-line"],
|
|
262
|
+
"default-case": ["error", { commentPattern: "^no default$" }],
|
|
263
|
+
"default-case-last": "error",
|
|
264
|
+
"default-param-last": "error",
|
|
265
|
+
"dot-notation": "error",
|
|
266
|
+
eqeqeq: ["error", "always", { null: "ignore" }],
|
|
267
|
+
"func-name-matching": "error",
|
|
268
|
+
"func-names": ["error", "as-needed"],
|
|
269
|
+
"func-style": ["error", "declaration", { allowArrowFunctions: true }],
|
|
270
|
+
"grouped-accessor-pairs": ["error", "getBeforeSet"],
|
|
271
|
+
"guard-for-in": "error",
|
|
272
|
+
"id-denylist": "off",
|
|
273
|
+
// disabled style rules
|
|
274
|
+
"id-length": "off",
|
|
275
|
+
// disabled style rules
|
|
276
|
+
"id-match": "off",
|
|
277
|
+
// disabled style rules
|
|
278
|
+
"init-declarations": "error",
|
|
279
|
+
"logical-assignment-operators": ["error", "always", { enforceForIfStatements: true }],
|
|
280
|
+
"max-classes-per-file": "error",
|
|
281
|
+
"max-depth": "off",
|
|
282
|
+
// disabled style rules
|
|
283
|
+
"max-lines": "off",
|
|
284
|
+
// disabled style rules
|
|
285
|
+
"max-lines-per-function": "off",
|
|
286
|
+
// disabled style rules
|
|
287
|
+
"max-nested-callbacks": "off",
|
|
288
|
+
// disabled style rules
|
|
289
|
+
"max-params": "off",
|
|
290
|
+
// disabled style rules
|
|
291
|
+
"max-statements": "off",
|
|
292
|
+
// disabled style rules
|
|
293
|
+
"new-cap": "error",
|
|
294
|
+
"no-alert": "error",
|
|
295
|
+
"no-array-constructor": "error",
|
|
296
|
+
"no-bitwise": "error",
|
|
297
|
+
"no-caller": "error",
|
|
298
|
+
"no-console": ["warn", { allow: ["warn", "error", "assert"] }],
|
|
299
|
+
"no-continue": "error",
|
|
300
|
+
"no-div-regex": "error",
|
|
301
|
+
"no-else-return": ["error", { allowElseIf: false }],
|
|
302
|
+
"no-empty-function": "warn",
|
|
303
|
+
"no-eq-null": "off",
|
|
304
|
+
// allow null equals
|
|
305
|
+
"no-eval": "error",
|
|
306
|
+
"no-extend-native": "error",
|
|
307
|
+
"no-extra-bind": "error",
|
|
308
|
+
"no-extra-label": "error",
|
|
309
|
+
"no-implicit-coercion": ["error", { allow: ["!!"] }],
|
|
310
|
+
"no-implicit-globals": "off",
|
|
311
|
+
// disabled for use in esm
|
|
312
|
+
"no-implied-eval": "error",
|
|
313
|
+
"no-inline-comments": "off",
|
|
314
|
+
// allow inline comments
|
|
315
|
+
"no-invalid-this": "error",
|
|
316
|
+
"no-iterator": "error",
|
|
317
|
+
"no-label-var": "error",
|
|
318
|
+
"no-labels": "error",
|
|
319
|
+
"no-lone-blocks": "error",
|
|
320
|
+
"no-lonely-if": "error",
|
|
321
|
+
"no-loop-func": "error",
|
|
322
|
+
"no-magic-numbers": "off",
|
|
323
|
+
// allow magic numbers
|
|
324
|
+
"no-multi-assign": "error",
|
|
325
|
+
"no-multi-str": "error",
|
|
326
|
+
"no-negated-condition": "error",
|
|
327
|
+
"no-nested-ternary": "error",
|
|
328
|
+
"no-new": "error",
|
|
329
|
+
"no-new-func": "error",
|
|
330
|
+
"no-new-wrappers": "error",
|
|
331
|
+
"no-object-constructor": "error",
|
|
332
|
+
"no-octal-escape": "error",
|
|
333
|
+
"no-param-reassign": "error",
|
|
334
|
+
"no-plusplus": ["error", { allowForLoopAfterthoughts: true }],
|
|
335
|
+
"no-proto": "error",
|
|
336
|
+
// see https://github.com/airbnb/javascript/blob/eslint-config-airbnb-v19.0.4/packages/eslint-config-airbnb-base/rules/es6.js#L65
|
|
337
|
+
"no-restricted-exports": ["error", { restrictedNamedExports: ["default", "then"] }],
|
|
338
|
+
// see https://github.com/airbnb/javascript/blob/eslint-config-airbnb-v19.0.4/packages/eslint-config-airbnb-base/rules/variables.js#L19
|
|
339
|
+
"no-restricted-globals": ["error", ...confusingBrowserGlobals],
|
|
340
|
+
"no-restricted-imports": "off",
|
|
341
|
+
// allow all imports
|
|
342
|
+
"no-restricted-properties": "off",
|
|
343
|
+
// allow all properties
|
|
344
|
+
// see https://github.com/airbnb/javascript/blob/eslint-config-airbnb-v19.0.4/packages/eslint-config-airbnb-base/rules/style.js#L333
|
|
345
|
+
"no-restricted-syntax": [
|
|
346
|
+
"error",
|
|
347
|
+
{
|
|
348
|
+
message: "for..in loops iterate over the entire prototype chain, which is virtually never what you want. Use Object.{keys,values,entries}, and iterate over the resulting array.",
|
|
349
|
+
selector: "ForInStatement"
|
|
350
|
+
},
|
|
351
|
+
{
|
|
352
|
+
message: "iterators/generators require regenerator-runtime, which is too heavyweight for this guide to allow them. Separately, loops should be avoided in favor of array iterations.",
|
|
353
|
+
selector: "ForOfStatement"
|
|
354
|
+
},
|
|
355
|
+
{
|
|
356
|
+
message: "Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand.",
|
|
357
|
+
selector: "LabeledStatement"
|
|
358
|
+
},
|
|
359
|
+
{
|
|
360
|
+
message: "`with` is disallowed in strict mode because it makes code impossible to predict and optimize.",
|
|
361
|
+
selector: "WithStatement"
|
|
362
|
+
}
|
|
363
|
+
],
|
|
364
|
+
"no-return-assign": ["error", "always"],
|
|
365
|
+
"no-script-url": "error",
|
|
366
|
+
"no-sequences": "error",
|
|
367
|
+
"no-shadow": "error",
|
|
368
|
+
"no-ternary": "off",
|
|
369
|
+
// allow ternary operators
|
|
370
|
+
"no-throw-literal": "error",
|
|
371
|
+
"no-undef-init": "error",
|
|
372
|
+
"no-undefined": "off",
|
|
373
|
+
// allow undefined as a value
|
|
374
|
+
"no-underscore-dangle": "off",
|
|
375
|
+
// allow variable names containing underscores
|
|
376
|
+
"no-unneeded-ternary": ["error", { defaultAssignment: false }],
|
|
377
|
+
"no-unused-expressions": "error",
|
|
378
|
+
"no-useless-call": "error",
|
|
379
|
+
"no-useless-computed-key": "error",
|
|
380
|
+
"no-useless-concat": "error",
|
|
381
|
+
"no-useless-constructor": "error",
|
|
382
|
+
"no-useless-rename": "error",
|
|
383
|
+
"no-useless-return": "error",
|
|
384
|
+
"no-var": "error",
|
|
385
|
+
"no-void": ["error", { allowAsStatement: true }],
|
|
386
|
+
"no-warning-comments": "off",
|
|
387
|
+
// disabled style rules
|
|
388
|
+
"object-shorthand": ["error", "always", { avoidQuotes: true, ignoreConstructors: false }],
|
|
389
|
+
"one-var": ["error", "never"],
|
|
390
|
+
"operator-assignment": "error",
|
|
391
|
+
"prefer-arrow-callback": "error",
|
|
392
|
+
"prefer-const": ["error", { ignoreReadBeforeAssign: true }],
|
|
393
|
+
// see https://github.com/airbnb/javascript/blob/eslint-config-airbnb-v19.0.4/packages/eslint-config-airbnb-base/rules/es6.js#L123
|
|
394
|
+
"prefer-destructuring": [
|
|
395
|
+
"error",
|
|
396
|
+
{
|
|
397
|
+
AssignmentExpression: { array: true, object: false },
|
|
398
|
+
VariableDeclarator: { array: false, object: true }
|
|
399
|
+
},
|
|
400
|
+
{ enforceForRenamedProperties: false }
|
|
401
|
+
],
|
|
402
|
+
"prefer-exponentiation-operator": "error",
|
|
403
|
+
"prefer-named-capture-group": "off",
|
|
404
|
+
// don't enable new regexp features
|
|
405
|
+
"prefer-numeric-literals": "error",
|
|
406
|
+
"prefer-object-has-own": "error",
|
|
407
|
+
"prefer-object-spread": "error",
|
|
408
|
+
"prefer-promise-reject-errors": ["error", { allowEmptyReject: true }],
|
|
409
|
+
"prefer-regex-literals": ["error", { disallowRedundantWrapping: true }],
|
|
410
|
+
"prefer-rest-params": "error",
|
|
411
|
+
"prefer-spread": "error",
|
|
412
|
+
"prefer-template": "error",
|
|
413
|
+
radix: "error",
|
|
414
|
+
"require-await": "error",
|
|
415
|
+
"require-unicode-regexp": "off",
|
|
416
|
+
// don't enable new regexp features
|
|
417
|
+
"sort-imports": "off",
|
|
418
|
+
// disabled style rules
|
|
419
|
+
"sort-keys": "off",
|
|
420
|
+
// disabled style rules
|
|
421
|
+
"sort-vars": "off",
|
|
422
|
+
// disabled style rules
|
|
423
|
+
strict: ["error", "never"],
|
|
424
|
+
"symbol-description": "error",
|
|
425
|
+
"vars-on-top": "error",
|
|
426
|
+
yoda: "error"
|
|
427
427
|
},
|
|
428
428
|
// https://eslint.org/docs/latest/rules/#layout--formatting
|
|
429
429
|
{
|
|
430
|
-
|
|
431
|
-
"unicode-bom": "error"
|
|
432
|
-
}
|
|
430
|
+
"unicode-bom": "error"
|
|
433
431
|
}
|
|
434
432
|
);
|
|
435
433
|
function jsGlobals({
|
|
@@ -437,7 +435,7 @@ function jsGlobals({
|
|
|
437
435
|
es2024 = true,
|
|
438
436
|
node = true
|
|
439
437
|
}) {
|
|
440
|
-
return
|
|
438
|
+
return pluginTs2.config({
|
|
441
439
|
languageOptions: {
|
|
442
440
|
globals: {
|
|
443
441
|
...es2024 ? globalVariables.es2024 : {},
|
|
@@ -451,256 +449,232 @@ function js({
|
|
|
451
449
|
globals = {},
|
|
452
450
|
...config
|
|
453
451
|
}) {
|
|
454
|
-
return
|
|
452
|
+
return pluginTs2.config(globals ? jsGlobals(globals) : {}, jsStrict, config);
|
|
455
453
|
}
|
|
456
454
|
|
|
457
455
|
// src/configs/jsx-a11y.ts
|
|
458
456
|
import pluginJsxA11y from "eslint-plugin-jsx-a11y";
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
// deprecated
|
|
468
|
-
"jsx-a11y/prefer-tag-over-role": "off"
|
|
469
|
-
}
|
|
457
|
+
var jsxA11yStrict = mergeRules(pluginJsxA11y.flatConfigs.recommended, {
|
|
458
|
+
"jsx-a11y/accessible-emoji": "off",
|
|
459
|
+
// deprecated
|
|
460
|
+
"jsx-a11y/lang": "error",
|
|
461
|
+
"jsx-a11y/no-aria-hidden-on-focusable": "off",
|
|
462
|
+
"jsx-a11y/no-onchange": "off",
|
|
463
|
+
// deprecated
|
|
464
|
+
"jsx-a11y/prefer-tag-over-role": "off"
|
|
470
465
|
});
|
|
471
466
|
|
|
472
467
|
// src/configs/perfectionist.ts
|
|
473
468
|
import pluginPerfectionist from "eslint-plugin-perfectionist";
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
...config,
|
|
484
|
-
rules: config.rules ? Object.fromEntries(
|
|
485
|
-
Object.entries(config.rules).map(([name, rule]) => [
|
|
486
|
-
name,
|
|
487
|
-
mergeRuleOptions(rule, options)
|
|
488
|
-
])
|
|
489
|
-
) : void 0
|
|
490
|
-
};
|
|
491
|
-
}
|
|
492
|
-
var perfectionistRecommended = mergeConfig(pluginPerfectionist.configs["recommended-natural"], {
|
|
493
|
-
ignoreCase: false
|
|
494
|
-
});
|
|
495
|
-
var perfectionistStrict = pluginTs5.config(
|
|
469
|
+
var perfectionistRecommended = {
|
|
470
|
+
...pluginPerfectionist.configs["recommended-natural"],
|
|
471
|
+
rules: Object.fromEntries(
|
|
472
|
+
Object.entries(pluginPerfectionist.configs["recommended-natural"].rules ?? {}).map(
|
|
473
|
+
([name, rule]) => [name, mergeRuleOptions(rule, { ignoreCase: false })]
|
|
474
|
+
)
|
|
475
|
+
)
|
|
476
|
+
};
|
|
477
|
+
var perfectionistStrict = mergeRules(
|
|
496
478
|
perfectionistRecommended,
|
|
497
479
|
{
|
|
498
|
-
rules
|
|
499
|
-
|
|
500
|
-
"perfectionist/sort-imports"
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
"perfectionist/sort-jsx-props"
|
|
523
|
-
|
|
524
|
-
{
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
"perfectionist/sort-union-types"
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
)
|
|
538
|
-
}
|
|
480
|
+
// see https://perfectionist.dev/rules/sort-imports
|
|
481
|
+
"perfectionist/sort-imports": mergeRuleOptions(
|
|
482
|
+
perfectionistRecommended.rules["perfectionist/sort-imports"],
|
|
483
|
+
{
|
|
484
|
+
groups: [
|
|
485
|
+
"type",
|
|
486
|
+
["builtin", "external"],
|
|
487
|
+
"internal-type",
|
|
488
|
+
"internal",
|
|
489
|
+
["parent-type", "sibling-type", "index-type"],
|
|
490
|
+
["parent", "sibling", "index"],
|
|
491
|
+
"object",
|
|
492
|
+
"side-effect",
|
|
493
|
+
"side-effect-style",
|
|
494
|
+
"unknown"
|
|
495
|
+
],
|
|
496
|
+
internalPattern: [
|
|
497
|
+
"^[@~]/.*"
|
|
498
|
+
// next.js/remix default pattern
|
|
499
|
+
]
|
|
500
|
+
}
|
|
501
|
+
),
|
|
502
|
+
// see https://perfectionist.dev/rules/sort-jsx-props
|
|
503
|
+
"perfectionist/sort-jsx-props": mergeRuleOptions(
|
|
504
|
+
perfectionistRecommended.rules["perfectionist/sort-jsx-props"],
|
|
505
|
+
{
|
|
506
|
+
customGroups: {
|
|
507
|
+
reserved: "^(?:key|ref)$"
|
|
508
|
+
},
|
|
509
|
+
groups: ["reserved", "unknown"]
|
|
510
|
+
}
|
|
511
|
+
),
|
|
512
|
+
// see https://perfectionist.dev/rules/sort-union-types
|
|
513
|
+
"perfectionist/sort-union-types": mergeRuleOptions(
|
|
514
|
+
perfectionistRecommended.rules["perfectionist/sort-union-types"],
|
|
515
|
+
{
|
|
516
|
+
groups: ["unknown", "nullish"]
|
|
517
|
+
}
|
|
518
|
+
)
|
|
539
519
|
},
|
|
540
520
|
{
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
"perfectionist/sort-modules": "off"
|
|
545
|
-
}
|
|
521
|
+
// disable sorting of method definitions that conflict with no-use-before-define
|
|
522
|
+
"perfectionist/sort-classes": "off",
|
|
523
|
+
"perfectionist/sort-modules": "off"
|
|
546
524
|
},
|
|
547
525
|
{
|
|
548
|
-
rules
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
"sort-keys": "off"
|
|
572
|
-
}
|
|
526
|
+
// conflict with https://perfectionist.dev/rules/sort-interfaces
|
|
527
|
+
// https://perfectionist.dev/rules/sort-object-types
|
|
528
|
+
"@typescript-eslint/adjacent-overload-signatures": "off",
|
|
529
|
+
// conflict with https://perfectionist.dev/rules/sort-classes
|
|
530
|
+
"@typescript-eslint/member-ordering": "off",
|
|
531
|
+
// conflict with https://perfectionist.dev/rules/sort-intersection-types
|
|
532
|
+
// https://perfectionist.dev/rules/sort-union-types
|
|
533
|
+
"@typescript-eslint/sort-type-constituents": "off",
|
|
534
|
+
// conflict with https://perfectionist.dev/rules/sort-imports
|
|
535
|
+
// https://perfectionist.dev/rules/sort-named-imports
|
|
536
|
+
"import/order": "off",
|
|
537
|
+
// conflict with https://perfectionist.dev/rules/sort-jsx-props
|
|
538
|
+
"react/jsx-sort-props": "off",
|
|
539
|
+
// conflict with https://perfectionist.dev/rules/sort-classes
|
|
540
|
+
"react/sort-comp": "off",
|
|
541
|
+
// conflict with https://perfectionist.dev/rules/sort-objects
|
|
542
|
+
"react/sort-default-props": "off",
|
|
543
|
+
"react/sort-prop-types": "off",
|
|
544
|
+
// conflict with https://perfectionist.dev/rules/sort-imports
|
|
545
|
+
// https://perfectionist.dev/rules/sort-named-imports
|
|
546
|
+
"sort-imports": "off",
|
|
547
|
+
// conflict with https://perfectionist.dev/rules/sort-objects
|
|
548
|
+
"sort-keys": "off"
|
|
573
549
|
}
|
|
574
550
|
);
|
|
575
551
|
|
|
576
552
|
// src/configs/react.ts
|
|
577
553
|
import pluginReact from "eslint-plugin-react";
|
|
578
|
-
import
|
|
579
|
-
var reactStrict =
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
"
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
"
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
"
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
"
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
"
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
"react/void-dom-elements-no-children": "error"
|
|
700
|
-
}
|
|
554
|
+
import pluginTs3 from "typescript-eslint";
|
|
555
|
+
var reactStrict = mergeRules(pluginReact.configs.flat.recommended ?? {}, {
|
|
556
|
+
"react/boolean-prop-naming": "off",
|
|
557
|
+
"react/button-has-type": ["error", { button: true, reset: false, submit: true }],
|
|
558
|
+
"react/checked-requires-onchange-or-readonly": "off",
|
|
559
|
+
"react/default-props-match-prop-types": "off",
|
|
560
|
+
"react/destructuring-assignment": ["error", "always"],
|
|
561
|
+
"react/forbid-component-props": "off",
|
|
562
|
+
"react/forbid-dom-props": "off",
|
|
563
|
+
"react/forbid-elements": "off",
|
|
564
|
+
"react/forbid-foreign-prop-types": ["warn", { allowInPropTypes: true }],
|
|
565
|
+
"react/forbid-prop-types": [
|
|
566
|
+
"error",
|
|
567
|
+
{
|
|
568
|
+
checkChildContextTypes: true,
|
|
569
|
+
checkContextTypes: true,
|
|
570
|
+
forbid: ["any", "array", "object"]
|
|
571
|
+
}
|
|
572
|
+
],
|
|
573
|
+
"react/forward-ref-uses-ref": "error",
|
|
574
|
+
"react/function-component-definition": [
|
|
575
|
+
"error",
|
|
576
|
+
{ namedComponents: "function-declaration", unnamedComponents: "function-expression" }
|
|
577
|
+
],
|
|
578
|
+
"react/hook-use-state": "error",
|
|
579
|
+
"react/iframe-missing-sandbox": "error",
|
|
580
|
+
"react/jsx-boolean-value": ["error", "never"],
|
|
581
|
+
"react/jsx-child-element-spacing": "off",
|
|
582
|
+
"react/jsx-closing-bracket-location": ["error", "line-aligned"],
|
|
583
|
+
"react/jsx-closing-tag-location": "error",
|
|
584
|
+
"react/jsx-curly-brace-presence": ["error", { children: "never", props: "never" }],
|
|
585
|
+
"react/jsx-curly-newline": ["error", { multiline: "consistent", singleline: "consistent" }],
|
|
586
|
+
"react/jsx-curly-spacing": ["error", "never", { allowMultiline: true }],
|
|
587
|
+
"react/jsx-equals-spacing": ["error", "never"],
|
|
588
|
+
"react/jsx-filename-extension": ["error", { extensions: [".jsx", ".tsx"] }],
|
|
589
|
+
"react/jsx-first-prop-new-line": ["error", "multiline-multiprop"],
|
|
590
|
+
"react/jsx-fragments": ["error", "syntax"],
|
|
591
|
+
"react/jsx-handler-names": "off",
|
|
592
|
+
"react/jsx-indent": ["error", 2],
|
|
593
|
+
"react/jsx-indent-props": ["error", 2],
|
|
594
|
+
"react/jsx-max-depth": "off",
|
|
595
|
+
"react/jsx-max-props-per-line": ["error", { maximum: 1, when: "multiline" }],
|
|
596
|
+
"react/jsx-newline": "off",
|
|
597
|
+
"react/jsx-no-bind": [
|
|
598
|
+
"error",
|
|
599
|
+
{
|
|
600
|
+
allowArrowFunctions: true,
|
|
601
|
+
allowBind: false,
|
|
602
|
+
allowFunctions: false,
|
|
603
|
+
ignoreDOMComponents: true,
|
|
604
|
+
ignoreRefs: true
|
|
605
|
+
}
|
|
606
|
+
],
|
|
607
|
+
"react/jsx-no-constructed-context-values": "error",
|
|
608
|
+
"react/jsx-no-leaked-render": ["error", { validStrategies: ["ternary"] }],
|
|
609
|
+
"react/jsx-no-literals": "off",
|
|
610
|
+
"react/jsx-no-script-url": ["error", [{ name: "Link", props: ["to"] }]],
|
|
611
|
+
"react/jsx-no-useless-fragment": "error",
|
|
612
|
+
"react/jsx-one-expression-per-line": ["error", { allow: "single-child" }],
|
|
613
|
+
"react/jsx-pascal-case": ["error", { allowAllCaps: true }],
|
|
614
|
+
"react/jsx-props-no-multi-spaces": "error",
|
|
615
|
+
"react/jsx-props-no-spread-multi": "error",
|
|
616
|
+
"react/jsx-props-no-spreading": "off",
|
|
617
|
+
"react/jsx-sort-props": "off",
|
|
618
|
+
"react/jsx-tag-spacing": [
|
|
619
|
+
"error",
|
|
620
|
+
{
|
|
621
|
+
afterOpening: "never",
|
|
622
|
+
beforeClosing: "never",
|
|
623
|
+
beforeSelfClosing: "always",
|
|
624
|
+
closingSlash: "never"
|
|
625
|
+
}
|
|
626
|
+
],
|
|
627
|
+
"react/jsx-wrap-multilines": [
|
|
628
|
+
"error",
|
|
629
|
+
{
|
|
630
|
+
arrow: "parens-new-line",
|
|
631
|
+
assignment: "parens-new-line",
|
|
632
|
+
condition: "parens-new-line",
|
|
633
|
+
declaration: "parens-new-line",
|
|
634
|
+
logical: "parens-new-line",
|
|
635
|
+
prop: "parens-new-line",
|
|
636
|
+
return: "parens-new-line"
|
|
637
|
+
}
|
|
638
|
+
],
|
|
639
|
+
"react/no-access-state-in-setstate": "error",
|
|
640
|
+
"react/no-adjacent-inline-elements": "off",
|
|
641
|
+
"react/no-array-index-key": "error",
|
|
642
|
+
"react/no-arrow-function-lifecycle": "error",
|
|
643
|
+
"react/no-danger": "warn",
|
|
644
|
+
"react/no-did-mount-set-state": "off",
|
|
645
|
+
"react/no-did-update-set-state": "error",
|
|
646
|
+
"react/no-invalid-html-attribute": "error",
|
|
647
|
+
"react/no-multi-comp": "off",
|
|
648
|
+
"react/no-namespace": "error",
|
|
649
|
+
"react/no-object-type-as-default-prop": "error",
|
|
650
|
+
"react/no-redundant-should-component-update": "error",
|
|
651
|
+
"react/no-set-state": "off",
|
|
652
|
+
"react/no-this-in-sfc": "error",
|
|
653
|
+
"react/no-typos": "error",
|
|
654
|
+
"react/no-unstable-nested-components": "error",
|
|
655
|
+
"react/no-unused-class-component-methods": "error",
|
|
656
|
+
"react/no-unused-prop-types": "error",
|
|
657
|
+
"react/no-unused-state": "error",
|
|
658
|
+
"react/no-will-update-set-state": "error",
|
|
659
|
+
"react/prefer-es6-class": ["error", "always"],
|
|
660
|
+
"react/prefer-exact-props": "error",
|
|
661
|
+
"react/prefer-read-only-props": "off",
|
|
662
|
+
// too strict
|
|
663
|
+
"react/prefer-stateless-function": ["error", { ignorePureComponents: true }],
|
|
664
|
+
"react/require-default-props": "off",
|
|
665
|
+
// disallow defaultProps
|
|
666
|
+
"react/require-optimization": "off",
|
|
667
|
+
"react/self-closing-comp": "error",
|
|
668
|
+
"react/sort-comp": "error",
|
|
669
|
+
"react/sort-default-props": "error",
|
|
670
|
+
"react/sort-prop-types": "error",
|
|
671
|
+
"react/state-in-constructor": ["error", "never"],
|
|
672
|
+
"react/static-property-placement": ["error", "property assignment"],
|
|
673
|
+
"react/style-prop-object": "error",
|
|
674
|
+
"react/void-dom-elements-no-children": "error"
|
|
701
675
|
});
|
|
702
676
|
function react(config) {
|
|
703
|
-
return
|
|
677
|
+
return pluginTs3.config(
|
|
704
678
|
{
|
|
705
679
|
settings: {
|
|
706
680
|
react: {
|
|
@@ -718,8 +692,7 @@ function react(config) {
|
|
|
718
692
|
|
|
719
693
|
// src/configs/react-hooks.ts
|
|
720
694
|
import pluginReactHooks from "eslint-plugin-react-hooks";
|
|
721
|
-
|
|
722
|
-
var reactHooksStrict = pluginTs7.config(
|
|
695
|
+
var reactHooksStrict = mergeRules(
|
|
723
696
|
// Flat Config version has not been released yet.
|
|
724
697
|
{
|
|
725
698
|
plugins: { "react-hooks": pluginReactHooks },
|
|
@@ -729,51 +702,101 @@ var reactHooksStrict = pluginTs7.config(
|
|
|
729
702
|
|
|
730
703
|
// src/configs/react-refresh.ts
|
|
731
704
|
import pluginReactRefresh from "eslint-plugin-react-refresh";
|
|
732
|
-
|
|
733
|
-
var reactRefreshStrict = pluginTs8.config(pluginReactRefresh.configs.recommended);
|
|
705
|
+
var reactRefreshStrict = mergeRules(pluginReactRefresh.configs.recommended);
|
|
734
706
|
|
|
735
707
|
// src/configs/ts.ts
|
|
736
|
-
import
|
|
737
|
-
var
|
|
708
|
+
import pluginTs4 from "typescript-eslint";
|
|
709
|
+
var jsStrictRules = jsStrict.rules ?? {};
|
|
710
|
+
var tsEslintOverrideRules = mergeRules(
|
|
711
|
+
{},
|
|
712
|
+
// see https://github.com/typescript-eslint/typescript-eslint/blob/v8.22.0/packages/eslint-plugin/src/configs/strict-type-checked.ts
|
|
713
|
+
{
|
|
714
|
+
"@typescript-eslint/no-array-constructor": jsStrictRules["no-array-constructor"],
|
|
715
|
+
"@typescript-eslint/no-implied-eval": jsStrictRules["no-implied-eval"],
|
|
716
|
+
"@typescript-eslint/no-unused-expressions": jsStrictRules["no-unused-expressions"],
|
|
717
|
+
"@typescript-eslint/no-unused-vars": jsStrictRules["no-unused-vars"],
|
|
718
|
+
"@typescript-eslint/no-useless-constructor": jsStrictRules["no-useless-constructor"],
|
|
719
|
+
"@typescript-eslint/prefer-promise-reject-errors": jsStrictRules["prefer-promise-reject-errors"],
|
|
720
|
+
"@typescript-eslint/require-await": jsStrictRules["require-await"],
|
|
721
|
+
"no-array-constructor": "off",
|
|
722
|
+
"no-implied-eval": "off",
|
|
723
|
+
"no-unused-expressions": "off",
|
|
724
|
+
"no-unused-vars": "off",
|
|
725
|
+
"no-useless-constructor": "off",
|
|
726
|
+
"prefer-promise-reject-errors": "off",
|
|
727
|
+
"require-await": "off"
|
|
728
|
+
},
|
|
729
|
+
// see https://github.com/typescript-eslint/typescript-eslint/blob/v8.22.0/packages/eslint-plugin/src/configs/stylistic-type-checked.ts
|
|
730
|
+
{
|
|
731
|
+
"@typescript-eslint/dot-notation": jsStrictRules["dot-notation"],
|
|
732
|
+
"@typescript-eslint/no-empty-function": jsStrictRules["no-empty-function"],
|
|
733
|
+
"dot-notation": "off",
|
|
734
|
+
"no-empty-function": "off"
|
|
735
|
+
},
|
|
736
|
+
// others
|
|
737
|
+
{
|
|
738
|
+
"@typescript-eslint/class-methods-use-this": jsStrictRules["class-methods-use-this"],
|
|
739
|
+
"@typescript-eslint/default-param-last": jsStrictRules["default-param-last"],
|
|
740
|
+
"@typescript-eslint/init-declarations": jsStrictRules["init-declarations"],
|
|
741
|
+
"@typescript-eslint/max-params": jsStrictRules["max-params"],
|
|
742
|
+
"@typescript-eslint/no-dupe-class-members": jsStrictRules["no-dupe-class-members"],
|
|
743
|
+
"@typescript-eslint/no-invalid-this": jsStrictRules["no-invalid-this"],
|
|
744
|
+
"@typescript-eslint/no-loop-func": jsStrictRules["no-loop-func"],
|
|
745
|
+
"@typescript-eslint/no-magic-numbers": jsStrictRules["no-magic-numbers"],
|
|
746
|
+
"@typescript-eslint/no-redeclare": jsStrictRules["no-redeclare"],
|
|
747
|
+
"@typescript-eslint/no-restricted-imports": jsStrictRules["no-restricted-imports"],
|
|
748
|
+
"@typescript-eslint/no-shadow": jsStrictRules["no-shadow"],
|
|
749
|
+
"@typescript-eslint/no-use-before-define": jsStrictRules["no-use-before-define"],
|
|
750
|
+
"@typescript-eslint/prefer-destructuring": jsStrictRules["prefer-destructuring"],
|
|
751
|
+
"class-methods-use-this": "off",
|
|
752
|
+
"default-param-last": "off",
|
|
753
|
+
"init-declarations": "off",
|
|
754
|
+
"max-params": "off",
|
|
755
|
+
"no-dupe-class-members": "off",
|
|
756
|
+
"no-invalid-this": "off",
|
|
757
|
+
"no-loop-func": "off",
|
|
758
|
+
"no-magic-numbers": "off",
|
|
759
|
+
"no-redeclare": "off",
|
|
760
|
+
"no-restricted-imports": "off",
|
|
761
|
+
"no-shadow": "off",
|
|
762
|
+
"no-use-before-define": "off",
|
|
763
|
+
"prefer-destructuring": "off"
|
|
764
|
+
}
|
|
765
|
+
);
|
|
766
|
+
var tsRecommendedOverride = mergeRules(
|
|
767
|
+
{},
|
|
738
768
|
// override rules in recommended
|
|
739
769
|
{
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
"
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
],
|
|
746
|
-
// override no-unused-vars in recommended
|
|
747
|
-
"@typescript-eslint/no-unused-vars": [
|
|
748
|
-
"warn",
|
|
749
|
-
{
|
|
750
|
-
argsIgnorePattern: "^_",
|
|
751
|
-
caughtErrorsIgnorePattern: "^_",
|
|
752
|
-
ignoreRestSiblings: true,
|
|
753
|
-
varsIgnorePattern: "^_"
|
|
754
|
-
}
|
|
755
|
-
]
|
|
756
|
-
}
|
|
770
|
+
// override no-empty-object-type in recommended
|
|
771
|
+
"@typescript-eslint/no-empty-object-type": [
|
|
772
|
+
"error",
|
|
773
|
+
{ allowInterfaces: "with-single-extends" }
|
|
774
|
+
]
|
|
757
775
|
},
|
|
758
776
|
// best practices
|
|
759
777
|
{
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
778
|
+
"@typescript-eslint/consistent-type-exports": "error",
|
|
779
|
+
"@typescript-eslint/consistent-type-imports": "error",
|
|
780
|
+
"@typescript-eslint/no-dupe-class-members": "off",
|
|
781
|
+
// disabled because tsc checks
|
|
782
|
+
"@typescript-eslint/no-invalid-this": "off",
|
|
783
|
+
// disabled because tsc checks
|
|
784
|
+
"no-duplicate-imports": "off"
|
|
785
|
+
// confilict with @typescript-eslint/consistent-type-imports
|
|
766
786
|
}
|
|
767
787
|
);
|
|
768
|
-
var tsRecommended =
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
788
|
+
var tsRecommended = pluginTs4.config(
|
|
789
|
+
pluginTs4.configs.recommended,
|
|
790
|
+
tsEslintOverrideRules,
|
|
791
|
+
tsRecommendedOverride
|
|
792
|
+
);
|
|
793
|
+
var tsStrict = pluginTs4.config(
|
|
794
|
+
pluginTs4.configs.strictTypeChecked,
|
|
795
|
+
pluginTs4.configs.stylisticTypeChecked,
|
|
796
|
+
tsEslintOverrideRules,
|
|
772
797
|
tsRecommendedOverride,
|
|
773
798
|
{
|
|
774
799
|
rules: {
|
|
775
|
-
// override no-empty-function in stylistic
|
|
776
|
-
"@typescript-eslint/no-empty-function": "warn",
|
|
777
800
|
// override no-unnecessary-condition in strict
|
|
778
801
|
"@typescript-eslint/no-unnecessary-condition": [
|
|
779
802
|
"error",
|
|
@@ -786,51 +809,26 @@ var tsStrict = pluginTs9.config(
|
|
|
786
809
|
},
|
|
787
810
|
{
|
|
788
811
|
rules: {
|
|
789
|
-
"@typescript-eslint/class-methods-use-this": "error",
|
|
790
812
|
"@typescript-eslint/consistent-return": "off",
|
|
791
813
|
// disabled because tsc checks
|
|
792
|
-
"@typescript-eslint/default-param-last": "error",
|
|
793
814
|
"@typescript-eslint/explicit-function-return-type": "error",
|
|
794
815
|
"@typescript-eslint/explicit-member-accessibility": ["error", { accessibility: "no-public" }],
|
|
795
816
|
"@typescript-eslint/explicit-module-boundary-types": "off",
|
|
796
817
|
// typescript-eslint/explicit-function-return-type is enabled
|
|
797
|
-
"@typescript-eslint/init-declarations": "error",
|
|
798
|
-
"@typescript-eslint/max-params": "off",
|
|
799
|
-
// disabled like js
|
|
800
818
|
"@typescript-eslint/member-ordering": "off",
|
|
801
819
|
// disabled style rules
|
|
802
820
|
"@typescript-eslint/method-signature-style": "error",
|
|
803
821
|
"@typescript-eslint/naming-convention": "off",
|
|
804
822
|
// disabled style rules
|
|
805
|
-
"@typescript-eslint/no-dupe-class-members": "off",
|
|
806
|
-
// disabled because tsc checks
|
|
807
823
|
"@typescript-eslint/no-import-type-side-effects": "error",
|
|
808
|
-
"@typescript-eslint/no-invalid-this": "off",
|
|
809
|
-
// disabled because tsc checks
|
|
810
|
-
"@typescript-eslint/no-loop-func": "error",
|
|
811
|
-
"@typescript-eslint/no-magic-numbers": "off",
|
|
812
|
-
// disabled like js
|
|
813
|
-
"@typescript-eslint/no-redeclare": "error",
|
|
814
|
-
"@typescript-eslint/no-restricted-imports": "off",
|
|
815
|
-
// disabled like js
|
|
816
824
|
"@typescript-eslint/no-restricted-types": "off",
|
|
817
825
|
// allow all types
|
|
818
|
-
"@typescript-eslint/no-shadow": "error",
|
|
819
826
|
"@typescript-eslint/no-unnecessary-parameter-property-assignment": "error",
|
|
820
827
|
"@typescript-eslint/no-unnecessary-qualifier": "error",
|
|
821
828
|
"@typescript-eslint/no-unsafe-type-assertion": "off",
|
|
822
829
|
// too strict
|
|
823
|
-
"@typescript-eslint/no-use-before-define": "error",
|
|
824
830
|
"@typescript-eslint/no-useless-empty-export": "error",
|
|
825
831
|
"@typescript-eslint/parameter-properties": ["error", { prefer: "parameter-property" }],
|
|
826
|
-
"@typescript-eslint/prefer-destructuring": [
|
|
827
|
-
"error",
|
|
828
|
-
{
|
|
829
|
-
AssignmentExpression: { array: true, object: false },
|
|
830
|
-
VariableDeclarator: { array: false, object: true }
|
|
831
|
-
},
|
|
832
|
-
{ enforceForRenamedProperties: false }
|
|
833
|
-
],
|
|
834
832
|
"@typescript-eslint/prefer-enum-initializers": "error",
|
|
835
833
|
"@typescript-eslint/prefer-readonly": "error",
|
|
836
834
|
"@typescript-eslint/prefer-readonly-parameter-types": "off",
|
|
@@ -840,21 +838,8 @@ var tsStrict = pluginTs9.config(
|
|
|
840
838
|
"@typescript-eslint/strict-boolean-expressions": "off",
|
|
841
839
|
// too strict
|
|
842
840
|
"@typescript-eslint/switch-exhaustiveness-check": "error",
|
|
843
|
-
"@typescript-eslint/typedef": "off"
|
|
841
|
+
"@typescript-eslint/typedef": "off"
|
|
844
842
|
// disabled for use strict tsc
|
|
845
|
-
"class-methods-use-this": "off",
|
|
846
|
-
"default-param-last": "off",
|
|
847
|
-
"init-declarations": "off",
|
|
848
|
-
"max-params": "off",
|
|
849
|
-
"no-dupe-class-members": "off",
|
|
850
|
-
"no-invalid-this": "off",
|
|
851
|
-
"no-loop-func": "off",
|
|
852
|
-
"no-magic-numbers": "off",
|
|
853
|
-
"no-redeclare": "off",
|
|
854
|
-
"no-restricted-imports": "off",
|
|
855
|
-
"no-shadow": "off",
|
|
856
|
-
"no-use-before-define": "off",
|
|
857
|
-
"prefer-destructuring": "off"
|
|
858
843
|
}
|
|
859
844
|
}
|
|
860
845
|
);
|
|
@@ -864,7 +849,7 @@ function ts({
|
|
|
864
849
|
strict = true,
|
|
865
850
|
...config
|
|
866
851
|
}) {
|
|
867
|
-
return
|
|
852
|
+
return pluginTs4.config(
|
|
868
853
|
parserOptions ? {
|
|
869
854
|
languageOptions: {
|
|
870
855
|
parserOptions: {
|
|
@@ -877,7 +862,7 @@ function ts({
|
|
|
877
862
|
config,
|
|
878
863
|
disableTypeChecked ? {
|
|
879
864
|
extends: [
|
|
880
|
-
|
|
865
|
+
pluginTs4.configs.disableTypeChecked,
|
|
881
866
|
// disabled unsafe rules for js files
|
|
882
867
|
{
|
|
883
868
|
rules: {
|
|
@@ -901,8 +886,8 @@ function ts({
|
|
|
901
886
|
|
|
902
887
|
// src/configs/unused-imports.ts
|
|
903
888
|
import pluginUnusedImports from "eslint-plugin-unused-imports";
|
|
904
|
-
|
|
905
|
-
var unusedImportsStrict =
|
|
889
|
+
var jsStrictRules2 = jsStrict.rules ?? {};
|
|
890
|
+
var unusedImportsStrict = mergeRules({
|
|
906
891
|
plugins: {
|
|
907
892
|
"unused-imports": pluginUnusedImports
|
|
908
893
|
},
|
|
@@ -910,82 +895,72 @@ var unusedImportsStrict = pluginTs10.config({
|
|
|
910
895
|
"@typescript-eslint/no-unused-vars": "off",
|
|
911
896
|
"no-unused-vars": "off",
|
|
912
897
|
"unused-imports/no-unused-imports": "error",
|
|
913
|
-
"unused-imports/no-unused-vars": [
|
|
914
|
-
"warn",
|
|
915
|
-
{
|
|
916
|
-
argsIgnorePattern: "^_",
|
|
917
|
-
caughtErrorsIgnorePattern: "^_",
|
|
918
|
-
ignoreRestSiblings: true,
|
|
919
|
-
varsIgnorePattern: "^_"
|
|
920
|
-
}
|
|
921
|
-
]
|
|
898
|
+
"unused-imports/no-unused-vars": jsStrictRules2["no-unused-vars"]
|
|
922
899
|
}
|
|
923
900
|
});
|
|
924
901
|
|
|
925
902
|
// src/configs/vitest.ts
|
|
926
903
|
import pluginVitest from "@vitest/eslint-plugin";
|
|
927
|
-
import
|
|
928
|
-
var vitestStrict =
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
"vitest/valid-expect-in-promise": "error"
|
|
985
|
-
}
|
|
904
|
+
import pluginTs5 from "typescript-eslint";
|
|
905
|
+
var vitestStrict = mergeRules(pluginVitest.configs.recommended, {
|
|
906
|
+
"vitest/consistent-test-filename": "off",
|
|
907
|
+
"vitest/consistent-test-it": "error",
|
|
908
|
+
"vitest/max-expects": "off",
|
|
909
|
+
"vitest/max-nested-describe": "off",
|
|
910
|
+
"vitest/no-alias-methods": "error",
|
|
911
|
+
"vitest/no-conditional-expect": "error",
|
|
912
|
+
"vitest/no-conditional-in-test": "error",
|
|
913
|
+
"vitest/no-conditional-tests": "error",
|
|
914
|
+
"vitest/no-disabled-tests": "off",
|
|
915
|
+
"vitest/no-done-callback": "off",
|
|
916
|
+
// deprecated
|
|
917
|
+
"vitest/no-duplicate-hooks": "error",
|
|
918
|
+
"vitest/no-focused-tests": "off",
|
|
919
|
+
"vitest/no-hooks": "off",
|
|
920
|
+
"vitest/no-interpolation-in-snapshots": "error",
|
|
921
|
+
"vitest/no-large-snapshots": "off",
|
|
922
|
+
"vitest/no-mocks-import": "off",
|
|
923
|
+
"vitest/no-restricted-matchers": "off",
|
|
924
|
+
"vitest/no-restricted-vi-methods": "off",
|
|
925
|
+
"vitest/no-standalone-expect": "error",
|
|
926
|
+
"vitest/no-test-prefixes": "off",
|
|
927
|
+
"vitest/no-test-return-statement": "error",
|
|
928
|
+
"vitest/padding-around-after-all-blocks": "error",
|
|
929
|
+
"vitest/padding-around-after-each-blocks": "error",
|
|
930
|
+
"vitest/padding-around-all": "error",
|
|
931
|
+
"vitest/padding-around-before-all-blocks": "error",
|
|
932
|
+
"vitest/padding-around-before-each-blocks": "error",
|
|
933
|
+
"vitest/padding-around-describe-blocks": "error",
|
|
934
|
+
"vitest/padding-around-expect-groups": "error",
|
|
935
|
+
"vitest/padding-around-test-blocks": "error",
|
|
936
|
+
"vitest/prefer-called-with": "error",
|
|
937
|
+
"vitest/prefer-comparison-matcher": "error",
|
|
938
|
+
"vitest/prefer-each": "error",
|
|
939
|
+
"vitest/prefer-equality-matcher": "error",
|
|
940
|
+
"vitest/prefer-expect-assertions": "error",
|
|
941
|
+
"vitest/prefer-expect-resolves": "error",
|
|
942
|
+
"vitest/prefer-hooks-in-order": "error",
|
|
943
|
+
"vitest/prefer-hooks-on-top": "error",
|
|
944
|
+
"vitest/prefer-lowercase-title": "error",
|
|
945
|
+
"vitest/prefer-mock-promise-shorthand": "error",
|
|
946
|
+
"vitest/prefer-snapshot-hint": "error",
|
|
947
|
+
"vitest/prefer-spy-on": "error",
|
|
948
|
+
"vitest/prefer-strict-equal": "error",
|
|
949
|
+
"vitest/prefer-to-be": "error",
|
|
950
|
+
"vitest/prefer-to-be-falsy": "error",
|
|
951
|
+
"vitest/prefer-to-be-object": "error",
|
|
952
|
+
"vitest/prefer-to-be-truthy": "error",
|
|
953
|
+
"vitest/prefer-to-contain": "error",
|
|
954
|
+
"vitest/prefer-to-have-length": "error",
|
|
955
|
+
"vitest/prefer-todo": "error",
|
|
956
|
+
"vitest/prefer-vi-mocked": "error",
|
|
957
|
+
"vitest/require-hook": "error",
|
|
958
|
+
"vitest/require-to-throw-message": "error",
|
|
959
|
+
"vitest/require-top-level-describe": "error",
|
|
960
|
+
"vitest/valid-expect-in-promise": "error"
|
|
986
961
|
});
|
|
987
962
|
function vitest(config) {
|
|
988
|
-
return
|
|
963
|
+
return pluginTs5.config({
|
|
989
964
|
extends: [vitestStrict, config],
|
|
990
965
|
files: ["tests/**", "*.test.*"]
|
|
991
966
|
});
|
|
@@ -993,8 +968,7 @@ function vitest(config) {
|
|
|
993
968
|
|
|
994
969
|
// src/configs/unicorn.ts
|
|
995
970
|
import pluginUnicorn from "eslint-plugin-unicorn";
|
|
996
|
-
|
|
997
|
-
var unicornRecommended = pluginTs12.config(
|
|
971
|
+
var unicornRecommended = mergeRules(
|
|
998
972
|
{
|
|
999
973
|
...pluginUnicorn.configs["flat/recommended"],
|
|
1000
974
|
rules: Object.fromEntries(
|
|
@@ -1004,73 +978,71 @@ var unicornRecommended = pluginTs12.config(
|
|
|
1004
978
|
)
|
|
1005
979
|
},
|
|
1006
980
|
{
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
"unicorn/switch-case-braces": ["error", "avoid"]
|
|
1073
|
-
}
|
|
981
|
+
"no-negated-condition": "off",
|
|
982
|
+
"no-nested-ternary": "off",
|
|
983
|
+
"unicorn/better-regex": "off",
|
|
984
|
+
// not recommended
|
|
985
|
+
"unicorn/catch-error-name": "off",
|
|
986
|
+
// overcorrection
|
|
987
|
+
"unicorn/consistent-destructuring": "off",
|
|
988
|
+
"unicorn/custom-error-definition": "off",
|
|
989
|
+
"unicorn/expiring-todo-comments": "off",
|
|
990
|
+
// discarded
|
|
991
|
+
"unicorn/filename-case": "off",
|
|
992
|
+
// discarded
|
|
993
|
+
"unicorn/no-abusive-eslint-disable": "off",
|
|
994
|
+
// disabled for use eslint-comments/no-unlimited-disable
|
|
995
|
+
"unicorn/no-anonymous-default-export": "off",
|
|
996
|
+
// disabled for use import/no-anonymous-default-export
|
|
997
|
+
"unicorn/no-array-for-each": "off",
|
|
998
|
+
// disallow for-of
|
|
999
|
+
"unicorn/no-array-reduce": "off",
|
|
1000
|
+
// allow array reduce
|
|
1001
|
+
"unicorn/no-console-spaces": "off",
|
|
1002
|
+
// discarded
|
|
1003
|
+
"unicorn/no-for-loop": "off",
|
|
1004
|
+
// disallow for-of
|
|
1005
|
+
"unicorn/no-keyword-prefix": "error",
|
|
1006
|
+
"unicorn/no-magic-array-flat-depth": "off",
|
|
1007
|
+
// allow magic numbers
|
|
1008
|
+
"unicorn/no-null": "off",
|
|
1009
|
+
// allow null
|
|
1010
|
+
"unicorn/no-typeof-undefined": "off",
|
|
1011
|
+
// discarded
|
|
1012
|
+
"unicorn/no-unnecessary-polyfills": "off",
|
|
1013
|
+
// skip validate polyfills
|
|
1014
|
+
"unicorn/no-unused-properties": "off",
|
|
1015
|
+
// not recommended
|
|
1016
|
+
"unicorn/numeric-separators-style": "off",
|
|
1017
|
+
// disabled style rules
|
|
1018
|
+
"unicorn/prefer-global-this": "off",
|
|
1019
|
+
// discarded
|
|
1020
|
+
"unicorn/prefer-json-parse-buffer": "off",
|
|
1021
|
+
// not recommended
|
|
1022
|
+
"unicorn/prefer-keyboard-event-key": "off",
|
|
1023
|
+
// allow keyCode
|
|
1024
|
+
"unicorn/prefer-node-protocol": "off",
|
|
1025
|
+
// disabled for use import/enforce-node-protocol-usage
|
|
1026
|
+
"unicorn/prefer-string-raw": "off",
|
|
1027
|
+
// disallow String.raw
|
|
1028
|
+
"unicorn/prefer-structured-clone": "off",
|
|
1029
|
+
// disallow structuredClone
|
|
1030
|
+
"unicorn/prefer-switch": "off",
|
|
1031
|
+
// discarded
|
|
1032
|
+
"unicorn/prefer-ternary": "off",
|
|
1033
|
+
// discarded
|
|
1034
|
+
"unicorn/prefer-top-level-await": "off",
|
|
1035
|
+
// discarded
|
|
1036
|
+
"unicorn/prefer-type-error": "off",
|
|
1037
|
+
// discarded
|
|
1038
|
+
"unicorn/prevent-abbreviations": "off",
|
|
1039
|
+
// disabled style rules
|
|
1040
|
+
"unicorn/relative-url-style": ["error", "always"],
|
|
1041
|
+
"unicorn/require-post-message-target-origin": "off",
|
|
1042
|
+
// not recommended
|
|
1043
|
+
"unicorn/string-content": "off",
|
|
1044
|
+
// not recommended
|
|
1045
|
+
"unicorn/switch-case-braces": ["error", "avoid"]
|
|
1074
1046
|
}
|
|
1075
1047
|
);
|
|
1076
1048
|
|
|
@@ -1088,7 +1060,7 @@ function defineBaseConfig({
|
|
|
1088
1060
|
vitest: vitestOptions = {},
|
|
1089
1061
|
...config
|
|
1090
1062
|
} = {}) {
|
|
1091
|
-
return
|
|
1063
|
+
return pluginTs6.config(
|
|
1092
1064
|
settings ? { settings } : {},
|
|
1093
1065
|
ignores ? { ignores } : {},
|
|
1094
1066
|
jsOptions ? js(jsOptions) : {},
|
|
@@ -1105,7 +1077,7 @@ function defineBaseConfig({
|
|
|
1105
1077
|
|
|
1106
1078
|
// src/react.ts
|
|
1107
1079
|
import pluginReact2 from "eslint-plugin-react";
|
|
1108
|
-
import
|
|
1080
|
+
import pluginTs7 from "typescript-eslint";
|
|
1109
1081
|
function defineReactConfig({
|
|
1110
1082
|
jsxA11y: enabledJsxA11y = true,
|
|
1111
1083
|
jsxRuntime: enabledJsxRuntime = true,
|
|
@@ -1113,7 +1085,7 @@ function defineReactConfig({
|
|
|
1113
1085
|
reactRefresh: enabledReactRefresh = true,
|
|
1114
1086
|
...reactOptions
|
|
1115
1087
|
} = {}) {
|
|
1116
|
-
return
|
|
1088
|
+
return pluginTs7.config(
|
|
1117
1089
|
react({
|
|
1118
1090
|
...reactOptions,
|
|
1119
1091
|
extends: [
|