@prowise/eslint-config-linting-rules 2.4.7 → 3.0.0
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/base.js +1 -1
- package/eslint.config.js +24 -6
- package/front-react.js +2 -2
- package/front-solid.js +0 -2
- package/next.js +2 -2
- package/package.json +1 -1
- package/rules/baseSettings.js +322 -624
- package/rules/file-progress.js +62 -0
- package/rules/jsdoc-newline-before-returns.js +48 -0
- package/rules/jsdoc-optional-param-brackets.js +351 -0
- package/rules/jsdoc-single-line.js +44 -0
- package/rules/jsx-pascal-case-rule.js +1 -1
- package/rules/plugin-import-rules.js +13 -192
- package/rules/plugin-jsdoc-rules.js +81 -116
- package/rules/plugin-jsx-a11y-rules.js +1 -1
- package/rules/plugin-next-rules.js +28 -36
- package/rules/plugin-node-rules.js +72 -36
- package/rules/plugin-react-rules.js +111 -627
- package/rules/plugin-stylistic-rules.js +126 -84
- package/rules/plugin-typescript-rules.js +90 -200
- package/rules/plugin-vitest-rules.js +209 -21
- package/eslint.back.js +0 -9
- package/rules/plugin-solid-rules.js +0 -136
- package/rules/test-rules.js +0 -331
package/rules/test-rules.js
DELETED
|
@@ -1,331 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* ✅ recommended
|
|
3
|
-
* 🔧 fixable
|
|
4
|
-
* 💡 has suggestion
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Rules for both test frameworks
|
|
9
|
-
*/
|
|
10
|
-
const rules = {
|
|
11
|
-
/**
|
|
12
|
-
* Enforce the usage of "it" and "test" 🔧
|
|
13
|
-
* Jest: https://github.com/jest-community/eslint-plugin-jest/blob/HEAD/docs/rules/consistent-test-it.md
|
|
14
|
-
* Vitest: https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/consistent-test-it.md
|
|
15
|
-
*/
|
|
16
|
-
"consistent-test-it": ["warn", { fn: "test", withinDescribe: "it" }],
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Enforce to use an expectation in the test body. ✅
|
|
20
|
-
* Jest: https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/expect-expect.md
|
|
21
|
-
* Vitest: https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/expect-expect.md
|
|
22
|
-
*/
|
|
23
|
-
"expect-expect": "error",
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Enforces a maximum number assertion calls in a test body
|
|
27
|
-
* Jest: https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/max-expects.md
|
|
28
|
-
* Vitest: https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/max-expects.md
|
|
29
|
-
* Rule turned off: gives too many false positives
|
|
30
|
-
*/
|
|
31
|
-
// "max-expects": ["off", { max: 10 }],
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Enforces a maximum depth to nested describe calls
|
|
35
|
-
* Jest: https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/max-nested-describe.md
|
|
36
|
-
* Vitest: https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/max-nested-describe.md
|
|
37
|
-
*/
|
|
38
|
-
"max-nested-describe": ["warn", { max: 5 }],
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Disallow alias methods ✅ 🔧
|
|
42
|
-
* Jest: https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-alias-methods.md
|
|
43
|
-
* Vitest: https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/no-alias-methods.md
|
|
44
|
-
*/
|
|
45
|
-
"no-alias-methods": "warn",
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Disallow commented out tests ✅
|
|
49
|
-
* Jest: https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-commented-out-tests.md
|
|
50
|
-
* Vitest: https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/no-commented-out-tests.md
|
|
51
|
-
*/
|
|
52
|
-
"no-commented-out-tests": "error",
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Disallow expects in a conditional block ✅
|
|
56
|
-
* Jest: https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-conditional-expect.md
|
|
57
|
-
* Vitest: https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/no-conditional-expect.md
|
|
58
|
-
*/
|
|
59
|
-
"no-conditional-expect": "error",
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Disallow conditionals in a test block
|
|
63
|
-
* Jest: https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-conditional-in-test.md
|
|
64
|
-
* Vitest: https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/no-conditional-in-test.md
|
|
65
|
-
*/
|
|
66
|
-
// "no-conditional-in-test": "off",
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Disallow disabled tests ✅
|
|
70
|
-
* Jest: https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-disabled-tests.md
|
|
71
|
-
* Vitest: https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/no-disabled-tests.md
|
|
72
|
-
*/
|
|
73
|
-
"no-disabled-tests": "warn",
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Disallow duplicate setup and teardown hooks
|
|
77
|
-
* Jest: https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-duplicate-hooks.md
|
|
78
|
-
* Vitest: https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/no-duplicate-hooks.md
|
|
79
|
-
*/
|
|
80
|
-
"no-duplicate-hooks": "error",
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* Disallow focused tests
|
|
84
|
-
* Jest: https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-focused-tests.md
|
|
85
|
-
* Vitest: https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/no-focused-tests.md
|
|
86
|
-
*/
|
|
87
|
-
"no-focused-tests": "error",
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Disallow setup and teardown hooks
|
|
91
|
-
* Jest: https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-hooks.md
|
|
92
|
-
* Vitest: https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/no-hooks.md
|
|
93
|
-
*/
|
|
94
|
-
// "no-hooks": "off",
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* Disallow identical titles ✅
|
|
98
|
-
* Jest: https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-identical-title.md
|
|
99
|
-
* Vitest: https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/no-identical-title.md
|
|
100
|
-
*/
|
|
101
|
-
"no-identical-title": "error",
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* Disallow string interpolation inside snapshots ✅
|
|
105
|
-
* Jest: https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-interpolation-in-snapshots.md
|
|
106
|
-
* Vitest: https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/no-interpolation-in-snapshots.md
|
|
107
|
-
*/
|
|
108
|
-
"no-interpolation-in-snapshots": "warn",
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* Disallow large snapshots
|
|
112
|
-
* Jest: https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-large-snapshots.md
|
|
113
|
-
* Vitest: https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/no-large-snapshots.md
|
|
114
|
-
*/
|
|
115
|
-
"no-large-snapshots": ["error", { maxSize: 30, inlineMaxSize: 10 }],
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* Disallow manually importing from __mocks__ ✅
|
|
119
|
-
* Jest: https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-mocks-import.md
|
|
120
|
-
* Vitest: https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/no-mocks-import.md
|
|
121
|
-
*/
|
|
122
|
-
"no-mocks-import": "error",
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
* Disallow specific matchers & modifiers
|
|
126
|
-
* Jest: https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-restricted-matchers.md
|
|
127
|
-
* Vitest: https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/no-restricted-matchers.md
|
|
128
|
-
*/
|
|
129
|
-
// "no-restricted-matchers": "off",
|
|
130
|
-
|
|
131
|
-
/**
|
|
132
|
-
* Disallow using expect outside of it or test blocks ✅
|
|
133
|
-
* Jest: https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-standalone-expect.md
|
|
134
|
-
* Vitest: https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/no-standalone-expect.md
|
|
135
|
-
*/
|
|
136
|
-
"no-standalone-expect": "error",
|
|
137
|
-
|
|
138
|
-
/**
|
|
139
|
-
* Disallow using any prefixed to skip tests ✅ 🔧
|
|
140
|
-
* Jest: https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-test-prefixes.md
|
|
141
|
-
* Vitest: https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/no-test-prefixes.md
|
|
142
|
-
*/
|
|
143
|
-
"no-test-prefixes": "error",
|
|
144
|
-
|
|
145
|
-
/**
|
|
146
|
-
* Disallow explicitly returning from tests
|
|
147
|
-
* Jest: https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/no-test-return-statement.md
|
|
148
|
-
* Vitest: https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/no-test-return-statement.md
|
|
149
|
-
*/
|
|
150
|
-
"no-test-return-statement": "error",
|
|
151
|
-
|
|
152
|
-
/**
|
|
153
|
-
* Suggest using toBeCalledWith() or toHaveBeenCalledWith()
|
|
154
|
-
* Jest: https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/prefer-called-with.md
|
|
155
|
-
* Vitest: https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/prefer-called-with.md
|
|
156
|
-
*/
|
|
157
|
-
"prefer-called-with": "warn",
|
|
158
|
-
|
|
159
|
-
/**
|
|
160
|
-
* Suggest using the built-in comparison matchers
|
|
161
|
-
* Jest: https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/prefer-comparison-matcher.md
|
|
162
|
-
* Vitest: https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/prefer-comparison-matcher.md
|
|
163
|
-
*/
|
|
164
|
-
"prefer-comparison-matcher": "warn",
|
|
165
|
-
|
|
166
|
-
/**
|
|
167
|
-
* Prefer using .each rather than manual loops
|
|
168
|
-
* Jest: https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/prefer-each.md
|
|
169
|
-
* Vitest: https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/prefer-each.md
|
|
170
|
-
*/
|
|
171
|
-
// "prefer-each": "off",
|
|
172
|
-
|
|
173
|
-
/**
|
|
174
|
-
* Suggest using the built-in equality matchers
|
|
175
|
-
* Jest: https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/prefer-equality-matcher.md
|
|
176
|
-
* Vitest: https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/prefer-equality-matcher.md
|
|
177
|
-
*/
|
|
178
|
-
"prefer-equality-matcher": "warn",
|
|
179
|
-
|
|
180
|
-
/**
|
|
181
|
-
* Suggest using expect assertions instead of callbacks
|
|
182
|
-
* Jest: https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/prefer-expect-assertions.md
|
|
183
|
-
* Vitest: https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/prefer-expect-assertions.md
|
|
184
|
-
*/
|
|
185
|
-
// "prefer-expect-assertions": "off",
|
|
186
|
-
|
|
187
|
-
/**
|
|
188
|
-
* Suggest using expect().resolves over expect(await ...) syntax 🔧
|
|
189
|
-
* Jest: https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/prefer-expect-resolves.md
|
|
190
|
-
* Vitest: https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/prefer-expect-resolves.md
|
|
191
|
-
*/
|
|
192
|
-
"prefer-expect-resolves": "warn",
|
|
193
|
-
|
|
194
|
-
/**
|
|
195
|
-
* Prefer having hooks in consistent order
|
|
196
|
-
* Jest: https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/prefer-hooks-in-order.md
|
|
197
|
-
* Vitest: https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/prefer-hooks-in-order.md
|
|
198
|
-
*/
|
|
199
|
-
"prefer-hooks-in-order": "warn",
|
|
200
|
-
|
|
201
|
-
/**
|
|
202
|
-
* Suggest having hooks before any test cases
|
|
203
|
-
* Jest: https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/prefer-hooks-on-top.md
|
|
204
|
-
* Vitest: https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/prefer-hooks-on-top.md
|
|
205
|
-
*/
|
|
206
|
-
"prefer-hooks-on-top": "warn",
|
|
207
|
-
|
|
208
|
-
/**
|
|
209
|
-
* Enforce lowercase test names
|
|
210
|
-
*/
|
|
211
|
-
"prefer-lowercase-title": ["warn", { ignore: ["describe", "test"] }],
|
|
212
|
-
|
|
213
|
-
/**
|
|
214
|
-
* Prefer mock resolved/rejected shorthands for promises 🔧
|
|
215
|
-
* Jest: https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/prefer-mock-promise-shorthand.md
|
|
216
|
-
* Vitest: https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/prefer-mock-promise-shorthand.md
|
|
217
|
-
*/
|
|
218
|
-
"prefer-mock-promise-shorthand": "warn",
|
|
219
|
-
|
|
220
|
-
/**
|
|
221
|
-
* Prefer including a hint with external snapshots
|
|
222
|
-
* Jest: https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/prefer-snapshot-hint.md
|
|
223
|
-
* Vitest: https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/prefer-snapshot-hint.md
|
|
224
|
-
*/
|
|
225
|
-
// "prefer-snapshot-hint": "off",
|
|
226
|
-
|
|
227
|
-
/**
|
|
228
|
-
* Suggest using .spyOn()
|
|
229
|
-
* Jest: https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/prefer-spy-on.md
|
|
230
|
-
* Vitest: https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/prefer-spy-on.md
|
|
231
|
-
*/
|
|
232
|
-
"prefer-spy-on": "warn",
|
|
233
|
-
|
|
234
|
-
/**
|
|
235
|
-
* Prefer strict equal over equal
|
|
236
|
-
* Jest: https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/prefer-strict-equal.md
|
|
237
|
-
* Vitest https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/prefer-strict-equal.md
|
|
238
|
-
*/
|
|
239
|
-
// "prefer-strict-equal": "off",
|
|
240
|
-
|
|
241
|
-
/**
|
|
242
|
-
* Suggest using toBe() for primitive literals 🔧
|
|
243
|
-
* Jest: https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/prefer-to-be.md
|
|
244
|
-
* Vitest: https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/prefer-to-be.md
|
|
245
|
-
*/
|
|
246
|
-
"prefer-to-be": "warn",
|
|
247
|
-
|
|
248
|
-
/**
|
|
249
|
-
* Suggest using toContain() 🔧
|
|
250
|
-
* Jest: https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/prefer-to-contain.md
|
|
251
|
-
* Vitest: https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/prefer-to-contain.md
|
|
252
|
-
*/
|
|
253
|
-
"prefer-to-contain": "warn",
|
|
254
|
-
|
|
255
|
-
/**
|
|
256
|
-
* Suggest using toHaveLength() 🔧
|
|
257
|
-
* Jest: https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/prefer-to-have-length.md
|
|
258
|
-
* Vitest: https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/prefer-to-have-length.md
|
|
259
|
-
*/
|
|
260
|
-
"prefer-to-have-length": "warn",
|
|
261
|
-
|
|
262
|
-
/**
|
|
263
|
-
* Suggest using test.todo 🔧
|
|
264
|
-
* Jest: https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/prefer-todo.md
|
|
265
|
-
* Vitest: https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/prefer-todo.md
|
|
266
|
-
*/
|
|
267
|
-
"prefer-todo": "warn",
|
|
268
|
-
|
|
269
|
-
/**
|
|
270
|
-
* Require setup and teardown code to be within a hook
|
|
271
|
-
* Jest: https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/require-hook.md
|
|
272
|
-
* Vitest: https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/require-hook.md
|
|
273
|
-
*/
|
|
274
|
-
// "require-hook": "off",
|
|
275
|
-
|
|
276
|
-
/**
|
|
277
|
-
* Require a message for toThrow()
|
|
278
|
-
* Jest: https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/require-to-throw-message.md
|
|
279
|
-
* Vitest: https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/require-hook.md
|
|
280
|
-
*/
|
|
281
|
-
"require-to-throw-message": "warn",
|
|
282
|
-
|
|
283
|
-
/**
|
|
284
|
-
* Require test cases and hooks to be inside a describe block
|
|
285
|
-
* Jest: https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/require-top-level-describe.md
|
|
286
|
-
* Vitest: https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/require-top-level-describe.md
|
|
287
|
-
*/
|
|
288
|
-
// "require-top-level-describe": "off",
|
|
289
|
-
|
|
290
|
-
/**
|
|
291
|
-
* Enforce unbound methods are called with their expected scope
|
|
292
|
-
* Jest: https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/unbound-method.md
|
|
293
|
-
* Vitest: https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/unbound-method.md
|
|
294
|
-
*/
|
|
295
|
-
// "unbound-method": "off",
|
|
296
|
-
|
|
297
|
-
/**
|
|
298
|
-
* Enforce valid describe() ✅
|
|
299
|
-
* Jest: https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/valid-describe-callback.md
|
|
300
|
-
* Vitest: https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/valid-describe-callback.md
|
|
301
|
-
*/
|
|
302
|
-
"valid-describe-callback": "error",
|
|
303
|
-
|
|
304
|
-
/**
|
|
305
|
-
* Enforce valid expect() usage ✅
|
|
306
|
-
* Jest: https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/valid-expect.md
|
|
307
|
-
* Vitest: https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/valid-expect.md
|
|
308
|
-
*/
|
|
309
|
-
"valid-expect": ["error", { alwaysAwait: true, asyncMatchers: ["toBeResolved", "toBeRejected"] }],
|
|
310
|
-
|
|
311
|
-
/**
|
|
312
|
-
* Enforce valid titles ✅ 🔧
|
|
313
|
-
* Jest: https://github.com/jest-community/eslint-plugin-jest/blob/main/docs/rules/valid-title.md
|
|
314
|
-
* Vitest: https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/valid-title.md
|
|
315
|
-
*/
|
|
316
|
-
"valid-title": "error",
|
|
317
|
-
};
|
|
318
|
-
|
|
319
|
-
/**
|
|
320
|
-
* Make the global test rules readable for the jest/vitest plugin.
|
|
321
|
-
*
|
|
322
|
-
* @param framework Used test framework
|
|
323
|
-
* @returns Testing rules.
|
|
324
|
-
*/
|
|
325
|
-
export function commonRules(framework) {
|
|
326
|
-
const updated = {};
|
|
327
|
-
for (const key in rules) {
|
|
328
|
-
updated[`${framework}/${key}`] = rules[key];
|
|
329
|
-
}
|
|
330
|
-
return updated;
|
|
331
|
-
}
|