@prowise/eslint-config-linting-rules 2.0.0 → 2.0.2
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/backend.js +5 -16
- package/base.js +30 -0
- package/eslint.config.js +9 -0
- package/front-react.js +19 -0
- package/front-solid.js +19 -0
- package/index.js +2 -34
- package/package.json +1 -1
- package/rules/{base-rules.js → baseSettings.js} +43 -551
- package/rules/plugin-import-rules.js +14 -2
- package/rules/plugin-jest-rules.js +65 -0
- package/rules/plugin-jsdoc-rules.js +6 -2
- package/rules/plugin-jsx-a11y-rules.js +49 -43
- package/rules/plugin-node-rules.js +41 -24
- package/rules/plugin-prefer-arrow-rules.js +17 -0
- package/rules/plugin-react-hooks-rules.js +5 -10
- package/rules/plugin-react-rules.js +24 -42
- package/rules/plugin-solid-rules.js +8 -2
- package/rules/plugin-stylistic-rules.js +538 -0
- package/rules/plugin-typescript-rules.js +59 -261
- package/rules/plugin-vitest-rules.js +77 -0
- package/rules/test-rules.js +1 -109
- package/typescript.js +6 -22
- package/eslint-plugin-esm-extensions/index.js +0 -155
- package/eslint-plugin-esm-extensions/package.json +0 -21
- package/frontend-vite.js +0 -38
- package/frontend.js +0 -39
- package/solid.js +0 -35
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
// eslint-disable-next-line import/no-unresolved
|
|
2
|
+
import typescriptPlugin from "typescript-eslint";
|
|
3
|
+
import baseRules from "./baseSettings.js";
|
|
3
4
|
|
|
4
|
-
|
|
5
|
+
export default {
|
|
5
6
|
/*
|
|
6
7
|
* ✅ recommended
|
|
7
8
|
* 🔒 strict
|
|
@@ -10,25 +11,12 @@ module.exports = {
|
|
|
10
11
|
* 💭 requires type information
|
|
11
12
|
*/
|
|
12
13
|
|
|
13
|
-
plugins:
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
"import/parsers": {
|
|
19
|
-
"@typescript-eslint/parser": [".ts", ".tsx", ".d.ts"],
|
|
20
|
-
},
|
|
21
|
-
|
|
22
|
-
// Append "ts" extensions to Airbnb "import/resolver" setting
|
|
23
|
-
"import/resolver": {
|
|
24
|
-
node: { extensions: [".mjs", ".js", ".json", ".ts", ".d.ts"] },
|
|
14
|
+
plugins: { "@typescript-eslint": typescriptPlugin.plugin },
|
|
15
|
+
languageOptions: {
|
|
16
|
+
parser: typescriptPlugin.parser,
|
|
17
|
+
parserOptions: {
|
|
18
|
+
project: true,
|
|
25
19
|
},
|
|
26
|
-
|
|
27
|
-
// Append "ts" extensions to Airbnb "import/extensions" setting
|
|
28
|
-
"import/extensions": [".js", ".mjs", ".jsx", ".ts", ".tsx", ".d.ts"],
|
|
29
|
-
|
|
30
|
-
// Resolve type definition packages
|
|
31
|
-
"import/external-module-folders": ["node_modules", "node_modules/@types"],
|
|
32
20
|
},
|
|
33
21
|
|
|
34
22
|
rules: {
|
|
@@ -71,58 +59,12 @@ module.exports = {
|
|
|
71
59
|
*/
|
|
72
60
|
"@typescript-eslint/ban-tslint-comment": "warn",
|
|
73
61
|
|
|
74
|
-
/**
|
|
75
|
-
* Disallow certain types ✅ 🔧
|
|
76
|
-
* https://typescript-eslint.io/rules/ban-types.
|
|
77
|
-
*/
|
|
78
|
-
"@typescript-eslint/ban-types": [
|
|
79
|
-
"error",
|
|
80
|
-
{
|
|
81
|
-
types: {
|
|
82
|
-
Object: {
|
|
83
|
-
message: "Avoid using the `Object` type. Did you mean `object`?",
|
|
84
|
-
},
|
|
85
|
-
Function: {
|
|
86
|
-
message: "Avoid using the `Function` type. Prefer a specific function type, like `() => void`.",
|
|
87
|
-
},
|
|
88
|
-
Boolean: {
|
|
89
|
-
message: "Avoid using the `Boolean` type. Did you mean `boolean`?",
|
|
90
|
-
},
|
|
91
|
-
Number: {
|
|
92
|
-
message: "Avoid using the `Number` type. Did you mean `number`?",
|
|
93
|
-
},
|
|
94
|
-
String: {
|
|
95
|
-
message: "Avoid using the `String` type. Did you mean `string`?",
|
|
96
|
-
},
|
|
97
|
-
Symbol: {
|
|
98
|
-
message: "Avoid using the `Symbol` type. Did you mean `symbol`?",
|
|
99
|
-
},
|
|
100
|
-
"{}": false,
|
|
101
|
-
},
|
|
102
|
-
},
|
|
103
|
-
],
|
|
104
|
-
|
|
105
62
|
/**
|
|
106
63
|
* Enforce that literals on classes are exposed in a consistent style 🔒 🔧
|
|
107
64
|
* https://typescript-eslint.io/rules/class-litiral-property-style.
|
|
108
65
|
*/
|
|
109
66
|
"@typescript-eslint/class-literal-property-style": "warn",
|
|
110
67
|
|
|
111
|
-
/**
|
|
112
|
-
* Require or disallow trailing commas.🔧
|
|
113
|
-
* https://typescript-eslint.io/rules/comma-dangle.
|
|
114
|
-
*/
|
|
115
|
-
"comma-dangle": "off",
|
|
116
|
-
"@typescript-eslint/comma-dangle": [
|
|
117
|
-
baseRules["comma-dangle"][0],
|
|
118
|
-
{
|
|
119
|
-
...baseRules["comma-dangle"][1],
|
|
120
|
-
enums: baseRules["comma-dangle"][1].arrays,
|
|
121
|
-
generics: baseRules["comma-dangle"][1].arrays,
|
|
122
|
-
tuples: baseRules["comma-dangle"][1].arrays,
|
|
123
|
-
},
|
|
124
|
-
],
|
|
125
|
-
|
|
126
68
|
/**
|
|
127
69
|
* Enforce specifying generic type arguments on type annotation or constructor name of a constructor call 🔒 🔧
|
|
128
70
|
* https://typescript-eslint.io/rules/consistent-generic-constructors.
|
|
@@ -166,14 +108,14 @@ module.exports = {
|
|
|
166
108
|
* Https://typescript-eslint.io/rules/default-param-last.
|
|
167
109
|
*/
|
|
168
110
|
"default-param-last": "off",
|
|
169
|
-
"@typescript-eslint/default-param-last": baseRules["default-param-last"],
|
|
111
|
+
"@typescript-eslint/default-param-last": baseRules.rules["default-param-last"],
|
|
170
112
|
|
|
171
113
|
/**
|
|
172
114
|
* Enforce dot notation whenever possible.
|
|
173
115
|
* Https://typescript-eslint.io/rules/dot-notation.
|
|
174
116
|
*/
|
|
175
117
|
"dot-notation": "off",
|
|
176
|
-
"@typescript-eslint/dot-notation": baseRules["dot-notation"],
|
|
118
|
+
"@typescript-eslint/dot-notation": baseRules.rules["dot-notation"],
|
|
177
119
|
|
|
178
120
|
/**
|
|
179
121
|
* Require explicit return types on functions and class methods.
|
|
@@ -214,13 +156,7 @@ module.exports = {
|
|
|
214
156
|
* https://typescript-eslint.io/rules/init-declarations.
|
|
215
157
|
*/
|
|
216
158
|
"init-declarations": "off",
|
|
217
|
-
"@typescript-eslint/init-declarations": baseRules["init-declarations"],
|
|
218
|
-
|
|
219
|
-
/**
|
|
220
|
-
* Require a specific member delimiter style for interfaces and type literals 🔧
|
|
221
|
-
* https://typescript-eslint.io/rules/member-delimiter-style.
|
|
222
|
-
*/
|
|
223
|
-
"@typescript-eslint/member-delimiter-style": "warn",
|
|
159
|
+
"@typescript-eslint/init-declarations": baseRules.rules["init-declarations"],
|
|
224
160
|
|
|
225
161
|
/**
|
|
226
162
|
* Require a consistent member declaration order
|
|
@@ -265,7 +201,7 @@ module.exports = {
|
|
|
265
201
|
* https://typescript-eslint.io/rules/no-array-constructor.
|
|
266
202
|
*/
|
|
267
203
|
"no-array-constructor": "off",
|
|
268
|
-
"@typescript-eslint/no-array-constructor": baseRules["no-array-constructor"],
|
|
204
|
+
"@typescript-eslint/no-array-constructor": baseRules.rules["no-array-constructor"],
|
|
269
205
|
|
|
270
206
|
/**
|
|
271
207
|
* Require .toString() to only be called on objects which provide useful information when stringified 🔒 💭
|
|
@@ -293,7 +229,7 @@ module.exports = {
|
|
|
293
229
|
* Https://typescript-eslint.io/rules/no-dupe-class-members.
|
|
294
230
|
*/
|
|
295
231
|
"no-dupe-class-members": "off",
|
|
296
|
-
"@typescript-eslint/no-dupe-class-members": baseRules["no-dupe-class-members"],
|
|
232
|
+
"@typescript-eslint/no-dupe-class-members": baseRules.rules["no-dupe-class-members"],
|
|
297
233
|
|
|
298
234
|
/**
|
|
299
235
|
* Disallow duplicate enum member values 🔒
|
|
@@ -312,13 +248,13 @@ module.exports = {
|
|
|
312
248
|
* https://typescript-eslint.io/rules/no-empty-function.
|
|
313
249
|
*/
|
|
314
250
|
"no-empty-function": "off",
|
|
315
|
-
"@typescript-eslint/no-empty-function": baseRules["no-empty-function"],
|
|
251
|
+
"@typescript-eslint/no-empty-function": baseRules.rules["no-empty-function"],
|
|
316
252
|
|
|
317
253
|
/**
|
|
318
|
-
* Disallow
|
|
319
|
-
* https://typescript-eslint.io/rules/no-empty-
|
|
254
|
+
* Disallow accidentally using the "empty object" type ✅ 🔧 💡
|
|
255
|
+
* https://typescript-eslint.io/rules/no-empty-object-type.
|
|
320
256
|
*/
|
|
321
|
-
"@typescript-eslint/no-empty-
|
|
257
|
+
"@typescript-eslint/no-empty-object-type": "error",
|
|
322
258
|
|
|
323
259
|
/**
|
|
324
260
|
* Disallow the any type ✅ 🔧 💡
|
|
@@ -332,20 +268,6 @@ module.exports = {
|
|
|
332
268
|
*/
|
|
333
269
|
"@typescript-eslint/no-extra-non-null-assertion": "error",
|
|
334
270
|
|
|
335
|
-
/**
|
|
336
|
-
* Disallow unnecessary parentheses.🔧
|
|
337
|
-
* https://typescript-eslint.io/rules/no-extra-parens.
|
|
338
|
-
*/
|
|
339
|
-
"no-extra-parens": "off",
|
|
340
|
-
"@typescript-eslint/no-extra-parens": baseRules["no-extra-parens"],
|
|
341
|
-
|
|
342
|
-
/**
|
|
343
|
-
* Disallow unnecessary semicolons.✅ 🔧
|
|
344
|
-
* https://typescript-eslint.io/rules/no-extra-semi.
|
|
345
|
-
*/
|
|
346
|
-
"no-extra-semi": "off",
|
|
347
|
-
"@typescript-eslint/no-extra-semi": baseRules["no-extra-semi"],
|
|
348
|
-
|
|
349
271
|
/**
|
|
350
272
|
* Disallow classes used as namespaces 🔒
|
|
351
273
|
* https://typescript-eslint.io/rules/no-extraneous-class.
|
|
@@ -370,7 +292,7 @@ module.exports = {
|
|
|
370
292
|
*/
|
|
371
293
|
"no-implied-eval": "off",
|
|
372
294
|
"no-new-function": "off",
|
|
373
|
-
"@typescript-eslint/no-implied-eval": baseRules["no-implied-eval"],
|
|
295
|
+
"@typescript-eslint/no-implied-eval": baseRules.rules["no-implied-eval"],
|
|
374
296
|
|
|
375
297
|
/**
|
|
376
298
|
* Disallow explicit type declarations for variables or parameters initialized to a number,
|
|
@@ -384,7 +306,7 @@ module.exports = {
|
|
|
384
306
|
* Https://typescript-eslint.io/rules/no-invalid-this.
|
|
385
307
|
*/
|
|
386
308
|
"no-invalid-this": "off",
|
|
387
|
-
"@typescript-eslint/no-invalid-this": baseRules["no-invalid-this"],
|
|
309
|
+
"@typescript-eslint/no-invalid-this": baseRules.rules["no-invalid-this"],
|
|
388
310
|
|
|
389
311
|
/**
|
|
390
312
|
* Disallow void type outside of generic or return types 🔒
|
|
@@ -397,21 +319,14 @@ module.exports = {
|
|
|
397
319
|
* Https://typescript-eslint.io/rules/no-loop-func.
|
|
398
320
|
*/
|
|
399
321
|
"no-loop-func": "off",
|
|
400
|
-
"@typescript-eslint/no-loop-func": baseRules["no-loop-func"],
|
|
401
|
-
|
|
402
|
-
/**
|
|
403
|
-
* Disallow literal numbers that lose precision. ✅
|
|
404
|
-
* https://typescript-eslint.io/rules/no-loss-of-precision.
|
|
405
|
-
*/
|
|
406
|
-
"no-loss-of-precision": "off",
|
|
407
|
-
"@typescript-eslint/no-loss-of-precision": baseRules["no-loss-of-precision"],
|
|
322
|
+
"@typescript-eslint/no-loop-func": baseRules.rules["no-loop-func"],
|
|
408
323
|
|
|
409
324
|
/**
|
|
410
325
|
* Disallow magic numbers.
|
|
411
326
|
* Https://typescript-eslint.io/rules/no-magic-numbers.
|
|
412
327
|
*/
|
|
413
328
|
"no-magic-numbers": "off",
|
|
414
|
-
"@typescript-eslint/no-magic-numbers": baseRules["no-magic-numbers"],
|
|
329
|
+
"@typescript-eslint/no-magic-numbers": baseRules.rules["no-magic-numbers"],
|
|
415
330
|
|
|
416
331
|
/**
|
|
417
332
|
* Disallow the void operator except when used to discard a value 🔒 🔧 💡 💭
|
|
@@ -460,7 +375,7 @@ module.exports = {
|
|
|
460
375
|
* Https://typescript-eslint.io/rules/no-redeclare.
|
|
461
376
|
*/
|
|
462
377
|
"no-redeclare": "off",
|
|
463
|
-
"@typescript-eslint/no-redeclare": baseRules["no-redeclare"],
|
|
378
|
+
"@typescript-eslint/no-redeclare": baseRules.rules["no-redeclare"],
|
|
464
379
|
|
|
465
380
|
/**
|
|
466
381
|
* Disallow members of unions and intersections that do nothing or override type information 💭
|
|
@@ -469,16 +384,15 @@ module.exports = {
|
|
|
469
384
|
"@typescript-eslint/no-redundant-type-constituents": "warn",
|
|
470
385
|
|
|
471
386
|
/**
|
|
472
|
-
* Disallow invocation of require()
|
|
387
|
+
* Disallow invocation of require() ✅
|
|
473
388
|
* https://typescript-eslint.io/rules/no-require-imports.
|
|
474
389
|
*/
|
|
475
|
-
"@typescript-eslint/no-require-imports": "
|
|
390
|
+
"@typescript-eslint/no-require-imports": "error",
|
|
476
391
|
|
|
477
392
|
/**
|
|
478
393
|
* Disallow unnecessary return await
|
|
479
394
|
* https://typescript-eslint.io/rules/return-await.
|
|
480
395
|
*/
|
|
481
|
-
"no-return-await": "off",
|
|
482
396
|
"@typescript-eslint/return-await": "warn",
|
|
483
397
|
|
|
484
398
|
/**
|
|
@@ -486,14 +400,14 @@ module.exports = {
|
|
|
486
400
|
* Https://typescript-eslint.io/rules/no-restricted-imports.
|
|
487
401
|
*/
|
|
488
402
|
"no-restricted-imports": "off",
|
|
489
|
-
"@typescript-eslint/no-restricted-imports": baseRules["no-restricted-imports"],
|
|
403
|
+
"@typescript-eslint/no-restricted-imports": baseRules.rules["no-restricted-imports"],
|
|
490
404
|
|
|
491
405
|
/**
|
|
492
406
|
* Disallow variable declarations from shadowing variables declared in the outer scope
|
|
493
407
|
* https://typescript-eslint.io/rules/no-shadow.
|
|
494
408
|
*/
|
|
495
409
|
"no-shadow": "off",
|
|
496
|
-
"@typescript-eslint/no-shadow": baseRules["no-shadow"],
|
|
410
|
+
"@typescript-eslint/no-shadow": baseRules.rules["no-shadow"],
|
|
497
411
|
|
|
498
412
|
/**
|
|
499
413
|
* Disallow aliasing this ✅
|
|
@@ -501,19 +415,6 @@ module.exports = {
|
|
|
501
415
|
*/
|
|
502
416
|
"@typescript-eslint/no-this-alias": "error",
|
|
503
417
|
|
|
504
|
-
/**
|
|
505
|
-
* Disallow throwing literals as exceptions
|
|
506
|
-
* https://typescript-eslint.io/rules/no-throw-literal.
|
|
507
|
-
*/
|
|
508
|
-
"no-throw-literal": "off",
|
|
509
|
-
"@typescript-eslint/no-throw-literal": "error",
|
|
510
|
-
|
|
511
|
-
/**
|
|
512
|
-
* Disallow type aliases
|
|
513
|
-
* https://typescript-eslint.io/rules/no-type-alias.
|
|
514
|
-
*/
|
|
515
|
-
"@typescript-eslint/no-type-alias": "off",
|
|
516
|
-
|
|
517
418
|
/**
|
|
518
419
|
* Disallow unnecessary equality comparisons against boolean literals 🔒 🔧 💭
|
|
519
420
|
* https://typescript-eslint.io/rules/no-unnecessary-boolean-literal-compare.
|
|
@@ -588,28 +489,28 @@ module.exports = {
|
|
|
588
489
|
* https://typescript-eslint.io/rules/no-unused-expressions.
|
|
589
490
|
*/
|
|
590
491
|
"no-unused-expressions": "off",
|
|
591
|
-
"@typescript-eslint/no-unused-expressions": baseRules["no-unused-expressions"],
|
|
492
|
+
"@typescript-eslint/no-unused-expressions": baseRules.rules["no-unused-expressions"],
|
|
592
493
|
|
|
593
494
|
/**
|
|
594
495
|
* Disallow unused variables
|
|
595
496
|
* https://typescript-eslint.io/rules/no-unused-vars.
|
|
596
497
|
*/
|
|
597
498
|
"no-unused-vars": "off",
|
|
598
|
-
"@typescript-eslint/no-unused-vars": baseRules["no-unused-vars"],
|
|
499
|
+
"@typescript-eslint/no-unused-vars": baseRules.rules["no-unused-vars"],
|
|
599
500
|
|
|
600
501
|
/**
|
|
601
502
|
* Disallow the use of variables before they are defined
|
|
602
503
|
* https://typescript-eslint.io/rules/no-use-before-define.
|
|
603
504
|
*/
|
|
604
505
|
"no-use-before-define": "off",
|
|
605
|
-
"@typescript-eslint/no-use-before-define": baseRules["no-use-before-define"],
|
|
506
|
+
"@typescript-eslint/no-use-before-define": baseRules.rules["no-use-before-define"],
|
|
606
507
|
|
|
607
508
|
/**
|
|
608
509
|
* Disallow unnecessary constructors
|
|
609
510
|
* https://typescript-eslint.io/rules/no-useless-constructor.
|
|
610
511
|
*/
|
|
611
512
|
"no-useless-constructor": "off",
|
|
612
|
-
"@typescript-eslint/no-useless-constructor": baseRules["no-useless-constructor"],
|
|
513
|
+
"@typescript-eslint/no-useless-constructor": baseRules.rules["no-useless-constructor"],
|
|
613
514
|
|
|
614
515
|
/**
|
|
615
516
|
* Disallow empty exports that don"t change anything in a module file 🔧
|
|
@@ -617,12 +518,6 @@ module.exports = {
|
|
|
617
518
|
*/
|
|
618
519
|
"@typescript-eslint/no-useless-empty-export": "warn",
|
|
619
520
|
|
|
620
|
-
/**
|
|
621
|
-
* Disallow require statements except in import statements ✅
|
|
622
|
-
* https://typescript-eslint.io/rules/no-var-requires.
|
|
623
|
-
*/
|
|
624
|
-
"@typescript-eslint/no-var-requires": "error",
|
|
625
|
-
|
|
626
521
|
/**
|
|
627
522
|
* Enforce non-null assertions over explicit type casts 🔒 🔧 💭
|
|
628
523
|
* https://typescript-eslint.io/rules/non-nullable-type-assertion-style.
|
|
@@ -732,25 +627,12 @@ module.exports = {
|
|
|
732
627
|
*/
|
|
733
628
|
"@typescript-eslint/prefer-string-starts-ends-with": "warn",
|
|
734
629
|
|
|
735
|
-
/**
|
|
736
|
-
* Enforce using @ts-expect-error over @ts-ignore 🔒 🔧
|
|
737
|
-
* https://typescript-eslint.io/rules/prefer-ts-expect-error.
|
|
738
|
-
*/
|
|
739
|
-
"@typescript-eslint/prefer-ts-expect-error": "warn",
|
|
740
|
-
|
|
741
630
|
/**
|
|
742
631
|
* Require any function or method that returns a Promise to be marked async 🔧 💭
|
|
743
632
|
* https://typescript-eslint.io/rules/promise-function-async.
|
|
744
633
|
*/
|
|
745
634
|
"@typescript-eslint/promise-function-async": "error",
|
|
746
635
|
|
|
747
|
-
/**
|
|
748
|
-
* Enforce the consistent use of double quotes
|
|
749
|
-
* https://typescript-eslint.io/rules/quotes.
|
|
750
|
-
*/
|
|
751
|
-
quotes: "off",
|
|
752
|
-
"@typescript-eslint/quotes": baseRules.quotes,
|
|
753
|
-
|
|
754
636
|
/**
|
|
755
637
|
* Require Array#sort calls to always provide a compareFunction 💭
|
|
756
638
|
* https://typescript-eslint.io/rules/require-array-sort-compare.
|
|
@@ -761,8 +643,8 @@ module.exports = {
|
|
|
761
643
|
* Disallow async functions which have no await expression
|
|
762
644
|
* https://typescript-eslint.io/rules/require-await.
|
|
763
645
|
*/
|
|
764
|
-
"require-await": "off",
|
|
765
|
-
"@typescript-eslint/require-await": baseRules["require-await"],
|
|
646
|
+
// "require-await": "off",
|
|
647
|
+
// "@typescript-eslint/require-await": baseRules.rules["require-await"],
|
|
766
648
|
|
|
767
649
|
/**
|
|
768
650
|
* Require both operands of addition to have type number or string ✅ 💭
|
|
@@ -777,13 +659,6 @@ module.exports = {
|
|
|
777
659
|
*/
|
|
778
660
|
"@typescript-eslint/restrict-template-expressions": "error",
|
|
779
661
|
|
|
780
|
-
/**
|
|
781
|
-
* Require or disallow semicolons instead of ASI.
|
|
782
|
-
* Https://typescript-eslint.io/rules/semi.
|
|
783
|
-
*/
|
|
784
|
-
semi: "off",
|
|
785
|
-
"@typescript-eslint/semi": baseRules.semi,
|
|
786
|
-
|
|
787
662
|
/**
|
|
788
663
|
* Enforce members of a type union/intersection to be sorted alphabetically 🔧 💡
|
|
789
664
|
* https://typescript-eslint.io/rules/sort-type-union-intersection-members.
|
|
@@ -834,109 +709,32 @@ module.exports = {
|
|
|
834
709
|
*/
|
|
835
710
|
"@typescript-eslint/unified-signatures": "error",
|
|
836
711
|
|
|
837
|
-
//
|
|
838
|
-
|
|
839
|
-
/**
|
|
840
|
-
* Enforce consistent brace style for blocks.
|
|
841
|
-
* Https://typescript-eslint.io/rules/brace-style.
|
|
842
|
-
*/
|
|
843
|
-
"brace-style": "off",
|
|
844
|
-
"@typescript-eslint/brace-style": baseRules["brace-style"],
|
|
845
|
-
|
|
846
|
-
/**
|
|
847
|
-
* Enforce consistent spacing before and after commas.
|
|
848
|
-
* Https://typescript-eslint.io/rules/comma-spacing.
|
|
849
|
-
*/
|
|
850
|
-
"comma-spacing": "off",
|
|
851
|
-
"@typescript-eslint/comma-spacing": baseRules["comma-spacing"],
|
|
852
|
-
|
|
853
|
-
/**
|
|
854
|
-
* Require or disallow spacing between function identifiers and their invocations.
|
|
855
|
-
* Https://typescript-eslint.io/rules/func-call-spacing.
|
|
856
|
-
*/
|
|
857
|
-
"func-call-spacing": "off",
|
|
858
|
-
"@typescript-eslint/func-call-spacing": baseRules["func-call-spacing"],
|
|
859
|
-
|
|
860
|
-
/**
|
|
861
|
-
* Enforce consistent indentation.
|
|
862
|
-
* Https://typescript-eslint.io/rules/indent.
|
|
863
|
-
*/
|
|
864
|
-
indent: "off",
|
|
865
|
-
"@typescript-eslint/indent": baseRules.indent,
|
|
866
|
-
|
|
867
|
-
/**
|
|
868
|
-
* Enforce consistent spacing before and after keywords.
|
|
869
|
-
* Https://typescript-eslint.io/rules/keyword-spacing.
|
|
870
|
-
*/
|
|
871
|
-
"keyword-spacing": "off",
|
|
872
|
-
"@typescript-eslint/keyword-spacing": baseRules["keyword-spacing"],
|
|
873
|
-
|
|
874
|
-
/**
|
|
875
|
-
* Enforce consistent spacing inside braces.
|
|
876
|
-
* Https://typescript-eslint.io/rules/object-curly-spacing.
|
|
877
|
-
*/
|
|
878
|
-
"object-curly-spacing": "off",
|
|
879
|
-
"@typescript-eslint/object-curly-spacing": baseRules["object-curly-spacing"],
|
|
880
|
-
|
|
881
|
-
/**
|
|
882
|
-
* Require or disallow padding lines between statements.
|
|
883
|
-
* Https://typescript-eslint.io/rules/padding-line-between-statements.
|
|
884
|
-
*/
|
|
885
|
-
"padding-line-between-statements": "off",
|
|
886
|
-
"@typescript-eslint/padding-line-between-statements": baseRules["padding-line-between-statements"],
|
|
887
|
-
|
|
888
|
-
/**
|
|
889
|
-
* Enforce consistent spacing before blocks.
|
|
890
|
-
* Https://typescript-eslint.io/rules/space-before-blocks.
|
|
891
|
-
*/
|
|
892
|
-
"space-before-blocks": "off",
|
|
893
|
-
"@typescript-eslint/space-before-blocks": baseRules["space-before-blocks"],
|
|
894
|
-
|
|
895
|
-
/**
|
|
896
|
-
* Enforce consistent spacing before function parenthesis.
|
|
897
|
-
* Https://typescript-eslint.io/rules/space-before-function-paren.
|
|
898
|
-
*/
|
|
899
|
-
"space-before-function-paren": "off",
|
|
900
|
-
"@typescript-eslint/space-before-function-paren": baseRules["space-before-function-paren"],
|
|
901
|
-
|
|
902
|
-
/**
|
|
903
|
-
* Require spacing around infix operators.
|
|
904
|
-
* Https://typescript-eslint.io/rules/space-infix-ops.
|
|
905
|
-
*/
|
|
906
|
-
"space-infix-ops": "off",
|
|
907
|
-
"@typescript-eslint/space-infix-ops": baseRules["space-infix-ops"],
|
|
908
|
-
|
|
909
|
-
/**
|
|
910
|
-
* Require consistent spacing around type annotations
|
|
911
|
-
* https://typescript-eslint.io/rules/type-annotation-spacing.
|
|
912
|
-
*/
|
|
913
|
-
"@typescript-eslint/type-annotation-spacing": "warn",
|
|
914
|
-
|
|
712
|
+
// TODO: fix this rule!
|
|
915
713
|
// Append "ts" and "tsx" to Airbnb "import/extensions" rule
|
|
916
|
-
"import/extensions": [
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
],
|
|
925
|
-
|
|
926
|
-
//
|
|
927
|
-
"import/no-extraneous-dependencies": [
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
],
|
|
714
|
+
// "import/extensions": [
|
|
715
|
+
// importRules.rules["import/extensions"][0],
|
|
716
|
+
// importRules.rules["import/extensions"][1],
|
|
717
|
+
// {
|
|
718
|
+
// ...importRules.rules["import/extensions"][2],
|
|
719
|
+
// ts: "never",
|
|
720
|
+
// tsx: "never",
|
|
721
|
+
// },
|
|
722
|
+
// ],
|
|
723
|
+
|
|
724
|
+
// TODO: fix this rule!
|
|
725
|
+
// "import/no-extraneous-dependencies": [
|
|
726
|
+
// importRules.rules["import/no-extraneous-dependencies"][0],
|
|
727
|
+
// {
|
|
728
|
+
// ...importRules.rules["import/no-extraneous-dependencies"][1],
|
|
729
|
+
// devDependencies: importRules.rules["import/no-extraneous-dependencies"][1].devDependencies.reduce(
|
|
730
|
+
// (result, devDep) => {
|
|
731
|
+
// const toAppend = [devDep];
|
|
732
|
+
// const devDepWithTs = devDep.replace(/\bjs(x?)\b/g, "ts$1");
|
|
733
|
+
// if (devDepWithTs !== devDep) toAppend.push(devDepWithTs);
|
|
734
|
+
// return [...result, ...toAppend];
|
|
735
|
+
// },
|
|
736
|
+
// ),
|
|
737
|
+
// },
|
|
738
|
+
// ],
|
|
941
739
|
},
|
|
942
740
|
};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import vitestPlugin from "eslint-plugin-vitest";
|
|
2
|
+
import { commonRules } from "./test-rules.js";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
plugins: { vitest: vitestPlugin },
|
|
6
|
+
|
|
7
|
+
languageOptions: {
|
|
8
|
+
globals: {
|
|
9
|
+
suite: true,
|
|
10
|
+
test: true,
|
|
11
|
+
describe: true,
|
|
12
|
+
it: true,
|
|
13
|
+
expectTypeOf: true,
|
|
14
|
+
assertType: true,
|
|
15
|
+
expect: true,
|
|
16
|
+
assert: true,
|
|
17
|
+
vitest: true,
|
|
18
|
+
vi: true,
|
|
19
|
+
beforeAll: true,
|
|
20
|
+
afterAll: true,
|
|
21
|
+
beforeEach: true,
|
|
22
|
+
afterEach: true,
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
|
|
26
|
+
rules: {
|
|
27
|
+
...commonRules("vitest"),
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Forbidden test file pattern: default only "test" accepted
|
|
31
|
+
* https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/consistent-test-filename.md
|
|
32
|
+
*/
|
|
33
|
+
"vitest/consistent-test-filename": ["off", { pattern: ".*\\.test\\.[tj]sx?$" }],
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Do not use conditionals to run tests
|
|
37
|
+
* https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/no-conditional-tests.md
|
|
38
|
+
*/
|
|
39
|
+
"vitest/no-conditional-tests": "off",
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Disallow importing node:test ✅ 🔧
|
|
43
|
+
* https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/no-import-node-test.md
|
|
44
|
+
*/
|
|
45
|
+
"vitest/no-import-node-test": "error",
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Disallow specific vi. methods
|
|
49
|
+
* https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/no-restricted-vi-methods.md
|
|
50
|
+
*/
|
|
51
|
+
"vitest/no-restricted-vi-methods": "off",
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Suggest using toBeFalsy() 🔧
|
|
55
|
+
* https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/prefer-to-be-falsy.md
|
|
56
|
+
*/
|
|
57
|
+
"vitest/prefer-to-be-falsy)": "off",
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Prefer toBeObject() 🔧
|
|
61
|
+
* https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/prefer-to-be-object.md
|
|
62
|
+
*/
|
|
63
|
+
"vitest/prefer-to-be-object": "off",
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Suggest using toBeTruthy 🔧
|
|
67
|
+
* https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/prefer-to-be-truthy.md
|
|
68
|
+
*/
|
|
69
|
+
"vitest/prefer-to-be-truthy": "off",
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Require local Test Context for concurrent snapshot tests ✅
|
|
73
|
+
* https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/require-local-test-context-for-concurrent-snapshots.md
|
|
74
|
+
*/
|
|
75
|
+
"vitest/require-local-test-context-for-concurrent-snapshots": "error",
|
|
76
|
+
},
|
|
77
|
+
};
|