@prowise/eslint-config-linting-rules 1.2.13 → 2.0.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/README.md +13 -3
- package/backend.js +4 -16
- package/base.js +30 -0
- package/eslint.config.js +4 -0
- package/front-react.js +19 -0
- package/front-solid.js +19 -0
- package/package.json +1 -1
- package/rules/{base-rules.js → baseSettings.js} +43 -551
- package/rules/plugin-import-rules.js +16 -4
- package/rules/plugin-jest-rules.js +59 -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 +56 -231
- package/rules/plugin-vitest-rules.js +77 -0
- package/rules/test-rules.js +1 -102
- 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/index.js +0 -35
- 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/eslint-plugin";
|
|
3
|
+
import * as baseRules from "./baseSettings.js";
|
|
3
4
|
|
|
4
|
-
|
|
5
|
+
export default {
|
|
5
6
|
/*
|
|
6
7
|
* ✅ recommended
|
|
7
8
|
* 🔒 strict
|
|
@@ -10,25 +11,13 @@ module.exports = {
|
|
|
10
11
|
* 💭 requires type information
|
|
11
12
|
*/
|
|
12
13
|
|
|
13
|
-
plugins:
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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 },
|
|
15
|
+
languageOptions: {
|
|
16
|
+
parserOptions: {
|
|
17
|
+
project: true,
|
|
18
|
+
projectService: true,
|
|
19
|
+
tsconfigRootDir: import.meta.dirname,
|
|
25
20
|
},
|
|
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
21
|
},
|
|
33
22
|
|
|
34
23
|
rules: {
|
|
@@ -71,58 +60,12 @@ module.exports = {
|
|
|
71
60
|
*/
|
|
72
61
|
"@typescript-eslint/ban-tslint-comment": "warn",
|
|
73
62
|
|
|
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
63
|
/**
|
|
106
64
|
* Enforce that literals on classes are exposed in a consistent style 🔒 🔧
|
|
107
65
|
* https://typescript-eslint.io/rules/class-litiral-property-style.
|
|
108
66
|
*/
|
|
109
67
|
"@typescript-eslint/class-literal-property-style": "warn",
|
|
110
68
|
|
|
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
69
|
/**
|
|
127
70
|
* Enforce specifying generic type arguments on type annotation or constructor name of a constructor call 🔒 🔧
|
|
128
71
|
* https://typescript-eslint.io/rules/consistent-generic-constructors.
|
|
@@ -166,14 +109,14 @@ module.exports = {
|
|
|
166
109
|
* Https://typescript-eslint.io/rules/default-param-last.
|
|
167
110
|
*/
|
|
168
111
|
"default-param-last": "off",
|
|
169
|
-
"@typescript-eslint/default-param-last": baseRules["default-param-last"],
|
|
112
|
+
"@typescript-eslint/default-param-last": baseRules.rules["default-param-last"],
|
|
170
113
|
|
|
171
114
|
/**
|
|
172
115
|
* Enforce dot notation whenever possible.
|
|
173
116
|
* Https://typescript-eslint.io/rules/dot-notation.
|
|
174
117
|
*/
|
|
175
118
|
"dot-notation": "off",
|
|
176
|
-
"@typescript-eslint/dot-notation": baseRules["dot-notation"],
|
|
119
|
+
"@typescript-eslint/dot-notation": baseRules.rules["dot-notation"],
|
|
177
120
|
|
|
178
121
|
/**
|
|
179
122
|
* Require explicit return types on functions and class methods.
|
|
@@ -214,13 +157,7 @@ module.exports = {
|
|
|
214
157
|
* https://typescript-eslint.io/rules/init-declarations.
|
|
215
158
|
*/
|
|
216
159
|
"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",
|
|
160
|
+
"@typescript-eslint/init-declarations": baseRules.rules["init-declarations"],
|
|
224
161
|
|
|
225
162
|
/**
|
|
226
163
|
* Require a consistent member declaration order
|
|
@@ -265,7 +202,7 @@ module.exports = {
|
|
|
265
202
|
* https://typescript-eslint.io/rules/no-array-constructor.
|
|
266
203
|
*/
|
|
267
204
|
"no-array-constructor": "off",
|
|
268
|
-
"@typescript-eslint/no-array-constructor": baseRules["no-array-constructor"],
|
|
205
|
+
"@typescript-eslint/no-array-constructor": baseRules.rules["no-array-constructor"],
|
|
269
206
|
|
|
270
207
|
/**
|
|
271
208
|
* Require .toString() to only be called on objects which provide useful information when stringified 🔒 💭
|
|
@@ -293,7 +230,7 @@ module.exports = {
|
|
|
293
230
|
* Https://typescript-eslint.io/rules/no-dupe-class-members.
|
|
294
231
|
*/
|
|
295
232
|
"no-dupe-class-members": "off",
|
|
296
|
-
"@typescript-eslint/no-dupe-class-members": baseRules["no-dupe-class-members"],
|
|
233
|
+
"@typescript-eslint/no-dupe-class-members": baseRules.rules["no-dupe-class-members"],
|
|
297
234
|
|
|
298
235
|
/**
|
|
299
236
|
* Disallow duplicate enum member values 🔒
|
|
@@ -312,7 +249,7 @@ module.exports = {
|
|
|
312
249
|
* https://typescript-eslint.io/rules/no-empty-function.
|
|
313
250
|
*/
|
|
314
251
|
"no-empty-function": "off",
|
|
315
|
-
"@typescript-eslint/no-empty-function": baseRules["no-empty-function"],
|
|
252
|
+
"@typescript-eslint/no-empty-function": baseRules.rules["no-empty-function"],
|
|
316
253
|
|
|
317
254
|
/**
|
|
318
255
|
* Disallow the declaration of empty interfaces ✅ 🔧 💡
|
|
@@ -332,20 +269,6 @@ module.exports = {
|
|
|
332
269
|
*/
|
|
333
270
|
"@typescript-eslint/no-extra-non-null-assertion": "error",
|
|
334
271
|
|
|
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
272
|
/**
|
|
350
273
|
* Disallow classes used as namespaces 🔒
|
|
351
274
|
* https://typescript-eslint.io/rules/no-extraneous-class.
|
|
@@ -370,7 +293,7 @@ module.exports = {
|
|
|
370
293
|
*/
|
|
371
294
|
"no-implied-eval": "off",
|
|
372
295
|
"no-new-function": "off",
|
|
373
|
-
"@typescript-eslint/no-implied-eval": baseRules["no-implied-eval"],
|
|
296
|
+
"@typescript-eslint/no-implied-eval": baseRules.rules["no-implied-eval"],
|
|
374
297
|
|
|
375
298
|
/**
|
|
376
299
|
* Disallow explicit type declarations for variables or parameters initialized to a number,
|
|
@@ -384,7 +307,7 @@ module.exports = {
|
|
|
384
307
|
* Https://typescript-eslint.io/rules/no-invalid-this.
|
|
385
308
|
*/
|
|
386
309
|
"no-invalid-this": "off",
|
|
387
|
-
"@typescript-eslint/no-invalid-this": baseRules["no-invalid-this"],
|
|
310
|
+
"@typescript-eslint/no-invalid-this": baseRules.rules["no-invalid-this"],
|
|
388
311
|
|
|
389
312
|
/**
|
|
390
313
|
* Disallow void type outside of generic or return types 🔒
|
|
@@ -397,21 +320,21 @@ module.exports = {
|
|
|
397
320
|
* Https://typescript-eslint.io/rules/no-loop-func.
|
|
398
321
|
*/
|
|
399
322
|
"no-loop-func": "off",
|
|
400
|
-
"@typescript-eslint/no-loop-func": baseRules["no-loop-func"],
|
|
323
|
+
"@typescript-eslint/no-loop-func": baseRules.rules["no-loop-func"],
|
|
401
324
|
|
|
402
325
|
/**
|
|
403
326
|
* Disallow literal numbers that lose precision. ✅
|
|
404
327
|
* https://typescript-eslint.io/rules/no-loss-of-precision.
|
|
405
328
|
*/
|
|
406
329
|
"no-loss-of-precision": "off",
|
|
407
|
-
"@typescript-eslint/no-loss-of-precision": baseRules["no-loss-of-precision"],
|
|
330
|
+
"@typescript-eslint/no-loss-of-precision": baseRules.rules["no-loss-of-precision"],
|
|
408
331
|
|
|
409
332
|
/**
|
|
410
333
|
* Disallow magic numbers.
|
|
411
334
|
* Https://typescript-eslint.io/rules/no-magic-numbers.
|
|
412
335
|
*/
|
|
413
336
|
"no-magic-numbers": "off",
|
|
414
|
-
"@typescript-eslint/no-magic-numbers": baseRules["no-magic-numbers"],
|
|
337
|
+
"@typescript-eslint/no-magic-numbers": baseRules.rules["no-magic-numbers"],
|
|
415
338
|
|
|
416
339
|
/**
|
|
417
340
|
* Disallow the void operator except when used to discard a value 🔒 🔧 💡 💭
|
|
@@ -460,7 +383,7 @@ module.exports = {
|
|
|
460
383
|
* Https://typescript-eslint.io/rules/no-redeclare.
|
|
461
384
|
*/
|
|
462
385
|
"no-redeclare": "off",
|
|
463
|
-
"@typescript-eslint/no-redeclare": baseRules["no-redeclare"],
|
|
386
|
+
"@typescript-eslint/no-redeclare": baseRules.rules["no-redeclare"],
|
|
464
387
|
|
|
465
388
|
/**
|
|
466
389
|
* Disallow members of unions and intersections that do nothing or override type information 💭
|
|
@@ -486,14 +409,14 @@ module.exports = {
|
|
|
486
409
|
* Https://typescript-eslint.io/rules/no-restricted-imports.
|
|
487
410
|
*/
|
|
488
411
|
"no-restricted-imports": "off",
|
|
489
|
-
"@typescript-eslint/no-restricted-imports": baseRules["no-restricted-imports"],
|
|
412
|
+
"@typescript-eslint/no-restricted-imports": baseRules.rules["no-restricted-imports"],
|
|
490
413
|
|
|
491
414
|
/**
|
|
492
415
|
* Disallow variable declarations from shadowing variables declared in the outer scope
|
|
493
416
|
* https://typescript-eslint.io/rules/no-shadow.
|
|
494
417
|
*/
|
|
495
418
|
"no-shadow": "off",
|
|
496
|
-
"@typescript-eslint/no-shadow": baseRules["no-shadow"],
|
|
419
|
+
"@typescript-eslint/no-shadow": baseRules.rules["no-shadow"],
|
|
497
420
|
|
|
498
421
|
/**
|
|
499
422
|
* Disallow aliasing this ✅
|
|
@@ -501,13 +424,6 @@ module.exports = {
|
|
|
501
424
|
*/
|
|
502
425
|
"@typescript-eslint/no-this-alias": "error",
|
|
503
426
|
|
|
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
427
|
/**
|
|
512
428
|
* Disallow type aliases
|
|
513
429
|
* https://typescript-eslint.io/rules/no-type-alias.
|
|
@@ -588,28 +504,28 @@ module.exports = {
|
|
|
588
504
|
* https://typescript-eslint.io/rules/no-unused-expressions.
|
|
589
505
|
*/
|
|
590
506
|
"no-unused-expressions": "off",
|
|
591
|
-
"@typescript-eslint/no-unused-expressions": baseRules["no-unused-expressions"],
|
|
507
|
+
"@typescript-eslint/no-unused-expressions": baseRules.rules["no-unused-expressions"],
|
|
592
508
|
|
|
593
509
|
/**
|
|
594
510
|
* Disallow unused variables
|
|
595
511
|
* https://typescript-eslint.io/rules/no-unused-vars.
|
|
596
512
|
*/
|
|
597
513
|
"no-unused-vars": "off",
|
|
598
|
-
"@typescript-eslint/no-unused-vars": baseRules["no-unused-vars"],
|
|
514
|
+
"@typescript-eslint/no-unused-vars": baseRules.rules["no-unused-vars"],
|
|
599
515
|
|
|
600
516
|
/**
|
|
601
517
|
* Disallow the use of variables before they are defined
|
|
602
518
|
* https://typescript-eslint.io/rules/no-use-before-define.
|
|
603
519
|
*/
|
|
604
520
|
"no-use-before-define": "off",
|
|
605
|
-
"@typescript-eslint/no-use-before-define": baseRules["no-use-before-define"],
|
|
521
|
+
"@typescript-eslint/no-use-before-define": baseRules.rules["no-use-before-define"],
|
|
606
522
|
|
|
607
523
|
/**
|
|
608
524
|
* Disallow unnecessary constructors
|
|
609
525
|
* https://typescript-eslint.io/rules/no-useless-constructor.
|
|
610
526
|
*/
|
|
611
527
|
"no-useless-constructor": "off",
|
|
612
|
-
"@typescript-eslint/no-useless-constructor": baseRules["no-useless-constructor"],
|
|
528
|
+
"@typescript-eslint/no-useless-constructor": baseRules.rules["no-useless-constructor"],
|
|
613
529
|
|
|
614
530
|
/**
|
|
615
531
|
* Disallow empty exports that don"t change anything in a module file 🔧
|
|
@@ -744,13 +660,6 @@ module.exports = {
|
|
|
744
660
|
*/
|
|
745
661
|
"@typescript-eslint/promise-function-async": "error",
|
|
746
662
|
|
|
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
663
|
/**
|
|
755
664
|
* Require Array#sort calls to always provide a compareFunction 💭
|
|
756
665
|
* https://typescript-eslint.io/rules/require-array-sort-compare.
|
|
@@ -761,8 +670,8 @@ module.exports = {
|
|
|
761
670
|
* Disallow async functions which have no await expression
|
|
762
671
|
* https://typescript-eslint.io/rules/require-await.
|
|
763
672
|
*/
|
|
764
|
-
"require-await": "off",
|
|
765
|
-
"@typescript-eslint/require-await": baseRules["require-await"],
|
|
673
|
+
// "require-await": "off",
|
|
674
|
+
// "@typescript-eslint/require-await": baseRules.rules["require-await"],
|
|
766
675
|
|
|
767
676
|
/**
|
|
768
677
|
* Require both operands of addition to have type number or string ✅ 💭
|
|
@@ -777,13 +686,6 @@ module.exports = {
|
|
|
777
686
|
*/
|
|
778
687
|
"@typescript-eslint/restrict-template-expressions": "error",
|
|
779
688
|
|
|
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
689
|
/**
|
|
788
690
|
* Enforce members of a type union/intersection to be sorted alphabetically 🔧 💡
|
|
789
691
|
* https://typescript-eslint.io/rules/sort-type-union-intersection-members.
|
|
@@ -834,109 +736,32 @@ module.exports = {
|
|
|
834
736
|
*/
|
|
835
737
|
"@typescript-eslint/unified-signatures": "error",
|
|
836
738
|
|
|
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
|
-
|
|
739
|
+
// TODO: fix this rule!
|
|
915
740
|
// 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
|
-
],
|
|
741
|
+
// "import/extensions": [
|
|
742
|
+
// importRules.rules["import/extensions"][0],
|
|
743
|
+
// importRules.rules["import/extensions"][1],
|
|
744
|
+
// {
|
|
745
|
+
// ...importRules.rules["import/extensions"][2],
|
|
746
|
+
// ts: "never",
|
|
747
|
+
// tsx: "never",
|
|
748
|
+
// },
|
|
749
|
+
// ],
|
|
750
|
+
|
|
751
|
+
// TODO: fix this rule!
|
|
752
|
+
// "import/no-extraneous-dependencies": [
|
|
753
|
+
// importRules.rules["import/no-extraneous-dependencies"][0],
|
|
754
|
+
// {
|
|
755
|
+
// ...importRules.rules["import/no-extraneous-dependencies"][1],
|
|
756
|
+
// devDependencies: importRules.rules["import/no-extraneous-dependencies"][1].devDependencies.reduce(
|
|
757
|
+
// (result, devDep) => {
|
|
758
|
+
// const toAppend = [devDep];
|
|
759
|
+
// const devDepWithTs = devDep.replace(/\bjs(x?)\b/g, "ts$1");
|
|
760
|
+
// if (devDepWithTs !== devDep) toAppend.push(devDepWithTs);
|
|
761
|
+
// return [...result, ...toAppend];
|
|
762
|
+
// },
|
|
763
|
+
// ),
|
|
764
|
+
// },
|
|
765
|
+
// ],
|
|
941
766
|
},
|
|
942
767
|
};
|
|
@@ -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
|
+
};
|
package/rules/test-rules.js
CHANGED
|
@@ -329,111 +329,10 @@ const rules = {
|
|
|
329
329
|
* @param framework Used test framework
|
|
330
330
|
* @returns Testing rules.
|
|
331
331
|
*/
|
|
332
|
-
function commonRules(framework) {
|
|
332
|
+
export function commonRules(framework) {
|
|
333
333
|
const updated = {};
|
|
334
334
|
for (const key in rules) {
|
|
335
335
|
updated[`${framework}/${key}`] = rules[key];
|
|
336
336
|
}
|
|
337
337
|
return updated;
|
|
338
338
|
}
|
|
339
|
-
|
|
340
|
-
module.exports = {
|
|
341
|
-
jestRules: {
|
|
342
|
-
...commonRules("jest"),
|
|
343
|
-
|
|
344
|
-
/**
|
|
345
|
-
* Disallow confusing usages of jest.setTimeout
|
|
346
|
-
* https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-confusing-set-timeout.md
|
|
347
|
-
*/
|
|
348
|
-
"jest/no-confusing-set-timeout": "off",
|
|
349
|
-
|
|
350
|
-
/**
|
|
351
|
-
* Disallow use of deprecated functions ✅ 🔧
|
|
352
|
-
* https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-deprecated-functions.md
|
|
353
|
-
*/
|
|
354
|
-
"jest/no-deprecated-functions": "error",
|
|
355
|
-
|
|
356
|
-
/**
|
|
357
|
-
* Disallow using exports in files containing tests ✅
|
|
358
|
-
* https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-export.md
|
|
359
|
-
*/
|
|
360
|
-
"jest/no-export": "error",
|
|
361
|
-
|
|
362
|
-
/**
|
|
363
|
-
* Disallow Jasmine globals ✅ 🔧
|
|
364
|
-
* https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-jasmine-globals.md
|
|
365
|
-
*/
|
|
366
|
-
"jest/no-jasmine-globals": "error",
|
|
367
|
-
|
|
368
|
-
/**
|
|
369
|
-
* Disallow specific jest. methods
|
|
370
|
-
* https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-restricted-jest-methods.md
|
|
371
|
-
*/
|
|
372
|
-
"jest/no-restricted-jest-methods": "off",
|
|
373
|
-
|
|
374
|
-
/**
|
|
375
|
-
* Disallow using jest.mock() factories without an explicit type parameter
|
|
376
|
-
* https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-untyped-mock-factory.md
|
|
377
|
-
*/
|
|
378
|
-
"jest/no-untyped-mock-factory": "off",
|
|
379
|
-
|
|
380
|
-
/**
|
|
381
|
-
* Require promises that have expectations in their chain to be valid ✅
|
|
382
|
-
* https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/valid-expect-in-promise.md
|
|
383
|
-
*/
|
|
384
|
-
"jest/valid-expect-in-promise": "error",
|
|
385
|
-
|
|
386
|
-
},
|
|
387
|
-
|
|
388
|
-
vitestRules: {
|
|
389
|
-
...commonRules("vitest"),
|
|
390
|
-
|
|
391
|
-
/**
|
|
392
|
-
* Forbidden test file pattern: default only "test" accepted
|
|
393
|
-
* https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/consistent-test-filename.md
|
|
394
|
-
*/
|
|
395
|
-
"vitest/consistent-test-filename": ["off", { pattern: ".*\\.test\\.[tj]sx?$" }],
|
|
396
|
-
|
|
397
|
-
/**
|
|
398
|
-
* Do not use conditionals to run tests
|
|
399
|
-
* https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/no-conditional-tests.md
|
|
400
|
-
*/
|
|
401
|
-
"vitest/no-conditional-tests": "off",
|
|
402
|
-
|
|
403
|
-
/**
|
|
404
|
-
* Disallow importing node:test ✅ 🔧
|
|
405
|
-
* https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/no-import-node-test.md
|
|
406
|
-
*/
|
|
407
|
-
"vitest/no-import-node-test": "error",
|
|
408
|
-
|
|
409
|
-
/**
|
|
410
|
-
* Disallow specific vi. methods
|
|
411
|
-
* https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/no-restricted-vi-methods.md
|
|
412
|
-
*/
|
|
413
|
-
"vitest/no-restricted-vi-methods": "off",
|
|
414
|
-
|
|
415
|
-
/**
|
|
416
|
-
* Suggest using toBeFalsy() 🔧
|
|
417
|
-
* https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/prefer-to-be-falsy.md
|
|
418
|
-
*/
|
|
419
|
-
"vitest/prefer-to-be-falsy)": "off",
|
|
420
|
-
|
|
421
|
-
/**
|
|
422
|
-
* Prefer toBeObject() 🔧
|
|
423
|
-
* https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/prefer-to-be-object.md
|
|
424
|
-
*/
|
|
425
|
-
"vitest/prefer-to-be-object": "off",
|
|
426
|
-
|
|
427
|
-
/**
|
|
428
|
-
* Suggest using toBeTruthy 🔧
|
|
429
|
-
* https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/prefer-to-be-truthy.md
|
|
430
|
-
*/
|
|
431
|
-
"vitest/prefer-to-be-truthy": "off",
|
|
432
|
-
|
|
433
|
-
/**
|
|
434
|
-
* Require local Test Context for concurrent snapshot tests ✅
|
|
435
|
-
* https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/require-local-test-context-for-concurrent-snapshots.md
|
|
436
|
-
*/
|
|
437
|
-
"vitest/require-local-test-context-for-concurrent-snapshots": "error",
|
|
438
|
-
},
|
|
439
|
-
};
|