@prowise/eslint-config-linting-rules 2.0.4 → 2.0.6
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 +4 -0
- package/package.json +1 -1
- package/rules/baseSettings.js +112 -111
- package/rules/plugin-import-rules.js +73 -67
- package/rules/plugin-jest-rules.js +3 -3
- package/rules/plugin-jsdoc-rules.js +12 -12
- package/rules/plugin-jsx-a11y-rules.js +2 -2
- package/rules/plugin-node-rules.js +6 -6
- package/rules/plugin-prefer-arrow-rules.js +10 -6
- package/rules/plugin-react-rules.js +54 -54
- package/rules/plugin-solid-rules.js +21 -21
- package/rules/plugin-stylistic-rules.js +32 -29
- package/rules/plugin-typescript-rules.js +40 -37
- package/rules/plugin-vitest-rules.js +6 -6
- package/rules/test-rules.js +11 -11
- package/rules/plugin-react-hooks-rules.js +0 -18
|
@@ -91,7 +91,7 @@ export default {
|
|
|
91
91
|
* https://typescript-eslint.io/rules/consistent-type-definitions.
|
|
92
92
|
* Turned off => we want to keep difference between defining type and interface.
|
|
93
93
|
*/
|
|
94
|
-
"@typescript-eslint/consistent-type-definitions": "off",
|
|
94
|
+
// "@typescript-eslint/consistent-type-definitions": "off",
|
|
95
95
|
|
|
96
96
|
/**
|
|
97
97
|
* Enforce consistent usage of type exports 🔧 💭
|
|
@@ -104,7 +104,11 @@ export default {
|
|
|
104
104
|
* https://typescript-eslint.io/rules/consistent-type-imports.
|
|
105
105
|
* Turned off to allow us to use type import to prevent circular import warning.
|
|
106
106
|
*/
|
|
107
|
-
"@typescript-eslint/consistent-type-imports": ["
|
|
107
|
+
"@typescript-eslint/consistent-type-imports": ["warn", {
|
|
108
|
+
prefer: "type-imports",
|
|
109
|
+
fixStyle: "inline-type-imports",
|
|
110
|
+
disallowTypeAnnotations: false,
|
|
111
|
+
}],
|
|
108
112
|
|
|
109
113
|
/**
|
|
110
114
|
* Enforce default parameters to be last.
|
|
@@ -158,14 +162,14 @@ export default {
|
|
|
158
162
|
* Require or disallow initialization in variable declarations
|
|
159
163
|
* https://typescript-eslint.io/rules/init-declarations.
|
|
160
164
|
*/
|
|
161
|
-
"init-declarations": "off",
|
|
162
|
-
"@typescript-eslint/init-declarations": baseRules.rules["init-declarations"],
|
|
165
|
+
// "init-declarations": "off",
|
|
166
|
+
// "@typescript-eslint/init-declarations": baseRules.rules["init-declarations"],
|
|
163
167
|
|
|
164
168
|
/**
|
|
165
169
|
* Require a consistent member declaration order
|
|
166
170
|
* https://typescript-eslint.io/rules/member-ordering.
|
|
167
171
|
*/
|
|
168
|
-
"@typescript-eslint/member-ordering": "off",
|
|
172
|
+
// "@typescript-eslint/member-ordering": "off",
|
|
169
173
|
|
|
170
174
|
/**
|
|
171
175
|
* Enforce using a particular method signature syntax 🔧
|
|
@@ -278,7 +282,7 @@ export default {
|
|
|
278
282
|
* Disallow classes used as namespaces 🔒
|
|
279
283
|
* https://typescript-eslint.io/rules/no-extraneous-class.
|
|
280
284
|
*/
|
|
281
|
-
"@typescript-eslint/no-extraneous-class": "off",
|
|
285
|
+
// "@typescript-eslint/no-extraneous-class": "off",
|
|
282
286
|
|
|
283
287
|
/**
|
|
284
288
|
* Require Promise-like statements to be handled appropriately ✅ 💡 💭
|
|
@@ -297,7 +301,6 @@ export default {
|
|
|
297
301
|
* https://typescript-eslint.io/rules/no-implied-eval.
|
|
298
302
|
*/
|
|
299
303
|
"no-implied-eval": "off",
|
|
300
|
-
"no-new-function": "off",
|
|
301
304
|
"@typescript-eslint/no-implied-eval": baseRules.rules["no-implied-eval"],
|
|
302
305
|
|
|
303
306
|
/**
|
|
@@ -311,14 +314,14 @@ export default {
|
|
|
311
314
|
* Disallow this keywords outside of classes or class-like objects.
|
|
312
315
|
* Https://typescript-eslint.io/rules/no-invalid-this.
|
|
313
316
|
*/
|
|
314
|
-
"no-invalid-this": "off",
|
|
315
|
-
"@typescript-eslint/no-invalid-this": baseRules.rules["no-invalid-this"],
|
|
317
|
+
// "no-invalid-this": "off",
|
|
318
|
+
// "@typescript-eslint/no-invalid-this": baseRules.rules["no-invalid-this"],
|
|
316
319
|
|
|
317
320
|
/**
|
|
318
321
|
* Disallow void type outside of generic or return types 🔒
|
|
319
322
|
* https://typescript-eslint.io/rules/no-invalid-void-type.
|
|
320
323
|
*/
|
|
321
|
-
"@typescript-eslint/no-invalid-void-type": "off",
|
|
324
|
+
// "@typescript-eslint/no-invalid-void-type": "off",
|
|
322
325
|
|
|
323
326
|
/**
|
|
324
327
|
* Disallow function declarations that contain unsafe references inside loop statements.
|
|
@@ -331,8 +334,8 @@ export default {
|
|
|
331
334
|
* Disallow magic numbers.
|
|
332
335
|
* Https://typescript-eslint.io/rules/no-magic-numbers.
|
|
333
336
|
*/
|
|
334
|
-
"no-magic-numbers": "off",
|
|
335
|
-
"@typescript-eslint/no-magic-numbers": baseRules.rules["no-magic-numbers"],
|
|
337
|
+
// "no-magic-numbers": "off",
|
|
338
|
+
// "@typescript-eslint/no-magic-numbers": baseRules.rules["no-magic-numbers"],
|
|
336
339
|
|
|
337
340
|
/**
|
|
338
341
|
* Disallow the void operator except when used to discard a value 🔒 🔧 💡 💭
|
|
@@ -432,7 +435,7 @@ export default {
|
|
|
432
435
|
* https://typescript-eslint.io/rules/no-unnecessary-condition.
|
|
433
436
|
* Turned off for now: a lot of false positives which breaks code!!
|
|
434
437
|
*/
|
|
435
|
-
"@typescript-eslint/no-unnecessary-condition": "off",
|
|
438
|
+
// "@typescript-eslint/no-unnecessary-condition": "off",
|
|
436
439
|
|
|
437
440
|
/**
|
|
438
441
|
* Disallow unnecessary namespace qualifiers 🔧 💭
|
|
@@ -469,20 +472,20 @@ export default {
|
|
|
469
472
|
* Off: catched by tsc
|
|
470
473
|
* https://typescript-eslint.io/rules/no-unsafe-assignment.
|
|
471
474
|
*/
|
|
472
|
-
"@typescript-eslint/no-unsafe-assignment": "off",
|
|
475
|
+
// "@typescript-eslint/no-unsafe-assignment": "off",
|
|
473
476
|
|
|
474
477
|
/**
|
|
475
478
|
* Disallow calling a value with type any ✅ 💭
|
|
476
479
|
* Off: gives too much false positive
|
|
477
480
|
* https://typescript-eslint.io/rules/no-unsafe-call.
|
|
478
481
|
*/
|
|
479
|
-
"@typescript-eslint/no-unsafe-call": "off",
|
|
482
|
+
// "@typescript-eslint/no-unsafe-call": "off",
|
|
480
483
|
|
|
481
484
|
/**
|
|
482
485
|
* Disallow member access on a value with type any ✅ 💭
|
|
483
486
|
* https://typescript-eslint.io/rules/no-unsafe-member-access.
|
|
484
487
|
*/
|
|
485
|
-
"@typescript-eslint/no-unsafe-member-access": "off",
|
|
488
|
+
// "@typescript-eslint/no-unsafe-member-access": "off",
|
|
486
489
|
|
|
487
490
|
/**
|
|
488
491
|
* Disallow returning a value with type any from a function ✅ 💭
|
|
@@ -552,7 +555,7 @@ export default {
|
|
|
552
555
|
* Require each enum member value to be explicitly initialized 💡
|
|
553
556
|
* https://typescript-eslint.io/rules/prefer-enum-initializers.
|
|
554
557
|
*/
|
|
555
|
-
"@typescript-eslint/prefer-enum-initializers": "off",
|
|
558
|
+
// "@typescript-eslint/prefer-enum-initializers": "off",
|
|
556
559
|
|
|
557
560
|
/**
|
|
558
561
|
* Enforce the use of for-of loop over the standard for loop where possible 🔒
|
|
@@ -588,7 +591,7 @@ export default {
|
|
|
588
591
|
* Enforce using the nullish coalescing operator instead of logical chaining 🔒 💡 💭
|
|
589
592
|
* https://typescript-eslint.io/rules/prefer-nullish-coalescing.
|
|
590
593
|
*/
|
|
591
|
-
"@typescript-eslint/prefer-nullish-coalescing": "off",
|
|
594
|
+
// "@typescript-eslint/prefer-nullish-coalescing": "off",
|
|
592
595
|
|
|
593
596
|
/**
|
|
594
597
|
* Enforce using concise optional chain expressions instead of chained logical ands 🔒 💡
|
|
@@ -606,7 +609,7 @@ export default {
|
|
|
606
609
|
* Require function parameters to be typed as readonly to prevent accidental mutation of inputs 💭
|
|
607
610
|
* https://typescript-eslint.io/rules/prefer-readonly-parameter-types.
|
|
608
611
|
*/
|
|
609
|
-
"@typescript-eslint/prefer-readonly-parameter-types": "off",
|
|
612
|
+
// "@typescript-eslint/prefer-readonly-parameter-types": "off",
|
|
610
613
|
|
|
611
614
|
/**
|
|
612
615
|
* Enforce using type parameter when calling Array#reduce instead of casting 🔒 🔧 💭
|
|
@@ -657,7 +660,7 @@ export default {
|
|
|
657
660
|
* Off: not really needed
|
|
658
661
|
* https://typescript-eslint.io/rules/restrict-plus-operands.
|
|
659
662
|
*/
|
|
660
|
-
"@typescript-eslint/restrict-plus-operands": "off",
|
|
663
|
+
// "@typescript-eslint/restrict-plus-operands": "off",
|
|
661
664
|
|
|
662
665
|
/**
|
|
663
666
|
* Enforce template literal expressions to be of string type ✅ 💭
|
|
@@ -669,13 +672,13 @@ export default {
|
|
|
669
672
|
* Enforce members of a type union/intersection to be sorted alphabetically 🔧 💡
|
|
670
673
|
* https://typescript-eslint.io/rules/sort-type-union-intersection-members.
|
|
671
674
|
*/
|
|
672
|
-
"@typescript-eslint/sort-type-union-intersection-members": "off",
|
|
675
|
+
// "@typescript-eslint/sort-type-union-intersection-members": "off",
|
|
673
676
|
|
|
674
677
|
/**
|
|
675
678
|
* Disallow certain types in boolean expressions 🔧 💡 💭
|
|
676
679
|
* https://typescript-eslint.io/rules/strict-boolean-expressions.
|
|
677
680
|
*/
|
|
678
|
-
"@typescript-eslint/strict-boolean-expressions": "off",
|
|
681
|
+
// "@typescript-eslint/strict-boolean-expressions": "off",
|
|
679
682
|
|
|
680
683
|
/**
|
|
681
684
|
* Require switch-case statements to be exhaustive with union type 💡 💭
|
|
@@ -707,7 +710,7 @@ export default {
|
|
|
707
710
|
* While this rule should be enabled, it gives to many problems with external libraries
|
|
708
711
|
* https://typescript-eslint.io/rules/unbound-method.
|
|
709
712
|
*/
|
|
710
|
-
"@typescript-eslint/unbound-method": "off",
|
|
713
|
+
// "@typescript-eslint/unbound-method": "off",
|
|
711
714
|
|
|
712
715
|
/**
|
|
713
716
|
* Disallow two overloads that could be unified into one with a union or an optional/rest parameter
|
|
@@ -735,19 +738,19 @@ export default {
|
|
|
735
738
|
},
|
|
736
739
|
],
|
|
737
740
|
|
|
738
|
-
"import/no-extraneous-dependencies": [
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
],
|
|
741
|
+
// "import/no-extraneous-dependencies": [
|
|
742
|
+
// importRules.rules["import/no-extraneous-dependencies"][0],
|
|
743
|
+
// {
|
|
744
|
+
// ...importRules.rules["import/no-extraneous-dependencies"][1],
|
|
745
|
+
// devDependencies: importRules.rules["import/no-extraneous-dependencies"][1].devDependencies.reduce(
|
|
746
|
+
// (result, devDep) => {
|
|
747
|
+
// const toAppend = [devDep];
|
|
748
|
+
// const devDepWithTs = devDep.replace(/\bjs(x?)\b/g, "ts$1");
|
|
749
|
+
// if (devDepWithTs !== devDep) toAppend.push(devDepWithTs);
|
|
750
|
+
// return [...result, ...toAppend];
|
|
751
|
+
// },
|
|
752
|
+
// ),
|
|
753
|
+
// },
|
|
754
|
+
// ],
|
|
752
755
|
},
|
|
753
756
|
};
|
|
@@ -30,13 +30,13 @@ export default {
|
|
|
30
30
|
* Forbidden test file pattern: default only "test" accepted
|
|
31
31
|
* https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/consistent-test-filename.md
|
|
32
32
|
*/
|
|
33
|
-
"vitest/consistent-test-filename": ["
|
|
33
|
+
"vitest/consistent-test-filename": ["warn", { pattern: ".*\\.test\\.[tj]sx?$" }],
|
|
34
34
|
|
|
35
35
|
/**
|
|
36
36
|
* Do not use conditionals to run tests
|
|
37
37
|
* https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/no-conditional-tests.md
|
|
38
38
|
*/
|
|
39
|
-
"vitest/no-conditional-tests": "off",
|
|
39
|
+
// "vitest/no-conditional-tests": "off",
|
|
40
40
|
|
|
41
41
|
/**
|
|
42
42
|
* Disallow importing node:test ✅ 🔧
|
|
@@ -48,25 +48,25 @@ export default {
|
|
|
48
48
|
* Disallow specific vi. methods
|
|
49
49
|
* https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/no-restricted-vi-methods.md
|
|
50
50
|
*/
|
|
51
|
-
"vitest/no-restricted-vi-methods": "off",
|
|
51
|
+
// "vitest/no-restricted-vi-methods": "off",
|
|
52
52
|
|
|
53
53
|
/**
|
|
54
54
|
* Suggest using toBeFalsy() 🔧
|
|
55
55
|
* https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/prefer-to-be-falsy.md
|
|
56
56
|
*/
|
|
57
|
-
"vitest/prefer-to-be-falsy)": "off",
|
|
57
|
+
// "vitest/prefer-to-be-falsy)": "off",
|
|
58
58
|
|
|
59
59
|
/**
|
|
60
60
|
* Prefer toBeObject() 🔧
|
|
61
61
|
* https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/prefer-to-be-object.md
|
|
62
62
|
*/
|
|
63
|
-
"vitest/prefer-to-be-object": "off",
|
|
63
|
+
// "vitest/prefer-to-be-object": "off",
|
|
64
64
|
|
|
65
65
|
/**
|
|
66
66
|
* Suggest using toBeTruthy 🔧
|
|
67
67
|
* https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/prefer-to-be-truthy.md
|
|
68
68
|
*/
|
|
69
|
-
"vitest/prefer-to-be-truthy": "off",
|
|
69
|
+
// "vitest/prefer-to-be-truthy": "off",
|
|
70
70
|
|
|
71
71
|
/**
|
|
72
72
|
* Require local Test Context for concurrent snapshot tests ✅
|
package/rules/test-rules.js
CHANGED
|
@@ -28,7 +28,7 @@ const rules = {
|
|
|
28
28
|
* Vitest: https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/max-expects.md
|
|
29
29
|
* Rule turned off: gives too many false positives
|
|
30
30
|
*/
|
|
31
|
-
"max-expects": ["off", { max: 10 }],
|
|
31
|
+
// "max-expects": ["off", { max: 10 }],
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
34
|
* Enforces a maximum depth to nested describe calls
|
|
@@ -63,7 +63,7 @@ const rules = {
|
|
|
63
63
|
* Jest: https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-conditional-in-test.md
|
|
64
64
|
* Vitest: https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/no-conditional-in-test.md
|
|
65
65
|
*/
|
|
66
|
-
"no-conditional-in-test": "off",
|
|
66
|
+
// "no-conditional-in-test": "off",
|
|
67
67
|
|
|
68
68
|
/**
|
|
69
69
|
* Disallow disabled tests ✅
|
|
@@ -91,7 +91,7 @@ const rules = {
|
|
|
91
91
|
* Jest: https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-hooks.md
|
|
92
92
|
* Vitest: https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/no-hooks.md
|
|
93
93
|
*/
|
|
94
|
-
"no-hooks": "off",
|
|
94
|
+
// "no-hooks": "off",
|
|
95
95
|
|
|
96
96
|
/**
|
|
97
97
|
* Disallow identical titles ✅
|
|
@@ -126,7 +126,7 @@ const rules = {
|
|
|
126
126
|
* Jest: https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-restricted-matchers.md
|
|
127
127
|
* Vitest: https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/no-restricted-matchers.md
|
|
128
128
|
*/
|
|
129
|
-
"no-restricted-matchers": "off",
|
|
129
|
+
// "no-restricted-matchers": "off",
|
|
130
130
|
|
|
131
131
|
/**
|
|
132
132
|
* Disallow using expect outside of it or test blocks ✅
|
|
@@ -168,7 +168,7 @@ const rules = {
|
|
|
168
168
|
* Jest: https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/prefer-each.md
|
|
169
169
|
* Vitest: https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/prefer-each.md
|
|
170
170
|
*/
|
|
171
|
-
"prefer-each": "off",
|
|
171
|
+
// "prefer-each": "off",
|
|
172
172
|
|
|
173
173
|
/**
|
|
174
174
|
* Suggest using the built-in equality matchers
|
|
@@ -182,7 +182,7 @@ const rules = {
|
|
|
182
182
|
* Jest: https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/prefer-expect-assertions.md
|
|
183
183
|
* Vitest: https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/prefer-expect-assertions.md
|
|
184
184
|
*/
|
|
185
|
-
"prefer-expect-assertions": "off",
|
|
185
|
+
// "prefer-expect-assertions": "off",
|
|
186
186
|
|
|
187
187
|
/**
|
|
188
188
|
* Suggest using expect().resolves over expect(await ...) syntax 🔧
|
|
@@ -222,7 +222,7 @@ const rules = {
|
|
|
222
222
|
* Jest: https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/prefer-snapshot-hint.md
|
|
223
223
|
* Vitest: https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/prefer-snapshot-hint.md
|
|
224
224
|
*/
|
|
225
|
-
"prefer-snapshot-hint": "off",
|
|
225
|
+
// "prefer-snapshot-hint": "off",
|
|
226
226
|
|
|
227
227
|
/**
|
|
228
228
|
* Suggest using .spyOn()
|
|
@@ -236,7 +236,7 @@ const rules = {
|
|
|
236
236
|
* Jest: https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/prefer-strict-equal.md
|
|
237
237
|
* Vitest https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/prefer-strict-equal.md
|
|
238
238
|
*/
|
|
239
|
-
"prefer-strict-equal": "off",
|
|
239
|
+
// "prefer-strict-equal": "off",
|
|
240
240
|
|
|
241
241
|
/**
|
|
242
242
|
* Suggest using toBe() for primitive literals 🔧
|
|
@@ -271,7 +271,7 @@ const rules = {
|
|
|
271
271
|
* Jest: https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/require-hook.md
|
|
272
272
|
* Vitest: https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/require-hook.md
|
|
273
273
|
*/
|
|
274
|
-
"require-hook": "off",
|
|
274
|
+
// "require-hook": "off",
|
|
275
275
|
|
|
276
276
|
/**
|
|
277
277
|
* Require a message for toThrow()
|
|
@@ -285,14 +285,14 @@ const rules = {
|
|
|
285
285
|
* Jest: https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/require-top-level-describe.md
|
|
286
286
|
* Vitest: https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/require-top-level-describe.md
|
|
287
287
|
*/
|
|
288
|
-
"require-top-level-describe": "off",
|
|
288
|
+
// "require-top-level-describe": "off",
|
|
289
289
|
|
|
290
290
|
/**
|
|
291
291
|
* Enforce unbound methods are called with their expected scope
|
|
292
292
|
* Jest: https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/unbound-method.md
|
|
293
293
|
* Vitest: https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/unbound-method.md
|
|
294
294
|
*/
|
|
295
|
-
"unbound-method": "off",
|
|
295
|
+
// "unbound-method": "off",
|
|
296
296
|
|
|
297
297
|
/**
|
|
298
298
|
* Enforce valid describe() ✅
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
plugins: {},
|
|
3
|
-
|
|
4
|
-
rules: {
|
|
5
|
-
// TODO: enable when compatible with eslint version 9
|
|
6
|
-
/**
|
|
7
|
-
* Enforce Rules of Hooks
|
|
8
|
-
* https://reactjs.org/docs/hooks-rules.html.
|
|
9
|
-
*/
|
|
10
|
-
// "react-hooks/rules-of-hooks": "error",
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Verify the list of the dependencies for Hooks like useEffect and similar
|
|
14
|
-
* https://reactjs.org/docs/hooks-rules.html.
|
|
15
|
-
*/
|
|
16
|
-
// "react-hooks/exhaustive-deps": "error",
|
|
17
|
-
},
|
|
18
|
-
};
|