@kazupon/eslint-config 0.14.1 → 0.16.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.
@@ -0,0 +1,42 @@
1
+ import type { Linter } from 'eslint';
2
+ export interface ImportsRules {
3
+ /**
4
+ * Disallow unused variables
5
+ * @see https://github.com/sweepline/eslint-plugin-unused-imports/blob/master/docs/rules/no-unused-imports.md
6
+ */
7
+ 'unused-imports/no-unused-imports'?: Linter.RuleEntry<UnusedImportsNoUnusedImports>;
8
+ /**
9
+ * Disallow unused variables
10
+ * @see https://github.com/sweepline/eslint-plugin-unused-imports/blob/master/docs/rules/no-unused-vars.md
11
+ */
12
+ 'unused-imports/no-unused-vars'?: Linter.RuleEntry<UnusedImportsNoUnusedVars>;
13
+ }
14
+ type UnusedImportsNoUnusedImports = [] | [
15
+ (("all" | "local") | {
16
+ vars?: ("all" | "local");
17
+ varsIgnorePattern?: string;
18
+ args?: ("all" | "after-used" | "none");
19
+ ignoreRestSiblings?: boolean;
20
+ argsIgnorePattern?: string;
21
+ caughtErrors?: ("all" | "none");
22
+ caughtErrorsIgnorePattern?: string;
23
+ destructuredArrayIgnorePattern?: string;
24
+ ignoreClassWithStaticInitBlock?: boolean;
25
+ reportUsedIgnorePattern?: boolean;
26
+ })
27
+ ];
28
+ type UnusedImportsNoUnusedVars = [] | [
29
+ (("all" | "local") | {
30
+ vars?: ("all" | "local");
31
+ varsIgnorePattern?: string;
32
+ args?: ("all" | "after-used" | "none");
33
+ ignoreRestSiblings?: boolean;
34
+ argsIgnorePattern?: string;
35
+ caughtErrors?: ("all" | "none");
36
+ caughtErrorsIgnorePattern?: string;
37
+ destructuredArrayIgnorePattern?: string;
38
+ ignoreClassWithStaticInitBlock?: boolean;
39
+ reportUsedIgnorePattern?: boolean;
40
+ })
41
+ ];
42
+ export {};
@@ -0,0 +1,42 @@
1
+ import type { Linter } from 'eslint';
2
+ export interface ImportsRules {
3
+ /**
4
+ * Disallow unused variables
5
+ * @see https://github.com/sweepline/eslint-plugin-unused-imports/blob/master/docs/rules/no-unused-imports.md
6
+ */
7
+ 'unused-imports/no-unused-imports'?: Linter.RuleEntry<UnusedImportsNoUnusedImports>;
8
+ /**
9
+ * Disallow unused variables
10
+ * @see https://github.com/sweepline/eslint-plugin-unused-imports/blob/master/docs/rules/no-unused-vars.md
11
+ */
12
+ 'unused-imports/no-unused-vars'?: Linter.RuleEntry<UnusedImportsNoUnusedVars>;
13
+ }
14
+ type UnusedImportsNoUnusedImports = [] | [
15
+ (("all" | "local") | {
16
+ vars?: ("all" | "local");
17
+ varsIgnorePattern?: string;
18
+ args?: ("all" | "after-used" | "none");
19
+ ignoreRestSiblings?: boolean;
20
+ argsIgnorePattern?: string;
21
+ caughtErrors?: ("all" | "none");
22
+ caughtErrorsIgnorePattern?: string;
23
+ destructuredArrayIgnorePattern?: string;
24
+ ignoreClassWithStaticInitBlock?: boolean;
25
+ reportUsedIgnorePattern?: boolean;
26
+ })
27
+ ];
28
+ type UnusedImportsNoUnusedVars = [] | [
29
+ (("all" | "local") | {
30
+ vars?: ("all" | "local");
31
+ varsIgnorePattern?: string;
32
+ args?: ("all" | "after-used" | "none");
33
+ ignoreRestSiblings?: boolean;
34
+ argsIgnorePattern?: string;
35
+ caughtErrors?: ("all" | "none");
36
+ caughtErrorsIgnorePattern?: string;
37
+ destructuredArrayIgnorePattern?: string;
38
+ ignoreClassWithStaticInitBlock?: boolean;
39
+ reportUsedIgnorePattern?: boolean;
40
+ })
41
+ ];
42
+ export {};
@@ -0,0 +1,377 @@
1
+ import type { Linter } from 'eslint';
2
+ export interface VitestRules {
3
+ /**
4
+ * require .spec test file pattern
5
+ * @see https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/consistent-test-filename.md
6
+ */
7
+ 'vitest/consistent-test-filename'?: Linter.RuleEntry<VitestConsistentTestFilename>;
8
+ /**
9
+ * enforce using test or it but not both
10
+ * @see https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/consistent-test-it.md
11
+ */
12
+ 'vitest/consistent-test-it'?: Linter.RuleEntry<VitestConsistentTestIt>;
13
+ /**
14
+ * enforce having expectation in test body
15
+ * @see https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/expect-expect.md
16
+ */
17
+ 'vitest/expect-expect'?: Linter.RuleEntry<VitestExpectExpect>;
18
+ /**
19
+ * Enforce padding around afterAll blocks
20
+ * @see https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/index.md
21
+ */
22
+ 'vitest/index'?: Linter.RuleEntry<[]>;
23
+ /**
24
+ * enforce a maximum number of expect per test
25
+ * @see https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/max-expects.md
26
+ */
27
+ 'vitest/max-expects'?: Linter.RuleEntry<VitestMaxExpects>;
28
+ /**
29
+ * require describe block to be less than set max value or default value
30
+ * @see https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/max-nested-describe.md
31
+ */
32
+ 'vitest/max-nested-describe'?: Linter.RuleEntry<VitestMaxNestedDescribe>;
33
+ /**
34
+ * disallow alias methods
35
+ * @see https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/no-alias-methods.md
36
+ */
37
+ 'vitest/no-alias-methods'?: Linter.RuleEntry<[]>;
38
+ /**
39
+ * disallow commented out tests
40
+ * @see https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/no-commented-out-tests.md
41
+ */
42
+ 'vitest/no-commented-out-tests'?: Linter.RuleEntry<[]>;
43
+ /**
44
+ * disallow conditional expects
45
+ * @see https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/no-conditional-expect.md
46
+ */
47
+ 'vitest/no-conditional-expect'?: Linter.RuleEntry<[]>;
48
+ /**
49
+ * disallow conditional tests
50
+ * @see https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/no-conditional-in-test.md
51
+ */
52
+ 'vitest/no-conditional-in-test'?: Linter.RuleEntry<[]>;
53
+ /**
54
+ * disallow conditional tests
55
+ * @see https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/no-conditional-tests.md
56
+ */
57
+ 'vitest/no-conditional-tests'?: Linter.RuleEntry<[]>;
58
+ /**
59
+ * disallow disabled tests
60
+ * @see https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/no-disabled-tests.md
61
+ */
62
+ 'vitest/no-disabled-tests'?: Linter.RuleEntry<[]>;
63
+ /**
64
+ * disallow using a callback in asynchronous tests and hooks
65
+ * @see https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/no-done-callback.md
66
+ * @deprecated
67
+ */
68
+ 'vitest/no-done-callback'?: Linter.RuleEntry<[]>;
69
+ /**
70
+ * disallow duplicate hooks and teardown hooks
71
+ * @see https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/no-duplicate-hooks.md
72
+ */
73
+ 'vitest/no-duplicate-hooks'?: Linter.RuleEntry<[]>;
74
+ /**
75
+ * disallow focused tests
76
+ * @see https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/no-focused-tests.md
77
+ */
78
+ 'vitest/no-focused-tests'?: Linter.RuleEntry<VitestNoFocusedTests>;
79
+ /**
80
+ * disallow setup and teardown hooks
81
+ * @see https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/no-hooks.md
82
+ */
83
+ 'vitest/no-hooks'?: Linter.RuleEntry<VitestNoHooks>;
84
+ /**
85
+ * disallow identical titles
86
+ * @see https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/no-identical-title.md
87
+ */
88
+ 'vitest/no-identical-title'?: Linter.RuleEntry<[]>;
89
+ /**
90
+ * disallow importing `node:test`
91
+ * @see https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/no-import-node-test.md
92
+ */
93
+ 'vitest/no-import-node-test'?: Linter.RuleEntry<[]>;
94
+ /**
95
+ * disallow string interpolation in snapshots
96
+ * @see https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/no-interpolation-in-snapshots.md
97
+ */
98
+ 'vitest/no-interpolation-in-snapshots'?: Linter.RuleEntry<[]>;
99
+ /**
100
+ * disallow large snapshots
101
+ * @see https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/no-large-snapshots.md
102
+ */
103
+ 'vitest/no-large-snapshots'?: Linter.RuleEntry<VitestNoLargeSnapshots>;
104
+ /**
105
+ * disallow importing from __mocks__ directory
106
+ * @see https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/no-mocks-import.md
107
+ */
108
+ 'vitest/no-mocks-import'?: Linter.RuleEntry<[]>;
109
+ /**
110
+ * disallow the use of certain matchers
111
+ * @see https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/no-restricted-matchers.md
112
+ */
113
+ 'vitest/no-restricted-matchers'?: Linter.RuleEntry<VitestNoRestrictedMatchers>;
114
+ /**
115
+ * disallow specific `vi.` methods
116
+ * @see https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/no-restricted-vi-methods.md
117
+ */
118
+ 'vitest/no-restricted-vi-methods'?: Linter.RuleEntry<VitestNoRestrictedViMethods>;
119
+ /**
120
+ * disallow using `expect` outside of `it` or `test` blocks
121
+ * @see https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/no-standalone-expect.md
122
+ */
123
+ 'vitest/no-standalone-expect'?: Linter.RuleEntry<VitestNoStandaloneExpect>;
124
+ /**
125
+ * disallow using `test` as a prefix
126
+ * @see https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/no-test-prefixes.md
127
+ */
128
+ 'vitest/no-test-prefixes'?: Linter.RuleEntry<[]>;
129
+ /**
130
+ * disallow return statements in tests
131
+ * @see https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/no-test-return-statement.md
132
+ */
133
+ 'vitest/no-test-return-statement'?: Linter.RuleEntry<[]>;
134
+ /**
135
+ * enforce using `toBeCalledWith()` or `toHaveBeenCalledWith()`
136
+ * @see https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/prefer-called-with.md
137
+ */
138
+ 'vitest/prefer-called-with'?: Linter.RuleEntry<[]>;
139
+ /**
140
+ * enforce using the built-in comparison matchers
141
+ * @see https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/prefer-comparison-matcher.md
142
+ */
143
+ 'vitest/prefer-comparison-matcher'?: Linter.RuleEntry<[]>;
144
+ /**
145
+ * enforce using `each` rather than manual loops
146
+ * @see https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/prefer-each.md
147
+ */
148
+ 'vitest/prefer-each'?: Linter.RuleEntry<[]>;
149
+ /**
150
+ * enforce using the built-in quality matchers
151
+ * @see https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/prefer-equality-matcher.md
152
+ */
153
+ 'vitest/prefer-equality-matcher'?: Linter.RuleEntry<[]>;
154
+ /**
155
+ * enforce using expect assertions instead of callbacks
156
+ * @see https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/prefer-expect-assertions.md
157
+ */
158
+ 'vitest/prefer-expect-assertions'?: Linter.RuleEntry<VitestPreferExpectAssertions>;
159
+ /**
160
+ * enforce using `expect().resolves` over `expect(await ...)` syntax
161
+ * @see https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/prefer-expect-resolves.md
162
+ */
163
+ 'vitest/prefer-expect-resolves'?: Linter.RuleEntry<[]>;
164
+ /**
165
+ * enforce having hooks in consistent order
166
+ * @see https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/prefer-hooks-in-order.md
167
+ */
168
+ 'vitest/prefer-hooks-in-order'?: Linter.RuleEntry<[]>;
169
+ /**
170
+ * enforce having hooks before any test cases
171
+ * @see https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/prefer-hooks-on-top.md
172
+ */
173
+ 'vitest/prefer-hooks-on-top'?: Linter.RuleEntry<[]>;
174
+ /**
175
+ * enforce lowercase titles
176
+ * @see https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/prefer-lowercase-title.md
177
+ */
178
+ 'vitest/prefer-lowercase-title'?: Linter.RuleEntry<VitestPreferLowercaseTitle>;
179
+ /**
180
+ * enforce mock resolved/rejected shorthands for promises
181
+ * @see https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/prefer-mock-promise-shorthand.md
182
+ */
183
+ 'vitest/prefer-mock-promise-shorthand'?: Linter.RuleEntry<[]>;
184
+ /**
185
+ * enforce including a hint with external snapshots
186
+ * @see https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/prefer-snapshot-hint.md
187
+ */
188
+ 'vitest/prefer-snapshot-hint'?: Linter.RuleEntry<VitestPreferSnapshotHint>;
189
+ /**
190
+ * enforce using `vi.spyOn`
191
+ * @see https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/prefer-spy-on.md
192
+ */
193
+ 'vitest/prefer-spy-on'?: Linter.RuleEntry<[]>;
194
+ /**
195
+ * enforce strict equal over equal
196
+ * @see https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/prefer-strict-equal.md
197
+ */
198
+ 'vitest/prefer-strict-equal'?: Linter.RuleEntry<[]>;
199
+ /**
200
+ * enforce using toBe()
201
+ * @see https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/prefer-to-be.md
202
+ */
203
+ 'vitest/prefer-to-be'?: Linter.RuleEntry<[]>;
204
+ /**
205
+ * enforce using toBeFalsy()
206
+ * @see https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/prefer-to-be-falsy.md
207
+ */
208
+ 'vitest/prefer-to-be-falsy'?: Linter.RuleEntry<[]>;
209
+ /**
210
+ * enforce using toBeObject()
211
+ * @see https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/prefer-to-be-object.md
212
+ */
213
+ 'vitest/prefer-to-be-object'?: Linter.RuleEntry<[]>;
214
+ /**
215
+ * enforce using `toBeTruthy`
216
+ * @see https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/prefer-to-be-truthy.md
217
+ */
218
+ 'vitest/prefer-to-be-truthy'?: Linter.RuleEntry<[]>;
219
+ /**
220
+ * enforce using toContain()
221
+ * @see https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/prefer-to-contain.md
222
+ */
223
+ 'vitest/prefer-to-contain'?: Linter.RuleEntry<[]>;
224
+ /**
225
+ * enforce using toHaveLength()
226
+ * @see https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/prefer-to-have-length.md
227
+ */
228
+ 'vitest/prefer-to-have-length'?: Linter.RuleEntry<[]>;
229
+ /**
230
+ * enforce using `test.todo`
231
+ * @see https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/prefer-todo.md
232
+ */
233
+ 'vitest/prefer-todo'?: Linter.RuleEntry<[]>;
234
+ /**
235
+ * require setup and teardown to be within a hook
236
+ * @see https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/require-hook.md
237
+ */
238
+ 'vitest/require-hook'?: Linter.RuleEntry<VitestRequireHook>;
239
+ /**
240
+ * require local Test Context for concurrent snapshot tests
241
+ * @see https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/require-local-test-context-for-concurrent-snapshots.md
242
+ */
243
+ 'vitest/require-local-test-context-for-concurrent-snapshots'?: Linter.RuleEntry<[]>;
244
+ /**
245
+ * require toThrow() to be called with an error message
246
+ * @see https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/require-to-throw-message.md
247
+ */
248
+ 'vitest/require-to-throw-message'?: Linter.RuleEntry<[]>;
249
+ /**
250
+ * enforce that all tests are in a top-level describe
251
+ * @see https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/require-top-level-describe.md
252
+ */
253
+ 'vitest/require-top-level-describe'?: Linter.RuleEntry<VitestRequireTopLevelDescribe>;
254
+ /**
255
+ * enforce valid describe callback
256
+ * @see https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/valid-describe-callback.md
257
+ */
258
+ 'vitest/valid-describe-callback'?: Linter.RuleEntry<[]>;
259
+ /**
260
+ * enforce valid `expect()` usage
261
+ * @see https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/valid-expect.md
262
+ */
263
+ 'vitest/valid-expect'?: Linter.RuleEntry<VitestValidExpect>;
264
+ /**
265
+ * enforce valid titles
266
+ * @see https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/valid-title.md
267
+ */
268
+ 'vitest/valid-title'?: Linter.RuleEntry<VitestValidTitle>;
269
+ }
270
+ type VitestConsistentTestFilename = [] | [
271
+ {
272
+ pattern?: string;
273
+ allTestPattern?: string;
274
+ }
275
+ ];
276
+ type VitestConsistentTestIt = [] | [
277
+ {
278
+ fn?: ("test" | "it");
279
+ withinDescribe?: ("test" | "it");
280
+ }
281
+ ];
282
+ type VitestExpectExpect = [] | [
283
+ {
284
+ assertFunctionNames?: [] | [string];
285
+ additionalTestBlockFunctions?: string[];
286
+ }
287
+ ];
288
+ type VitestMaxExpects = [] | [
289
+ {
290
+ max?: number;
291
+ }
292
+ ];
293
+ type VitestMaxNestedDescribe = [] | [
294
+ {
295
+ max?: number;
296
+ }
297
+ ];
298
+ type VitestNoFocusedTests = [] | [
299
+ {
300
+ fixable?: boolean;
301
+ }
302
+ ];
303
+ type VitestNoHooks = [] | [
304
+ {
305
+ allow?: unknown[];
306
+ }
307
+ ];
308
+ type VitestNoLargeSnapshots = [] | [
309
+ {
310
+ maxSize?: number;
311
+ inlineMaxSize?: number;
312
+ allowedSnapshots?: {
313
+ [k: string]: unknown[] | undefined;
314
+ };
315
+ }
316
+ ];
317
+ type VitestNoRestrictedMatchers = [] | [
318
+ {
319
+ [k: string]: (string | null) | undefined;
320
+ }
321
+ ];
322
+ type VitestNoRestrictedViMethods = [] | [
323
+ {
324
+ [k: string]: (string | null) | undefined;
325
+ }
326
+ ];
327
+ type VitestNoStandaloneExpect = [] | [
328
+ {
329
+ additionaltestblockfunctions?: string[];
330
+ [k: string]: unknown | undefined;
331
+ }
332
+ ];
333
+ type VitestPreferExpectAssertions = [] | [
334
+ {
335
+ onlyFunctionsWithAsyncKeyword?: boolean;
336
+ onlyFunctionsWithExpectInLoop?: boolean;
337
+ onlyFunctionsWithExpectInCallback?: boolean;
338
+ }
339
+ ];
340
+ type VitestPreferLowercaseTitle = [] | [
341
+ {
342
+ ignore?: ("describe" | "test" | "it")[];
343
+ allowedPrefixes?: string[];
344
+ ignoreTopLevelDescribe?: boolean;
345
+ lowercaseFirstCharacterOnly?: boolean;
346
+ }
347
+ ];
348
+ type VitestPreferSnapshotHint = [] | [("always" | "multi")];
349
+ type VitestRequireHook = [] | [
350
+ {
351
+ allowedFunctionCalls?: string[];
352
+ }
353
+ ];
354
+ type VitestRequireTopLevelDescribe = [] | [
355
+ {
356
+ maxNumberOfTopLevelDescribes?: number;
357
+ }
358
+ ];
359
+ type VitestValidExpect = [] | [
360
+ {
361
+ alwaysAwait?: boolean;
362
+ asyncMatchers?: string[];
363
+ minArgs?: number;
364
+ maxArgs?: number;
365
+ }
366
+ ];
367
+ type VitestValidTitle = [] | [
368
+ {
369
+ ignoreTypeOfDescribeName?: boolean;
370
+ allowArguments?: boolean;
371
+ disallowedWords?: string[];
372
+ [k: string]: (string | [string] | [string, string] | {
373
+ [k: string]: (string | [string] | [string, string]) | undefined;
374
+ });
375
+ }
376
+ ];
377
+ export {};