@jpp-toolkit/eslint-config 0.0.11

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.
@@ -0,0 +1,536 @@
1
+ import vitest from '@vitest/eslint-plugin';
2
+ import { defineConfig } from 'eslint/config';
3
+
4
+ /**
5
+ * Vitest configuration.
6
+ * @see {@link https://github.com/vitest-dev/eslint-plugin-vitest}
7
+ */
8
+ export const vitestConfig = defineConfig({
9
+ name: 'vitest-config',
10
+ files: ['**/*.{spec,test}.{js,jsx,ts,tsx}'],
11
+ extends: [vitest.configs.recommended],
12
+ settings: {
13
+ vitest: {
14
+ typecheck: true,
15
+ },
16
+ },
17
+ languageOptions: {
18
+ globals: {
19
+ ...vitest.environments.env.globals,
20
+ },
21
+ },
22
+ rules: {
23
+ /**
24
+ * Require test file pattern.
25
+ * @see {@link https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/consistent-test-filename.md}
26
+ */
27
+ // 'vitest/consistent-test-filename': 'error',
28
+
29
+ /**
30
+ * Enforce using test or it but not both.
31
+ * @fixable
32
+ * @see {@link https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/consistent-test-it.md}
33
+ */
34
+ 'vitest/consistent-test-it': ['error', { fn: 'it' }],
35
+
36
+ /**
37
+ * Enforce using vitest or vi but not both.
38
+ * @fixable
39
+ * @see {@link https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/consistent-vitest-vi.md}
40
+ */
41
+ // 'vitest/consistent-vitest-vi': 'error',
42
+
43
+ /**
44
+ * Enforce hoisted APIs to be on top of the file.
45
+ * @see {@link https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/hoisted-apis-on-top.md}
46
+ */
47
+ // 'vitest/hoisted-apis-on-top': 'error',
48
+
49
+ /**
50
+ * Enforce a maximum number of expect per test.
51
+ * @see {@link https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/max-expects.md}
52
+ */
53
+ // 'vitest/max-expects': 'error',
54
+
55
+ /**
56
+ * Require describe block to be less than set max value or default value.
57
+ * @see {@link https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/max-nested-describe.md}
58
+ */
59
+ // 'vitest/max-nested-describe': 'error',
60
+
61
+ /**
62
+ * Disallow alias methods.
63
+ * @fixable
64
+ * @see {@link https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-alias-methods.md}
65
+ */
66
+ // 'vitest/no-alias-methods': 'error',
67
+
68
+ /**
69
+ * Disallow conditional expects.
70
+ * @see {@link https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-conditional-expect.md}
71
+ */
72
+ // 'vitest/no-conditional-expect': 'error',
73
+
74
+ /**
75
+ * Disallow conditional tests.
76
+ * @see {@link https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-conditional-in-test.md}
77
+ */
78
+ 'vitest/no-conditional-in-test': 'error',
79
+
80
+ /**
81
+ * Disallow conditional tests.
82
+ * @see {@link https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-conditional-tests.md}
83
+ */
84
+ // 'vitest/no-conditional-tests': 'error',
85
+
86
+ /**
87
+ * Disallow disabled tests.
88
+ * @see {@link https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-disabled-tests.md}
89
+ */
90
+ // 'vitest/no-disabled-tests': 'error',
91
+
92
+ /**
93
+ * Disallow using a callback in asynchronous tests and hooks.
94
+ * @see {@link https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-done-callback.md}
95
+ */
96
+ // 'vitest/no-done-callback': 'error',
97
+
98
+ /**
99
+ * Disallow duplicate hooks and teardown hooks.
100
+ * @see {@link https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-duplicate-hooks.md}
101
+ */
102
+ 'vitest/no-duplicate-hooks': 'error',
103
+
104
+ /**
105
+ * Disallow focused tests.
106
+ * @fixable
107
+ * @see {@link https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-focused-tests.md}
108
+ */
109
+ // 'vitest/no-focused-tests': 'error',
110
+
111
+ /**
112
+ * Disallow setup and teardown hooks.
113
+ * @see {@link https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-hooks.md}
114
+ */
115
+ // 'vitest/no-hooks': 'error',
116
+
117
+ /**
118
+ * Disallow importing Vitest globals.
119
+ * @fixable
120
+ * @see {@link https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-importing-vitest-globals.md}
121
+ */
122
+ // 'vitest/no-importing-vitest-globals': 'error',
123
+
124
+ /**
125
+ * Disallow string interpolation in snapshots.
126
+ * @fixable
127
+ * @see {@link https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-interpolation-in-snapshots.md}
128
+ */
129
+ // 'vitest/no-interpolation-in-snapshots': 'error',
130
+
131
+ /**
132
+ * Disallow large snapshots.
133
+ * @see {@link https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-large-snapshots.md}
134
+ */
135
+ // 'vitest/no-large-snapshots': 'error',
136
+
137
+ /**
138
+ * Disallow importing from mocks directory.
139
+ * @see {@link https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-mocks-import.md}
140
+ */
141
+ // 'vitest/no-mocks-import': 'error',
142
+
143
+ /**
144
+ * Disallow the use of certain matchers.
145
+ * @see {@link https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-restricted-matchers.md}
146
+ */
147
+ // 'vitest/no-restricted-matchers': 'error',
148
+
149
+ /**
150
+ * Disallow specific vi. methods.
151
+ * @see {@link https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-restricted-vi-methods.md}
152
+ */
153
+ // 'vitest/no-restricted-vi-methods': 'error',
154
+
155
+ /**
156
+ * Disallow using expect outside of it or test blocks.
157
+ * @see {@link https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-standalone-expect.md}
158
+ */
159
+ // 'vitest/no-standalone-expect': 'error',
160
+
161
+ /**
162
+ * Disallow using the f and x prefixes in favour of .only and .skip.
163
+ * @fixable
164
+ * @see {@link https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-test-prefixes.md}
165
+ */
166
+ // 'vitest/no-test-prefixes': 'error',
167
+
168
+ /**
169
+ * Disallow return statements in tests.
170
+ * @see {@link https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-test-return-statement.md}
171
+ */
172
+ 'vitest/no-test-return-statement': 'error',
173
+
174
+ /**
175
+ * Enforce padding around afterAll blocks.
176
+ * @fixable
177
+ * @see {@link https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/padding-around-after-all-blocks.md}
178
+ */
179
+ // 'vitest/padding-around-after-all-blocks': 'error',
180
+
181
+ /**
182
+ * Enforce padding around afterEach blocks.
183
+ * @fixable
184
+ * @see {@link https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/padding-around-after-each-blocks.md}
185
+ */
186
+ // 'vitest/padding-around-after-each-blocks': 'error',
187
+
188
+ /**
189
+ * Enforce padding around vitest functions.
190
+ * @fixable
191
+ * @see {@link https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/padding-around-all.md}
192
+ */
193
+ 'vitest/padding-around-all': 'error',
194
+
195
+ /**
196
+ * Enforce padding around beforeAll blocks.
197
+ * @fixable
198
+ * @see {@link https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/padding-around-before-all-blocks.md}
199
+ */
200
+ // 'vitest/padding-around-before-all-blocks': 'error',
201
+
202
+ /**
203
+ * Enforce padding around beforeEach blocks.
204
+ * @fixable
205
+ * @see {@link https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/padding-around-before-each-blocks.md}
206
+ */
207
+ // 'vitest/padding-around-before-each-blocks': 'error',
208
+
209
+ /**
210
+ * Enforce padding around describe blocks.
211
+ * @fixable
212
+ * @see {@link https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/padding-around-describe-blocks.md}
213
+ */
214
+ // 'vitest/padding-around-describe-blocks': 'error',
215
+
216
+ /**
217
+ * Enforce padding around expect groups.
218
+ * @fixable
219
+ * @see {@link https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/padding-around-expect-groups.md}
220
+ */
221
+ // 'vitest/padding-around-expect-groups': 'error',
222
+
223
+ /**
224
+ * Enforce padding around test blocks.
225
+ * @fixable
226
+ * @see {@link https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/padding-around-test-blocks.md}
227
+ */
228
+ // 'vitest/padding-around-test-blocks': 'error',
229
+
230
+ /**
231
+ * Enforce using toBeCalledOnce() or toHaveBeenCalledOnce().
232
+ * @fixable
233
+ * @see {@link https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-called-once.md}
234
+ */
235
+ // 'vitest/prefer-called-once': 'error',
236
+
237
+ /**
238
+ * Enforce using toBeCalledTimes(1) or toHaveBeenCalledTimes(1).
239
+ * @fixable
240
+ * @see {@link https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-called-times.md}
241
+ */
242
+ // 'vitest/prefer-called-times': 'error',
243
+
244
+ /**
245
+ * Enforce using toBeCalledWith() or toHaveBeenCalledWith().
246
+ * @fixable
247
+ * @see {@link https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-called-with.md}
248
+ */
249
+ 'vitest/prefer-called-with': 'error',
250
+
251
+ /**
252
+ * Enforce using the built-in comparison matchers.
253
+ * @fixable
254
+ * @see {@link https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-comparison-matcher.md}
255
+ */
256
+ 'vitest/prefer-comparison-matcher': 'error',
257
+
258
+ /**
259
+ * Enforce using a function as a describe title over an equivalent string.
260
+ * @fixable
261
+ * @see {@link https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-describe-function-title.md}
262
+ */
263
+ // 'vitest/prefer-describe-function-title': 'error',
264
+
265
+ /**
266
+ * Enforce using each rather than manual loops.
267
+ * @see {@link https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-each.md}
268
+ */
269
+ 'vitest/prefer-each': 'error',
270
+
271
+ /**
272
+ * Enforce using the built-in quality matchers.
273
+ * @see {@link https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-equality-matcher.md}
274
+ */
275
+ 'vitest/prefer-equality-matcher': 'error',
276
+
277
+ /**
278
+ * Enforce using expect assertions instead of callbacks.
279
+ * @see {@link https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-expect-assertions.md}
280
+ */
281
+ 'vitest/prefer-expect-assertions': 'error',
282
+
283
+ /**
284
+ * Enforce using expect().resolves over expect(await ...) syntax.
285
+ * @fixable
286
+ * @see {@link https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-expect-resolves.md}
287
+ */
288
+ 'vitest/prefer-expect-resolves': 'error',
289
+
290
+ /**
291
+ * Enforce using expectTypeOf instead of expect(typeof ...).
292
+ * @fixable
293
+ * @see {@link https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-expect-type-of.md}
294
+ */
295
+ // 'vitest/prefer-expect-type-of': 'error',
296
+
297
+ /**
298
+ * Enforce having hooks in consistent order.
299
+ * @see {@link https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-hooks-in-order.md}
300
+ */
301
+ 'vitest/prefer-hooks-in-order': 'error',
302
+
303
+ /**
304
+ * Enforce having hooks before any test cases.
305
+ * @see {@link https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-hooks-on-top.md}
306
+ */
307
+ 'vitest/prefer-hooks-on-top': 'error',
308
+
309
+ /**
310
+ * Prefer dynamic import in mock.
311
+ * @fixable
312
+ * @see {@link https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-import-in-mock.md}
313
+ */
314
+ // 'vitest/prefer-import-in-mock': 'error',
315
+
316
+ /**
317
+ * Enforce importing Vitest globals.
318
+ * @fixable
319
+ * @see {@link https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-importing-vitest-globals.md}
320
+ */
321
+ // 'vitest/prefer-importing-vitest-globals': 'error',
322
+
323
+ /**
324
+ * Enforce lowercase titles.
325
+ * @fixable
326
+ * @see {@link https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-lowercase-title.md}
327
+ */
328
+ 'vitest/prefer-lowercase-title': ['error', { ignore: ['describe'] }],
329
+
330
+ /**
331
+ * Enforce mock resolved/rejected shorthands for promises.
332
+ * @fixable
333
+ * @see {@link https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-mock-promise-shorthand.md}
334
+ */
335
+ 'vitest/prefer-mock-promise-shorthand': 'error',
336
+
337
+ /**
338
+ * Enforce including a hint with external snapshots.
339
+ * @see {@link https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-snapshot-hint.md}
340
+ */
341
+ 'vitest/prefer-snapshot-hint': 'error',
342
+
343
+ /**
344
+ * Enforce using vi.spyOn.
345
+ * @fixable
346
+ * @see {@link https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-spy-on.md}
347
+ */
348
+ 'vitest/prefer-spy-on': 'error',
349
+
350
+ /**
351
+ * Enforce using toBe(true) and toBe(false) over matchers that coerce types to boolean.
352
+ * @fixable
353
+ * @see {@link https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-strict-boolean-matchers.md}
354
+ */
355
+ // 'vitest/prefer-strict-boolean-matchers': 'error',
356
+
357
+ /**
358
+ * Enforce strict equal over equal.
359
+ * @see {@link https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-strict-equal.md}
360
+ */
361
+ 'vitest/prefer-strict-equal': 'error',
362
+
363
+ /**
364
+ * Enforce using toBe().
365
+ * @fixable
366
+ * @see {@link https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-to-be.md}
367
+ */
368
+ // 'vitest/prefer-to-be': 'error',
369
+
370
+ /**
371
+ * Enforce using toBeFalsy().
372
+ * @fixable
373
+ * @see {@link https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-to-be-falsy.md}
374
+ */
375
+ // 'vitest/prefer-to-be-falsy': 'error',
376
+
377
+ /**
378
+ * Enforce using toBeObject().
379
+ * @fixable
380
+ * @see {@link https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-to-be-object.md}
381
+ */
382
+ // 'vitest/prefer-to-be-object': 'error',
383
+
384
+ /**
385
+ * Enforce using toBeTruthy.
386
+ * @fixable
387
+ * @see {@link https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-to-be-truthy.md}
388
+ */
389
+ // 'vitest/prefer-to-be-truthy': 'error',
390
+
391
+ /**
392
+ * Enforce using toContain().
393
+ * @fixable
394
+ * @see {@link https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-to-contain.md}
395
+ */
396
+ // 'vitest/prefer-to-contain': 'error',
397
+
398
+ /**
399
+ * Enforce using toHaveLength().
400
+ * @fixable
401
+ * @see {@link https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-to-have-length.md}
402
+ */
403
+ // 'vitest/prefer-to-have-length': 'error',
404
+
405
+ /**
406
+ * Enforce using test.todo.
407
+ * @fixable
408
+ * @see {@link https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-todo.md}
409
+ */
410
+ 'vitest/prefer-todo': 'error',
411
+
412
+ /**
413
+ * Require vi.mocked() over fn as Mock.
414
+ * @fixable
415
+ * @typeChecked
416
+ * @see {@link https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-vi-mocked.md}
417
+ */
418
+ 'vitest/prefer-vi-mocked': 'error',
419
+
420
+ /**
421
+ * Ensure that every expect.poll call is awaited.
422
+ * @see {@link https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/require-awaited-expect-poll.md}
423
+ */
424
+ // 'vitest/require-awaited-expect-poll': 'error',
425
+
426
+ /**
427
+ * Require setup and teardown to be within a hook.
428
+ * @see {@link https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/require-hook.md}
429
+ */
430
+ // 'vitest/require-hook': 'error',
431
+
432
+ /**
433
+ * Enforce using type parameters with vitest mock functions.
434
+ * @fixable
435
+ * @see {@link https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/require-mock-type-parameters.md}
436
+ */
437
+ // 'vitest/require-mock-type-parameters': 'error',
438
+
439
+ /**
440
+ * Require toThrow() to be called with an error message.
441
+ * @see {@link https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/require-to-throw-message.md}
442
+ */
443
+ 'vitest/require-to-throw-message': 'error',
444
+
445
+ /**
446
+ * Enforce that all tests are in a top-level describe.
447
+ * @see {@link https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/require-top-level-describe.md}
448
+ */
449
+ 'vitest/require-top-level-describe': 'error',
450
+
451
+ /**
452
+ * Require promises that have expectations in their chain to be valid.
453
+ * @see {@link https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/valid-expect-in-promise.md}
454
+ */
455
+ // 'vitest/valid-expect-in-promise': 'error',
456
+
457
+ /**
458
+ * Disallow .todo usage.
459
+ * @see {@link https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/warn-todo.md}
460
+ */
461
+ // 'vitest/warn-todo': 'error',
462
+
463
+ /**
464
+ * Enforce having expectation in test body.
465
+ * @config recommended
466
+ * @see {@link https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/expect-expect.md}
467
+ */
468
+ // 'vitest/expect-expect': 'off',
469
+
470
+ /**
471
+ * Disallow commented out tests.
472
+ * @config recommended
473
+ * @see {@link https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-commented-out-tests.md}
474
+ */
475
+ // 'vitest/no-commented-out-tests': 'off',
476
+
477
+ /**
478
+ * Disallow identical titles.
479
+ * @config recommended
480
+ * @fixable
481
+ * @see {@link https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-identical-title.md}
482
+ */
483
+ // 'vitest/no-identical-title': 'off',
484
+
485
+ /**
486
+ * Disallow importing node:test.
487
+ * @config recommended
488
+ * @fixable
489
+ * @see {@link https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-import-node-test.md}
490
+ */
491
+ // 'vitest/no-import-node-test': 'off',
492
+
493
+ /**
494
+ * Prefer toHaveBeenCalledExactlyOnceWith over toHaveBeenCalledOnce and toHaveBeenCalledWith.
495
+ * @config recommended
496
+ * @fixable
497
+ * @see {@link https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-called-exactly-once-with.md}
498
+ */
499
+ // 'vitest/prefer-called-exactly-once-with': 'off',
500
+
501
+ /**
502
+ * Require local Test Context for concurrent snapshot tests.
503
+ * @config recommended
504
+ * @see {@link https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/require-local-test-context-for-concurrent-snapshots.md}
505
+ */
506
+ // 'vitest/require-local-test-context-for-concurrent-snapshots': 'off',
507
+
508
+ /**
509
+ * Enforce valid describe callback.
510
+ * @config recommended
511
+ * @see {@link https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/valid-describe-callback.md}
512
+ */
513
+ // 'vitest/valid-describe-callback': 'off',
514
+
515
+ /**
516
+ * Enforce valid expect() usage.
517
+ * @config recommended
518
+ * @fixable
519
+ * @see {@link https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/valid-expect.md}
520
+ */
521
+ // 'vitest/valid-expect': 'off',
522
+
523
+ /**
524
+ * Enforce valid titles.
525
+ * @config recommended
526
+ * @fixable
527
+ * @see {@link https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/valid-title.md}
528
+ */
529
+ 'vitest/valid-title': [
530
+ 'error',
531
+ {
532
+ mustMatch: { test: '^should' },
533
+ },
534
+ ],
535
+ },
536
+ });
package/src/index.ts ADDED
@@ -0,0 +1,73 @@
1
+ import { defineConfig } from 'eslint/config';
2
+ import type { Config } from 'eslint/config';
3
+ import globals from 'globals';
4
+
5
+ import { eslintConfig } from './configs/eslint-config';
6
+ import { ignoreConfig } from './configs/ignore-config';
7
+ import { importXConfig } from './configs/import-x-config';
8
+ import { jsxA11yConfig } from './configs/jsx-a11y-config';
9
+ import { perfectionistConfig } from './configs/perfectionist-config';
10
+ import { prettierConfig } from './configs/prettier-config';
11
+ import { reactConfig } from './configs/react-config';
12
+ import { reactHooksConfig } from './configs/react-hooks-config';
13
+ import { stylisticConfig } from './configs/stylistic-config';
14
+ import { typescriptConfig } from './configs/typescript-config';
15
+ import { unicornConfig } from './configs/unicorn-config';
16
+ import { vitestConfig } from './configs/vitest-config';
17
+
18
+ /**
19
+ * Creates a base ESLint configuration object with predefined defaults.
20
+ */
21
+ export function createBaseEslintConfig(rootDir?: string, overrides: Config[] = []) {
22
+ return defineConfig([
23
+ ignoreConfig(rootDir),
24
+ eslintConfig,
25
+ stylisticConfig,
26
+ importXConfig,
27
+ perfectionistConfig,
28
+ unicornConfig,
29
+ typescriptConfig,
30
+ vitestConfig,
31
+ ...overrides,
32
+ prettierConfig,
33
+ {
34
+ name: 'language-config',
35
+ languageOptions: {
36
+ ecmaVersion: 'latest',
37
+ globals: {
38
+ ...globals.node,
39
+ },
40
+ },
41
+ },
42
+ ]);
43
+ }
44
+
45
+ /**
46
+ * Creates a React-specific ESLint configuration object with predefined defaults.
47
+ */
48
+ export function createReactEslintConfig(rootDir?: string, overrides: Config[] = []) {
49
+ return defineConfig([
50
+ createBaseEslintConfig(rootDir, overrides),
51
+ {
52
+ name: 'typescript-config',
53
+ files: ['**/*.{ts,tsx}'],
54
+ rules: {
55
+ // Allow {} type with React
56
+ '@typescript-eslint/no-empty-object-type': 'off',
57
+ },
58
+ },
59
+ reactConfig,
60
+ reactHooksConfig,
61
+ jsxA11yConfig,
62
+ ...overrides,
63
+ prettierConfig,
64
+ {
65
+ name: 'language-config',
66
+ languageOptions: {
67
+ globals: {
68
+ ...globals.browser,
69
+ },
70
+ },
71
+ },
72
+ ]);
73
+ }