@chanyuxi/eslint-waltz 1.1.1 → 1.2.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/README.md +31 -56
- package/dist/index.d.ts +588 -5
- package/dist/index.js +37 -0
- package/package.json +150 -147
package/README.md
CHANGED
|
@@ -1,82 +1,57 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @chanyuxi/eslint-waltz
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Composable ESLint flat config for JavaScript, TypeScript, JSONC, React, Tailwind CSS, Perfectionist, and Vitest.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Requires Node.js `>=20.19.0`.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
## Install
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Install the package, ESLint, and the peer dependencies used by the default configuration:
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
-
|
|
13
|
-
|
|
14
|
-
- ✅ Perfectionist
|
|
15
|
-
- ✅ Json
|
|
16
|
-
- ✅ Import
|
|
17
|
-
- ✅ React
|
|
18
|
-
- ✅ Tailwind CSS
|
|
19
|
-
- JSONC and imports are enabled by default and can be disabled with `json: false` and `imports: false`.
|
|
20
|
-
- TypeScript, React, Tailwind CSS, and gitignore support are opt-in.
|
|
21
|
-
|
|
22
|
-
The `stylistic` configuration is always enabled. Perfectionist is enabled by default with the `recommended-alphabetical` preset.
|
|
23
|
-
|
|
24
|
-
# Usage
|
|
11
|
+
```bash
|
|
12
|
+
pnpm add -D @chanyuxi/eslint-waltz eslint eslint-plugin-jsonc eslint-plugin-import-x eslint-plugin-perfectionist jsonc-eslint-parser
|
|
13
|
+
```
|
|
25
14
|
|
|
26
|
-
|
|
15
|
+
`@eslint/js`, `@stylistic/eslint-plugin`, `globals`, and `jsonc-parser` are included automatically.
|
|
27
16
|
|
|
28
|
-
Install
|
|
17
|
+
Install peers only for the optional modules you enable:
|
|
29
18
|
|
|
30
19
|
```bash
|
|
31
|
-
|
|
32
|
-
|
|
20
|
+
# TypeScript
|
|
21
|
+
pnpm add -D typescript-eslint
|
|
33
22
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
Perfectionist uses the `recommended-alphabetical` preset by default. Use `perfectionist: { preset: 'recommended-custom' }`, `recommended-line-length`, or `recommended-natural` to select another recommended preset. ESLint 10 and the current integrations require Node.js `>=20.19.0`.
|
|
23
|
+
# React
|
|
24
|
+
pnpm add -D eslint-plugin-react-x eslint-plugin-react-debug eslint-plugin-react-dom eslint-plugin-react-hooks-extra eslint-plugin-react-naming-convention eslint-plugin-react-web-api
|
|
37
25
|
|
|
38
|
-
|
|
26
|
+
# Tailwind CSS
|
|
27
|
+
pnpm add -D eslint-plugin-tailwindcss tailwindcss
|
|
39
28
|
|
|
40
|
-
|
|
29
|
+
# .gitignore support
|
|
30
|
+
pnpm add -D eslint-config-flat-gitignore
|
|
31
|
+
|
|
32
|
+
# Vitest
|
|
33
|
+
pnpm add -D @vitest/eslint-plugin vitest
|
|
34
|
+
```
|
|
41
35
|
|
|
42
|
-
|
|
36
|
+
## Usage
|
|
43
37
|
|
|
44
38
|
```ts
|
|
39
|
+
// eslint.config.ts
|
|
45
40
|
import waltz from '@chanyuxi/eslint-waltz'
|
|
46
41
|
|
|
47
42
|
export default waltz({
|
|
48
|
-
// JSONC and imports are enabled by default
|
|
49
|
-
json: true,
|
|
50
43
|
ts: true,
|
|
51
44
|
react: true,
|
|
52
|
-
tailwindcss: {
|
|
53
|
-
settings: {
|
|
54
|
-
tailwindcss: { cssConfigPath: './src/styles.css' },
|
|
55
|
-
},
|
|
56
|
-
},
|
|
57
|
-
js: { globals: ['browser'] },
|
|
58
45
|
})
|
|
59
46
|
```
|
|
60
47
|
|
|
61
|
-
|
|
48
|
+
Enabled by default:
|
|
62
49
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
'no-console': 'off',
|
|
68
|
-
},
|
|
69
|
-
})
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
Run `pnpm run check` before committing. `pnpm pack` and `npm publish` build the package automatically through the `prepack` lifecycle.
|
|
73
|
-
|
|
74
|
-
#### VS Code synchronization
|
|
50
|
+
- JavaScript and stylistic rules
|
|
51
|
+
- JSONC rules
|
|
52
|
+
- import validation
|
|
53
|
+
- Perfectionist with `recommended-alphabetical`
|
|
75
54
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
```bash
|
|
79
|
-
npx eslint-waltz sync-vscode
|
|
80
|
-
```
|
|
55
|
+
Optional: `ts`, `react`, `tailwindcss`, `gitignore`, and `vitest`.
|
|
81
56
|
|
|
82
|
-
|
|
57
|
+
More options are documented in the exported TypeScript types.
|
package/dist/index.d.ts
CHANGED
|
@@ -2216,6 +2216,417 @@ interface RuleOptions {
|
|
|
2216
2216
|
* @see https://github.com/francoismassart/eslint-plugin-tailwindcss/blob/alpha/v4-basic-files/docs/rules/no-unnecessary-arbitrary-value.md
|
|
2217
2217
|
*/
|
|
2218
2218
|
'tailwindcss/no-unnecessary-arbitrary-value'?: Linter.RuleEntry<TailwindcssNoUnnecessaryArbitraryValue>
|
|
2219
|
+
/**
|
|
2220
|
+
* enforce using `.each` or `.for` consistently
|
|
2221
|
+
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/consistent-each-for.md
|
|
2222
|
+
*/
|
|
2223
|
+
'vitest/consistent-each-for'?: Linter.RuleEntry<VitestConsistentEachFor>
|
|
2224
|
+
/**
|
|
2225
|
+
* require test file pattern
|
|
2226
|
+
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/consistent-test-filename.md
|
|
2227
|
+
*/
|
|
2228
|
+
'vitest/consistent-test-filename'?: Linter.RuleEntry<VitestConsistentTestFilename>
|
|
2229
|
+
/**
|
|
2230
|
+
* enforce using test or it but not both
|
|
2231
|
+
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/consistent-test-it.md
|
|
2232
|
+
*/
|
|
2233
|
+
'vitest/consistent-test-it'?: Linter.RuleEntry<VitestConsistentTestIt>
|
|
2234
|
+
/**
|
|
2235
|
+
* enforce using vitest or vi but not both
|
|
2236
|
+
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/consistent-vitest-vi.md
|
|
2237
|
+
*/
|
|
2238
|
+
'vitest/consistent-vitest-vi'?: Linter.RuleEntry<VitestConsistentVitestVi>
|
|
2239
|
+
/**
|
|
2240
|
+
* enforce having expectation in test body
|
|
2241
|
+
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/expect-expect.md
|
|
2242
|
+
*/
|
|
2243
|
+
'vitest/expect-expect'?: Linter.RuleEntry<VitestExpectExpect>
|
|
2244
|
+
/**
|
|
2245
|
+
* enforce hoisted APIs to be on top of the file
|
|
2246
|
+
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/hoisted-apis-on-top.md
|
|
2247
|
+
*/
|
|
2248
|
+
'vitest/hoisted-apis-on-top'?: Linter.RuleEntry<[]>
|
|
2249
|
+
/**
|
|
2250
|
+
* enforce a maximum number of expect per test
|
|
2251
|
+
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/max-expects.md
|
|
2252
|
+
*/
|
|
2253
|
+
'vitest/max-expects'?: Linter.RuleEntry<VitestMaxExpects>
|
|
2254
|
+
/**
|
|
2255
|
+
* require describe block to be less than set max value or default value
|
|
2256
|
+
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/max-nested-describe.md
|
|
2257
|
+
*/
|
|
2258
|
+
'vitest/max-nested-describe'?: Linter.RuleEntry<VitestMaxNestedDescribe>
|
|
2259
|
+
/**
|
|
2260
|
+
* disallow alias methods
|
|
2261
|
+
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-alias-methods.md
|
|
2262
|
+
*/
|
|
2263
|
+
'vitest/no-alias-methods'?: Linter.RuleEntry<[]>
|
|
2264
|
+
/**
|
|
2265
|
+
* disallow commented out tests
|
|
2266
|
+
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-commented-out-tests.md
|
|
2267
|
+
*/
|
|
2268
|
+
'vitest/no-commented-out-tests'?: Linter.RuleEntry<[]>
|
|
2269
|
+
/**
|
|
2270
|
+
* disallow conditional expects
|
|
2271
|
+
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-conditional-expect.md
|
|
2272
|
+
*/
|
|
2273
|
+
'vitest/no-conditional-expect'?: Linter.RuleEntry<VitestNoConditionalExpect>
|
|
2274
|
+
/**
|
|
2275
|
+
* disallow conditional tests
|
|
2276
|
+
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-conditional-in-test.md
|
|
2277
|
+
*/
|
|
2278
|
+
'vitest/no-conditional-in-test'?: Linter.RuleEntry<[]>
|
|
2279
|
+
/**
|
|
2280
|
+
* disallow conditional tests
|
|
2281
|
+
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-conditional-tests.md
|
|
2282
|
+
*/
|
|
2283
|
+
'vitest/no-conditional-tests'?: Linter.RuleEntry<[]>
|
|
2284
|
+
/**
|
|
2285
|
+
* disallow disabled tests
|
|
2286
|
+
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-disabled-tests.md
|
|
2287
|
+
*/
|
|
2288
|
+
'vitest/no-disabled-tests'?: Linter.RuleEntry<[]>
|
|
2289
|
+
/**
|
|
2290
|
+
* disallow using a callback in asynchronous tests and hooks
|
|
2291
|
+
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-done-callback.md
|
|
2292
|
+
* @deprecated
|
|
2293
|
+
*/
|
|
2294
|
+
'vitest/no-done-callback'?: Linter.RuleEntry<[]>
|
|
2295
|
+
/**
|
|
2296
|
+
* disallow duplicate hooks and teardown hooks
|
|
2297
|
+
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-duplicate-hooks.md
|
|
2298
|
+
*/
|
|
2299
|
+
'vitest/no-duplicate-hooks'?: Linter.RuleEntry<[]>
|
|
2300
|
+
/**
|
|
2301
|
+
* disallow focused tests
|
|
2302
|
+
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-focused-tests.md
|
|
2303
|
+
*/
|
|
2304
|
+
'vitest/no-focused-tests'?: Linter.RuleEntry<VitestNoFocusedTests>
|
|
2305
|
+
/**
|
|
2306
|
+
* disallow setup and teardown hooks
|
|
2307
|
+
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-hooks.md
|
|
2308
|
+
*/
|
|
2309
|
+
'vitest/no-hooks'?: Linter.RuleEntry<VitestNoHooks>
|
|
2310
|
+
/**
|
|
2311
|
+
* disallow identical titles
|
|
2312
|
+
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-identical-title.md
|
|
2313
|
+
*/
|
|
2314
|
+
'vitest/no-identical-title'?: Linter.RuleEntry<[]>
|
|
2315
|
+
/**
|
|
2316
|
+
* disallow importing `node:test`
|
|
2317
|
+
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-import-node-test.md
|
|
2318
|
+
*/
|
|
2319
|
+
'vitest/no-import-node-test'?: Linter.RuleEntry<[]>
|
|
2320
|
+
/**
|
|
2321
|
+
* disallow importing Vitest globals
|
|
2322
|
+
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-importing-vitest-globals.md
|
|
2323
|
+
*/
|
|
2324
|
+
'vitest/no-importing-vitest-globals'?: Linter.RuleEntry<[]>
|
|
2325
|
+
/**
|
|
2326
|
+
* disallow string interpolation in snapshots
|
|
2327
|
+
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-interpolation-in-snapshots.md
|
|
2328
|
+
*/
|
|
2329
|
+
'vitest/no-interpolation-in-snapshots'?: Linter.RuleEntry<[]>
|
|
2330
|
+
/**
|
|
2331
|
+
* disallow large snapshots
|
|
2332
|
+
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-large-snapshots.md
|
|
2333
|
+
*/
|
|
2334
|
+
'vitest/no-large-snapshots'?: Linter.RuleEntry<VitestNoLargeSnapshots>
|
|
2335
|
+
/**
|
|
2336
|
+
* disallow importing from __mocks__ directory
|
|
2337
|
+
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-mocks-import.md
|
|
2338
|
+
*/
|
|
2339
|
+
'vitest/no-mocks-import'?: Linter.RuleEntry<[]>
|
|
2340
|
+
/**
|
|
2341
|
+
* disallow the use of certain matchers
|
|
2342
|
+
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-restricted-matchers.md
|
|
2343
|
+
*/
|
|
2344
|
+
'vitest/no-restricted-matchers'?: Linter.RuleEntry<VitestNoRestrictedMatchers>
|
|
2345
|
+
/**
|
|
2346
|
+
* disallow specific `vi.` methods
|
|
2347
|
+
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-restricted-vi-methods.md
|
|
2348
|
+
*/
|
|
2349
|
+
'vitest/no-restricted-vi-methods'?: Linter.RuleEntry<VitestNoRestrictedViMethods>
|
|
2350
|
+
/**
|
|
2351
|
+
* disallow using `expect` outside of `it` or `test` blocks
|
|
2352
|
+
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-standalone-expect.md
|
|
2353
|
+
*/
|
|
2354
|
+
'vitest/no-standalone-expect'?: Linter.RuleEntry<VitestNoStandaloneExpect>
|
|
2355
|
+
/**
|
|
2356
|
+
* disallow using the `f` and `x` prefixes in favour of `.only` and `.skip`
|
|
2357
|
+
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-test-prefixes.md
|
|
2358
|
+
*/
|
|
2359
|
+
'vitest/no-test-prefixes'?: Linter.RuleEntry<[]>
|
|
2360
|
+
/**
|
|
2361
|
+
* disallow return statements in tests
|
|
2362
|
+
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-test-return-statement.md
|
|
2363
|
+
*/
|
|
2364
|
+
'vitest/no-test-return-statement'?: Linter.RuleEntry<[]>
|
|
2365
|
+
/**
|
|
2366
|
+
* Disallow unnecessary async function wrapper for expected promises
|
|
2367
|
+
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-unneeded-async-expect-function.md
|
|
2368
|
+
*/
|
|
2369
|
+
'vitest/no-unneeded-async-expect-function'?: Linter.RuleEntry<[]>
|
|
2370
|
+
/**
|
|
2371
|
+
* Enforce padding around `afterAll` blocks
|
|
2372
|
+
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/padding-around-after-all-blocks.md
|
|
2373
|
+
*/
|
|
2374
|
+
'vitest/padding-around-after-all-blocks'?: Linter.RuleEntry<[]>
|
|
2375
|
+
/**
|
|
2376
|
+
* Enforce padding around `afterEach` blocks
|
|
2377
|
+
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/padding-around-after-each-blocks.md
|
|
2378
|
+
*/
|
|
2379
|
+
'vitest/padding-around-after-each-blocks'?: Linter.RuleEntry<[]>
|
|
2380
|
+
/**
|
|
2381
|
+
* Enforce padding around vitest functions
|
|
2382
|
+
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/padding-around-all.md
|
|
2383
|
+
*/
|
|
2384
|
+
'vitest/padding-around-all'?: Linter.RuleEntry<[]>
|
|
2385
|
+
/**
|
|
2386
|
+
* Enforce padding around `beforeAll` blocks
|
|
2387
|
+
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/padding-around-before-all-blocks.md
|
|
2388
|
+
*/
|
|
2389
|
+
'vitest/padding-around-before-all-blocks'?: Linter.RuleEntry<[]>
|
|
2390
|
+
/**
|
|
2391
|
+
* Enforce padding around `beforeEach` blocks
|
|
2392
|
+
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/padding-around-before-each-blocks.md
|
|
2393
|
+
*/
|
|
2394
|
+
'vitest/padding-around-before-each-blocks'?: Linter.RuleEntry<[]>
|
|
2395
|
+
/**
|
|
2396
|
+
* Enforce padding around `describe` blocks
|
|
2397
|
+
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/padding-around-describe-blocks.md
|
|
2398
|
+
*/
|
|
2399
|
+
'vitest/padding-around-describe-blocks'?: Linter.RuleEntry<[]>
|
|
2400
|
+
/**
|
|
2401
|
+
* Enforce padding around `expect` groups
|
|
2402
|
+
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/padding-around-expect-groups.md
|
|
2403
|
+
*/
|
|
2404
|
+
'vitest/padding-around-expect-groups'?: Linter.RuleEntry<[]>
|
|
2405
|
+
/**
|
|
2406
|
+
* Enforce padding around `test` blocks
|
|
2407
|
+
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/padding-around-test-blocks.md
|
|
2408
|
+
*/
|
|
2409
|
+
'vitest/padding-around-test-blocks'?: Linter.RuleEntry<[]>
|
|
2410
|
+
/**
|
|
2411
|
+
* Prefer `toHaveBeenCalledExactlyOnceWith` over `toHaveBeenCalledOnce` and `toHaveBeenCalledWith`
|
|
2412
|
+
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-called-exactly-once-with.md
|
|
2413
|
+
*/
|
|
2414
|
+
'vitest/prefer-called-exactly-once-with'?: Linter.RuleEntry<[]>
|
|
2415
|
+
/**
|
|
2416
|
+
* enforce using `toBeCalledOnce()` or `toHaveBeenCalledOnce()`
|
|
2417
|
+
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-called-once.md
|
|
2418
|
+
*/
|
|
2419
|
+
'vitest/prefer-called-once'?: Linter.RuleEntry<[]>
|
|
2420
|
+
/**
|
|
2421
|
+
* enforce using `toBeCalledTimes(1)` or `toHaveBeenCalledTimes(1)`
|
|
2422
|
+
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-called-times.md
|
|
2423
|
+
*/
|
|
2424
|
+
'vitest/prefer-called-times'?: Linter.RuleEntry<[]>
|
|
2425
|
+
/**
|
|
2426
|
+
* enforce using `toBeCalledWith()` or `toHaveBeenCalledWith()`
|
|
2427
|
+
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-called-with.md
|
|
2428
|
+
*/
|
|
2429
|
+
'vitest/prefer-called-with'?: Linter.RuleEntry<[]>
|
|
2430
|
+
/**
|
|
2431
|
+
* enforce using the built-in comparison matchers
|
|
2432
|
+
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-comparison-matcher.md
|
|
2433
|
+
*/
|
|
2434
|
+
'vitest/prefer-comparison-matcher'?: Linter.RuleEntry<[]>
|
|
2435
|
+
/**
|
|
2436
|
+
* enforce using a function as a describe title over an equivalent string
|
|
2437
|
+
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-describe-function-title.md
|
|
2438
|
+
*/
|
|
2439
|
+
'vitest/prefer-describe-function-title'?: Linter.RuleEntry<[]>
|
|
2440
|
+
/**
|
|
2441
|
+
* enforce using `each` rather than manual loops
|
|
2442
|
+
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-each.md
|
|
2443
|
+
*/
|
|
2444
|
+
'vitest/prefer-each'?: Linter.RuleEntry<[]>
|
|
2445
|
+
/**
|
|
2446
|
+
* enforce using the built-in equality matchers
|
|
2447
|
+
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-equality-matcher.md
|
|
2448
|
+
*/
|
|
2449
|
+
'vitest/prefer-equality-matcher'?: Linter.RuleEntry<[]>
|
|
2450
|
+
/**
|
|
2451
|
+
* enforce using expect assertions instead of callbacks
|
|
2452
|
+
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-expect-assertions.md
|
|
2453
|
+
*/
|
|
2454
|
+
'vitest/prefer-expect-assertions'?: Linter.RuleEntry<VitestPreferExpectAssertions>
|
|
2455
|
+
/**
|
|
2456
|
+
* enforce using `expect().resolves` over `expect(await ...)` syntax
|
|
2457
|
+
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-expect-resolves.md
|
|
2458
|
+
*/
|
|
2459
|
+
'vitest/prefer-expect-resolves'?: Linter.RuleEntry<[]>
|
|
2460
|
+
/**
|
|
2461
|
+
* enforce using `expect(...).toBeTypeOf(...)` instead of `expect(typeof ...).toBe(...)`
|
|
2462
|
+
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-expect-type-of.md
|
|
2463
|
+
*/
|
|
2464
|
+
'vitest/prefer-expect-type-of'?: Linter.RuleEntry<[]>
|
|
2465
|
+
/**
|
|
2466
|
+
* enforce having hooks in consistent order
|
|
2467
|
+
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-hooks-in-order.md
|
|
2468
|
+
*/
|
|
2469
|
+
'vitest/prefer-hooks-in-order'?: Linter.RuleEntry<[]>
|
|
2470
|
+
/**
|
|
2471
|
+
* enforce having hooks before any test cases
|
|
2472
|
+
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-hooks-on-top.md
|
|
2473
|
+
*/
|
|
2474
|
+
'vitest/prefer-hooks-on-top'?: Linter.RuleEntry<[]>
|
|
2475
|
+
/**
|
|
2476
|
+
* prefer dynamic import in mock
|
|
2477
|
+
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-import-in-mock.md
|
|
2478
|
+
*/
|
|
2479
|
+
'vitest/prefer-import-in-mock'?: Linter.RuleEntry<VitestPreferImportInMock>
|
|
2480
|
+
/**
|
|
2481
|
+
* enforce importing Vitest globals
|
|
2482
|
+
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-importing-vitest-globals.md
|
|
2483
|
+
*/
|
|
2484
|
+
'vitest/prefer-importing-vitest-globals'?: Linter.RuleEntry<[]>
|
|
2485
|
+
/**
|
|
2486
|
+
* enforce lowercase titles
|
|
2487
|
+
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-lowercase-title.md
|
|
2488
|
+
*/
|
|
2489
|
+
'vitest/prefer-lowercase-title'?: Linter.RuleEntry<VitestPreferLowercaseTitle>
|
|
2490
|
+
/**
|
|
2491
|
+
* enforce mock resolved/rejected shorthands for promises
|
|
2492
|
+
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-mock-promise-shorthand.md
|
|
2493
|
+
*/
|
|
2494
|
+
'vitest/prefer-mock-promise-shorthand'?: Linter.RuleEntry<[]>
|
|
2495
|
+
/**
|
|
2496
|
+
* Prefer mock return shorthands
|
|
2497
|
+
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-mock-return-shorthand.md
|
|
2498
|
+
*/
|
|
2499
|
+
'vitest/prefer-mock-return-shorthand'?: Linter.RuleEntry<[]>
|
|
2500
|
+
/**
|
|
2501
|
+
* enforce including a hint with external snapshots
|
|
2502
|
+
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-snapshot-hint.md
|
|
2503
|
+
*/
|
|
2504
|
+
'vitest/prefer-snapshot-hint'?: Linter.RuleEntry<VitestPreferSnapshotHint>
|
|
2505
|
+
/**
|
|
2506
|
+
* enforce using `vi.spyOn`
|
|
2507
|
+
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-spy-on.md
|
|
2508
|
+
*/
|
|
2509
|
+
'vitest/prefer-spy-on'?: Linter.RuleEntry<[]>
|
|
2510
|
+
/**
|
|
2511
|
+
* enforce using `toBe(true)` and `toBe(false)` over matchers that coerce types to boolean
|
|
2512
|
+
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-strict-boolean-matchers.md
|
|
2513
|
+
*/
|
|
2514
|
+
'vitest/prefer-strict-boolean-matchers'?: Linter.RuleEntry<[]>
|
|
2515
|
+
/**
|
|
2516
|
+
* enforce strict equal over equal
|
|
2517
|
+
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-strict-equal.md
|
|
2518
|
+
*/
|
|
2519
|
+
'vitest/prefer-strict-equal'?: Linter.RuleEntry<[]>
|
|
2520
|
+
/**
|
|
2521
|
+
* enforce using toBe()
|
|
2522
|
+
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-to-be.md
|
|
2523
|
+
*/
|
|
2524
|
+
'vitest/prefer-to-be'?: Linter.RuleEntry<[]>
|
|
2525
|
+
/**
|
|
2526
|
+
* enforce using toBeFalsy()
|
|
2527
|
+
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-to-be-falsy.md
|
|
2528
|
+
*/
|
|
2529
|
+
'vitest/prefer-to-be-falsy'?: Linter.RuleEntry<[]>
|
|
2530
|
+
/**
|
|
2531
|
+
* enforce using toBeObject()
|
|
2532
|
+
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-to-be-object.md
|
|
2533
|
+
*/
|
|
2534
|
+
'vitest/prefer-to-be-object'?: Linter.RuleEntry<[]>
|
|
2535
|
+
/**
|
|
2536
|
+
* enforce using `toBeTruthy`
|
|
2537
|
+
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-to-be-truthy.md
|
|
2538
|
+
*/
|
|
2539
|
+
'vitest/prefer-to-be-truthy'?: Linter.RuleEntry<[]>
|
|
2540
|
+
/**
|
|
2541
|
+
* enforce using toContain()
|
|
2542
|
+
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-to-contain.md
|
|
2543
|
+
*/
|
|
2544
|
+
'vitest/prefer-to-contain'?: Linter.RuleEntry<[]>
|
|
2545
|
+
/**
|
|
2546
|
+
* Suggest using `toHaveBeenCalledTimes()`
|
|
2547
|
+
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-to-have-been-called-times.md
|
|
2548
|
+
*/
|
|
2549
|
+
'vitest/prefer-to-have-been-called-times'?: Linter.RuleEntry<[]>
|
|
2550
|
+
/**
|
|
2551
|
+
* enforce using toHaveLength()
|
|
2552
|
+
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-to-have-length.md
|
|
2553
|
+
*/
|
|
2554
|
+
'vitest/prefer-to-have-length'?: Linter.RuleEntry<[]>
|
|
2555
|
+
/**
|
|
2556
|
+
* enforce using `test.todo`
|
|
2557
|
+
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-todo.md
|
|
2558
|
+
*/
|
|
2559
|
+
'vitest/prefer-todo'?: Linter.RuleEntry<[]>
|
|
2560
|
+
/**
|
|
2561
|
+
* require `vi.mocked()` over `fn as Mock`
|
|
2562
|
+
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-vi-mocked.md
|
|
2563
|
+
*/
|
|
2564
|
+
'vitest/prefer-vi-mocked'?: Linter.RuleEntry<[]>
|
|
2565
|
+
/**
|
|
2566
|
+
* ensure that every `expect.poll` call is awaited
|
|
2567
|
+
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/require-awaited-expect-poll.md
|
|
2568
|
+
*/
|
|
2569
|
+
'vitest/require-awaited-expect-poll'?: Linter.RuleEntry<[]>
|
|
2570
|
+
/**
|
|
2571
|
+
* require setup and teardown to be within a hook
|
|
2572
|
+
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/require-hook.md
|
|
2573
|
+
*/
|
|
2574
|
+
'vitest/require-hook'?: Linter.RuleEntry<VitestRequireHook>
|
|
2575
|
+
/**
|
|
2576
|
+
* require local Test Context for concurrent snapshot tests
|
|
2577
|
+
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/require-local-test-context-for-concurrent-snapshots.md
|
|
2578
|
+
*/
|
|
2579
|
+
'vitest/require-local-test-context-for-concurrent-snapshots'?: Linter.RuleEntry<[]>
|
|
2580
|
+
/**
|
|
2581
|
+
* enforce using type parameters with vitest mock functions
|
|
2582
|
+
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/require-mock-type-parameters.md
|
|
2583
|
+
*/
|
|
2584
|
+
'vitest/require-mock-type-parameters'?: Linter.RuleEntry<VitestRequireMockTypeParameters>
|
|
2585
|
+
/**
|
|
2586
|
+
* require tests to declare a timeout
|
|
2587
|
+
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/require-test-timeout.md
|
|
2588
|
+
*/
|
|
2589
|
+
'vitest/require-test-timeout'?: Linter.RuleEntry<[]>
|
|
2590
|
+
/**
|
|
2591
|
+
* require toThrow() to be called with an error message
|
|
2592
|
+
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/require-to-throw-message.md
|
|
2593
|
+
*/
|
|
2594
|
+
'vitest/require-to-throw-message'?: Linter.RuleEntry<[]>
|
|
2595
|
+
/**
|
|
2596
|
+
* enforce that all tests are in a top-level describe
|
|
2597
|
+
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/require-top-level-describe.md
|
|
2598
|
+
*/
|
|
2599
|
+
'vitest/require-top-level-describe'?: Linter.RuleEntry<VitestRequireTopLevelDescribe>
|
|
2600
|
+
/**
|
|
2601
|
+
* enforce unbound methods are called with their expected scope
|
|
2602
|
+
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/unbound-method.md
|
|
2603
|
+
*/
|
|
2604
|
+
'vitest/unbound-method'?: Linter.RuleEntry<VitestUnboundMethod>
|
|
2605
|
+
/**
|
|
2606
|
+
* enforce valid describe callback
|
|
2607
|
+
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/valid-describe-callback.md
|
|
2608
|
+
*/
|
|
2609
|
+
'vitest/valid-describe-callback'?: Linter.RuleEntry<[]>
|
|
2610
|
+
/**
|
|
2611
|
+
* enforce valid `expect()` usage
|
|
2612
|
+
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/valid-expect.md
|
|
2613
|
+
*/
|
|
2614
|
+
'vitest/valid-expect'?: Linter.RuleEntry<VitestValidExpect>
|
|
2615
|
+
/**
|
|
2616
|
+
* require promises that have expectations in their chain to be valid
|
|
2617
|
+
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/valid-expect-in-promise.md
|
|
2618
|
+
*/
|
|
2619
|
+
'vitest/valid-expect-in-promise'?: Linter.RuleEntry<[]>
|
|
2620
|
+
/**
|
|
2621
|
+
* enforce valid titles
|
|
2622
|
+
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/valid-title.md
|
|
2623
|
+
*/
|
|
2624
|
+
'vitest/valid-title'?: Linter.RuleEntry<VitestValidTitle>
|
|
2625
|
+
/**
|
|
2626
|
+
* disallow `.todo` usage
|
|
2627
|
+
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/warn-todo.md
|
|
2628
|
+
*/
|
|
2629
|
+
'vitest/warn-todo'?: Linter.RuleEntry<[]>
|
|
2219
2630
|
}
|
|
2220
2631
|
|
|
2221
2632
|
/* ======= Declarations ======= */
|
|
@@ -9867,6 +10278,164 @@ type TailwindcssNoCustomClassname = []|[{
|
|
|
9867
10278
|
}]
|
|
9868
10279
|
// ----- tailwindcss/no-unnecessary-arbitrary-value -----
|
|
9869
10280
|
type TailwindcssNoUnnecessaryArbitraryValue = []|[{}]
|
|
10281
|
+
// ----- vitest/consistent-each-for -----
|
|
10282
|
+
type VitestConsistentEachFor = []|[{
|
|
10283
|
+
|
|
10284
|
+
test?: ("each" | "for")
|
|
10285
|
+
|
|
10286
|
+
it?: ("each" | "for")
|
|
10287
|
+
|
|
10288
|
+
describe?: ("each" | "for")
|
|
10289
|
+
|
|
10290
|
+
suite?: ("each" | "for")
|
|
10291
|
+
}]
|
|
10292
|
+
// ----- vitest/consistent-test-filename -----
|
|
10293
|
+
type VitestConsistentTestFilename = []|[{
|
|
10294
|
+
|
|
10295
|
+
pattern?: string
|
|
10296
|
+
|
|
10297
|
+
allTestPattern?: string
|
|
10298
|
+
}]
|
|
10299
|
+
// ----- vitest/consistent-test-it -----
|
|
10300
|
+
type VitestConsistentTestIt = []|[{
|
|
10301
|
+
|
|
10302
|
+
fn?: ("test" | "it")
|
|
10303
|
+
|
|
10304
|
+
withinDescribe?: ("test" | "it")
|
|
10305
|
+
}]
|
|
10306
|
+
// ----- vitest/consistent-vitest-vi -----
|
|
10307
|
+
type VitestConsistentVitestVi = []|[{
|
|
10308
|
+
|
|
10309
|
+
fn?: ("vi" | "vitest")
|
|
10310
|
+
}]
|
|
10311
|
+
// ----- vitest/expect-expect -----
|
|
10312
|
+
type VitestExpectExpect = []|[{
|
|
10313
|
+
|
|
10314
|
+
assertFunctionNames?: string[]
|
|
10315
|
+
|
|
10316
|
+
additionalTestBlockFunctions?: string[]
|
|
10317
|
+
}]
|
|
10318
|
+
// ----- vitest/max-expects -----
|
|
10319
|
+
type VitestMaxExpects = []|[{
|
|
10320
|
+
|
|
10321
|
+
max?: number
|
|
10322
|
+
}]
|
|
10323
|
+
// ----- vitest/max-nested-describe -----
|
|
10324
|
+
type VitestMaxNestedDescribe = []|[{
|
|
10325
|
+
|
|
10326
|
+
max?: number
|
|
10327
|
+
}]
|
|
10328
|
+
// ----- vitest/no-conditional-expect -----
|
|
10329
|
+
type VitestNoConditionalExpect = []|[{
|
|
10330
|
+
|
|
10331
|
+
expectAssertions?: boolean
|
|
10332
|
+
}]
|
|
10333
|
+
// ----- vitest/no-focused-tests -----
|
|
10334
|
+
type VitestNoFocusedTests = []|[{
|
|
10335
|
+
|
|
10336
|
+
fixable?: boolean
|
|
10337
|
+
}]
|
|
10338
|
+
// ----- vitest/no-hooks -----
|
|
10339
|
+
type VitestNoHooks = []|[{
|
|
10340
|
+
|
|
10341
|
+
allow?: ("beforeAll" | "beforeEach" | "afterAll" | "afterEach" | "aroundAll" | "aroundEach")[]
|
|
10342
|
+
}]
|
|
10343
|
+
// ----- vitest/no-large-snapshots -----
|
|
10344
|
+
type VitestNoLargeSnapshots = []|[{
|
|
10345
|
+
|
|
10346
|
+
maxSize?: number
|
|
10347
|
+
|
|
10348
|
+
inlineMaxSize?: number
|
|
10349
|
+
|
|
10350
|
+
allowedSnapshots?: {
|
|
10351
|
+
[k: string]: unknown[] | undefined
|
|
10352
|
+
}
|
|
10353
|
+
}]
|
|
10354
|
+
// ----- vitest/no-restricted-matchers -----
|
|
10355
|
+
type VitestNoRestrictedMatchers = []|[{
|
|
10356
|
+
[k: string]: (string | null) | undefined
|
|
10357
|
+
}]
|
|
10358
|
+
// ----- vitest/no-restricted-vi-methods -----
|
|
10359
|
+
type VitestNoRestrictedViMethods = []|[{
|
|
10360
|
+
[k: string]: (string | null) | undefined
|
|
10361
|
+
}]
|
|
10362
|
+
// ----- vitest/no-standalone-expect -----
|
|
10363
|
+
type VitestNoStandaloneExpect = []|[{
|
|
10364
|
+
|
|
10365
|
+
additionalTestBlockFunctions?: string[]
|
|
10366
|
+
}]
|
|
10367
|
+
// ----- vitest/prefer-expect-assertions -----
|
|
10368
|
+
type VitestPreferExpectAssertions = []|[{
|
|
10369
|
+
|
|
10370
|
+
onlyFunctionsWithAsyncKeyword?: boolean
|
|
10371
|
+
|
|
10372
|
+
onlyFunctionsWithExpectInLoop?: boolean
|
|
10373
|
+
|
|
10374
|
+
onlyFunctionsWithExpectInCallback?: boolean
|
|
10375
|
+
|
|
10376
|
+
disallowHasAssertions?: boolean
|
|
10377
|
+
}]
|
|
10378
|
+
// ----- vitest/prefer-import-in-mock -----
|
|
10379
|
+
type VitestPreferImportInMock = []|[{
|
|
10380
|
+
|
|
10381
|
+
fixable?: boolean
|
|
10382
|
+
}]
|
|
10383
|
+
// ----- vitest/prefer-lowercase-title -----
|
|
10384
|
+
type VitestPreferLowercaseTitle = []|[{
|
|
10385
|
+
|
|
10386
|
+
ignore?: ("describe" | "test" | "it")[]
|
|
10387
|
+
|
|
10388
|
+
allowedPrefixes?: string[]
|
|
10389
|
+
|
|
10390
|
+
ignoreTopLevelDescribe?: boolean
|
|
10391
|
+
|
|
10392
|
+
lowercaseFirstCharacterOnly?: boolean
|
|
10393
|
+
}]
|
|
10394
|
+
// ----- vitest/prefer-snapshot-hint -----
|
|
10395
|
+
type VitestPreferSnapshotHint = []|[("always" | "multi")]
|
|
10396
|
+
// ----- vitest/require-hook -----
|
|
10397
|
+
type VitestRequireHook = []|[{
|
|
10398
|
+
|
|
10399
|
+
allowedFunctionCalls?: string[]
|
|
10400
|
+
}]
|
|
10401
|
+
// ----- vitest/require-mock-type-parameters -----
|
|
10402
|
+
type VitestRequireMockTypeParameters = []|[{
|
|
10403
|
+
|
|
10404
|
+
checkImportFunctions?: boolean
|
|
10405
|
+
}]
|
|
10406
|
+
// ----- vitest/require-top-level-describe -----
|
|
10407
|
+
type VitestRequireTopLevelDescribe = []|[{
|
|
10408
|
+
|
|
10409
|
+
maxNumberOfTopLevelDescribes?: number
|
|
10410
|
+
}]
|
|
10411
|
+
// ----- vitest/unbound-method -----
|
|
10412
|
+
type VitestUnboundMethod = []|[{
|
|
10413
|
+
|
|
10414
|
+
ignoreStatic?: boolean
|
|
10415
|
+
}]
|
|
10416
|
+
// ----- vitest/valid-expect -----
|
|
10417
|
+
type VitestValidExpect = []|[{
|
|
10418
|
+
|
|
10419
|
+
alwaysAwait?: boolean
|
|
10420
|
+
|
|
10421
|
+
asyncMatchers?: string[]
|
|
10422
|
+
|
|
10423
|
+
minArgs?: number
|
|
10424
|
+
|
|
10425
|
+
maxArgs?: number
|
|
10426
|
+
}]
|
|
10427
|
+
// ----- vitest/valid-title -----
|
|
10428
|
+
type VitestValidTitle = []|[{
|
|
10429
|
+
|
|
10430
|
+
ignoreTypeOfDescribeName?: boolean
|
|
10431
|
+
|
|
10432
|
+
allowArguments?: boolean
|
|
10433
|
+
|
|
10434
|
+
disallowedWords?: string[]
|
|
10435
|
+
[k: string]: (string | [string]|[string, string] | {
|
|
10436
|
+
[k: string]: (string | [string]|[string, string]) | undefined
|
|
10437
|
+
})
|
|
10438
|
+
}]
|
|
9870
10439
|
|
|
9871
10440
|
type ImportsOptions = SharedOptions;
|
|
9872
10441
|
type JsoncOptions = SharedOptions;
|
|
@@ -9930,6 +10499,12 @@ interface TailwindcssOptions extends SharedOptions {
|
|
|
9930
10499
|
}
|
|
9931
10500
|
type TsOptions = SharedOptions;
|
|
9932
10501
|
type UnresolvedLinterConfig = Arraiable<LinterConfig> | Promise<Arraiable<LinterConfig>>;
|
|
10502
|
+
interface VitestOptions extends SharedOptions {
|
|
10503
|
+
/**
|
|
10504
|
+
* Configure shared Vitest settings, such as `typecheck` or custom fixtures.
|
|
10505
|
+
*/
|
|
10506
|
+
settings?: Linter.Config['settings'];
|
|
10507
|
+
}
|
|
9933
10508
|
interface WaltzOptions {
|
|
9934
10509
|
/**
|
|
9935
10510
|
* Treat patterns from `.gitignore` as global ESLint ignores.
|
|
@@ -9986,7 +10561,6 @@ interface WaltzOptions {
|
|
|
9986
10561
|
*
|
|
9987
10562
|
* @default true
|
|
9988
10563
|
* @see https://perfectionist.dev/configs
|
|
9989
|
-
* @see https://perfectionist.dev/rules/sort-jsx-props
|
|
9990
10564
|
*/
|
|
9991
10565
|
perfectionist?: boolean | PerfectionistOptions;
|
|
9992
10566
|
/**
|
|
@@ -10005,12 +10579,11 @@ interface WaltzOptions {
|
|
|
10005
10579
|
*
|
|
10006
10580
|
* This configuration is always enabled and uses `@stylistic/eslint-plugin`.
|
|
10007
10581
|
* It targets JavaScript files by default, and also targets TypeScript files
|
|
10008
|
-
* when `ts` is enabled. Perfectionist
|
|
10009
|
-
*
|
|
10582
|
+
* when `ts` is enabled. Configure Perfectionist sorting separately with the
|
|
10583
|
+
* `perfectionist` option.
|
|
10010
10584
|
*
|
|
10011
10585
|
* @default {}
|
|
10012
10586
|
* @see https://eslint.style/
|
|
10013
|
-
* @see https://perfectionist.dev/rules/sort-jsx-props
|
|
10014
10587
|
*/
|
|
10015
10588
|
stylistic?: StylisticOptions;
|
|
10016
10589
|
/**
|
|
@@ -10043,6 +10616,16 @@ interface WaltzOptions {
|
|
|
10043
10616
|
* @see https://typescript-eslint.io/linting/configs/#recommended-config
|
|
10044
10617
|
*/
|
|
10045
10618
|
ts?: boolean | TsOptions;
|
|
10619
|
+
/**
|
|
10620
|
+
* Enable Vitest-specific rules for test files.
|
|
10621
|
+
*
|
|
10622
|
+
* By default, JavaScript test files matching `*.test.*` or `*.spec.*` are
|
|
10623
|
+
* included. TypeScript test files are included when `ts` is enabled.
|
|
10624
|
+
*
|
|
10625
|
+
* @default false
|
|
10626
|
+
* @see https://github.com/vitest-dev/eslint-plugin-vitest
|
|
10627
|
+
*/
|
|
10628
|
+
vitest?: boolean | VitestOptions;
|
|
10046
10629
|
}
|
|
10047
10630
|
type Arraiable<T> = Array<T> | T;
|
|
10048
10631
|
type Rules = Record<string, Linter.RuleEntry | undefined> & RuleOptions;
|
|
@@ -10050,4 +10633,4 @@ type Rules = Record<string, Linter.RuleEntry | undefined> & RuleOptions;
|
|
|
10050
10633
|
declare function waltz(options?: WaltzOptions, ...orders: LinterConfig[]): Promise<LinterConfig[]>;
|
|
10051
10634
|
|
|
10052
10635
|
export { waltz as default };
|
|
10053
|
-
export type { ImportsOptions, JsOptions, JsoncOptions, LinterConfig, PerfectionistOptions, PerfectionistPreset, ReactOptions, SharedOptions, StylisticOptions, TailwindcssOptions, TsOptions, UnresolvedLinterConfig, WaltzOptions };
|
|
10636
|
+
export type { ImportsOptions, JsOptions, JsoncOptions, LinterConfig, PerfectionistOptions, PerfectionistPreset, ReactOptions, SharedOptions, StylisticOptions, TailwindcssOptions, TsOptions, UnresolvedLinterConfig, VitestOptions, WaltzOptions };
|
package/dist/index.js
CHANGED
|
@@ -49,6 +49,9 @@ function importTypeScriptPlugin() {
|
|
|
49
49
|
function importTypeScriptRecommendedRules() {
|
|
50
50
|
return import('typescript-eslint').then(({ configs }) => Object.assign({}, ...configs.recommended.map(config => config.rules ?? {})));
|
|
51
51
|
}
|
|
52
|
+
function importVitestPlugin() {
|
|
53
|
+
return import('@vitest/eslint-plugin').then(module => module.default);
|
|
54
|
+
}
|
|
52
55
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
53
56
|
function importDefault(moduleName) {
|
|
54
57
|
return import(moduleName).then(m => m.default);
|
|
@@ -69,6 +72,8 @@ async function gitignore(enable) {
|
|
|
69
72
|
|
|
70
73
|
const JS_FILES = '**/*.?([cm])js?(x)';
|
|
71
74
|
const TS_FILES = '**/*.?([cm])ts?(x)';
|
|
75
|
+
const VITEST_JS_FILES = '**/*.{test,spec}.?([cm])js?(x)';
|
|
76
|
+
const VITEST_TS_FILES = '**/*.{test,spec}.?([cm])ts?(x)';
|
|
72
77
|
const JSON_FILES = '**/*.{json,json5,jsonc}';
|
|
73
78
|
const ALL_SCRIPTS_FILES = [JS_FILES, TS_FILES];
|
|
74
79
|
|
|
@@ -772,6 +777,33 @@ async function tsConfig(options = {}) {
|
|
|
772
777
|
];
|
|
773
778
|
}
|
|
774
779
|
|
|
780
|
+
async function vitestConfig(options = {}, relative) {
|
|
781
|
+
const vitest = await importVitestPlugin();
|
|
782
|
+
const testFiles = relative.isEnableTypeScript
|
|
783
|
+
? [VITEST_JS_FILES, VITEST_TS_FILES]
|
|
784
|
+
: [VITEST_JS_FILES];
|
|
785
|
+
const files = options.files ?? testFiles;
|
|
786
|
+
return [
|
|
787
|
+
{
|
|
788
|
+
files,
|
|
789
|
+
languageOptions: vitest.configs.env.languageOptions,
|
|
790
|
+
name: 'waltz/vitest/setup',
|
|
791
|
+
plugins: {
|
|
792
|
+
vitest,
|
|
793
|
+
},
|
|
794
|
+
},
|
|
795
|
+
{
|
|
796
|
+
files,
|
|
797
|
+
name: 'waltz/vitest/rules',
|
|
798
|
+
...(options.settings ? { settings: options.settings } : {}),
|
|
799
|
+
rules: {
|
|
800
|
+
...vitest.configs.recommended.rules,
|
|
801
|
+
...options.overrides,
|
|
802
|
+
},
|
|
803
|
+
},
|
|
804
|
+
];
|
|
805
|
+
}
|
|
806
|
+
|
|
775
807
|
async function waltz(options = {}, ...orders) {
|
|
776
808
|
const isEnableTypeScript = !!options.ts;
|
|
777
809
|
const isEnableReact = !!options.react;
|
|
@@ -826,6 +858,11 @@ async function waltz(options = {}, ...orders) {
|
|
|
826
858
|
isEnableTypeScript,
|
|
827
859
|
}));
|
|
828
860
|
}
|
|
861
|
+
if (options.vitest) {
|
|
862
|
+
configs.push(vitestConfig(options.vitest === true ? {} : options.vitest, {
|
|
863
|
+
isEnableTypeScript,
|
|
864
|
+
}));
|
|
865
|
+
}
|
|
829
866
|
const resolvedConfigs = (await Promise.all(configs)).flat();
|
|
830
867
|
return [...resolvedConfigs, ...orders];
|
|
831
868
|
}
|
package/package.json
CHANGED
|
@@ -1,148 +1,151 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@chanyuxi/eslint-waltz",
|
|
3
|
-
"type": "module",
|
|
4
|
-
"version": "1.
|
|
5
|
-
"packageManager": "pnpm@10.4.1",
|
|
6
|
-
"description": "A composable ESLint flat config for JavaScript, TypeScript, JSONC, imports, React, Tailwind CSS, and
|
|
7
|
-
"author": "chanyuxi <2438149743@qq.com> (https://github.com/chanyuxi)",
|
|
8
|
-
"license": "ISC",
|
|
9
|
-
"homepage": "https://github.com/chanyuxi/eslint-waltz",
|
|
10
|
-
"repository": {
|
|
11
|
-
"type": "git",
|
|
12
|
-
"url": "https://github.com/chanyuxi/eslint-waltz.git"
|
|
13
|
-
},
|
|
14
|
-
"bugs": {
|
|
15
|
-
"url": "https://github.com/chanyuxi/eslint-waltz/issues"
|
|
16
|
-
},
|
|
17
|
-
"publishConfig": {
|
|
18
|
-
"access": "public"
|
|
19
|
-
},
|
|
20
|
-
"keywords": [
|
|
21
|
-
"chanyuxi",
|
|
22
|
-
"eslint",
|
|
23
|
-
"config",
|
|
24
|
-
"integration"
|
|
25
|
-
],
|
|
26
|
-
"exports": {
|
|
27
|
-
".": {
|
|
28
|
-
"types": "./dist/index.d.ts",
|
|
29
|
-
"import": "./dist/index.js",
|
|
30
|
-
"default": "./dist/index.js"
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
"bin": {
|
|
34
|
-
"eslint-waltz": "./dist/cli.js"
|
|
35
|
-
},
|
|
36
|
-
"files": [
|
|
37
|
-
"dist"
|
|
38
|
-
],
|
|
39
|
-
"engines": {
|
|
40
|
-
"node": ">=20.19.0"
|
|
41
|
-
},
|
|
42
|
-
"scripts": {
|
|
43
|
-
"build": "rimraf ./dist && pnpm gen && rollup -c rollup.config.ts --configPlugin @rollup/plugin-typescript",
|
|
44
|
-
"gen": "tsx scripts/typegen.ts",
|
|
45
|
-
"lint": "eslint .",
|
|
46
|
-
"lint:fix": "eslint . --fix",
|
|
47
|
-
"typeCheck": "pnpm gen && tsc --noEmit",
|
|
48
|
-
"test": "
|
|
49
|
-
"check": "pnpm run typeCheck && pnpm run lint && pnpm run test",
|
|
50
|
-
"changeset": "changeset",
|
|
1
|
+
{
|
|
2
|
+
"name": "@chanyuxi/eslint-waltz",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "1.2.0",
|
|
5
|
+
"packageManager": "pnpm@10.4.1",
|
|
6
|
+
"description": "A composable ESLint flat config for JavaScript, TypeScript, JSONC, imports, React, Tailwind CSS, Perfectionist, and Vitest.",
|
|
7
|
+
"author": "chanyuxi <2438149743@qq.com> (https://github.com/chanyuxi)",
|
|
8
|
+
"license": "ISC",
|
|
9
|
+
"homepage": "https://github.com/chanyuxi/eslint-waltz",
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "https://github.com/chanyuxi/eslint-waltz.git"
|
|
13
|
+
},
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/chanyuxi/eslint-waltz/issues"
|
|
16
|
+
},
|
|
17
|
+
"publishConfig": {
|
|
18
|
+
"access": "public"
|
|
19
|
+
},
|
|
20
|
+
"keywords": [
|
|
21
|
+
"chanyuxi",
|
|
22
|
+
"eslint",
|
|
23
|
+
"config",
|
|
24
|
+
"integration"
|
|
25
|
+
],
|
|
26
|
+
"exports": {
|
|
27
|
+
".": {
|
|
28
|
+
"types": "./dist/index.d.ts",
|
|
29
|
+
"import": "./dist/index.js",
|
|
30
|
+
"default": "./dist/index.js"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"bin": {
|
|
34
|
+
"eslint-waltz": "./dist/cli.js"
|
|
35
|
+
},
|
|
36
|
+
"files": [
|
|
37
|
+
"dist"
|
|
38
|
+
],
|
|
39
|
+
"engines": {
|
|
40
|
+
"node": ">=20.19.0"
|
|
41
|
+
},
|
|
42
|
+
"scripts": {
|
|
43
|
+
"build": "rimraf ./dist && pnpm gen && rollup -c rollup.config.ts --configPlugin @rollup/plugin-typescript",
|
|
44
|
+
"gen": "tsx scripts/typegen.ts",
|
|
45
|
+
"lint": "eslint .",
|
|
46
|
+
"lint:fix": "eslint . --fix",
|
|
47
|
+
"typeCheck": "pnpm gen && tsc --noEmit",
|
|
48
|
+
"test": "vitest run",
|
|
49
|
+
"check": "pnpm run typeCheck && pnpm run lint && pnpm run test",
|
|
50
|
+
"changeset": "changeset",
|
|
51
51
|
"version": "changeset version && pnpm install --lockfile-only",
|
|
52
|
-
"release": "pnpm build && changeset publish",
|
|
53
|
-
"prepack": "pnpm build",
|
|
54
|
-
"prepare": "husky"
|
|
55
|
-
},
|
|
56
|
-
"peerDependencies": {
|
|
57
|
-
"@eslint
|
|
58
|
-
"
|
|
59
|
-
"eslint": "^
|
|
60
|
-
"eslint-
|
|
61
|
-
"eslint-plugin-
|
|
62
|
-
"eslint-plugin-
|
|
63
|
-
"eslint-plugin-
|
|
64
|
-
"eslint-plugin-react-
|
|
65
|
-
"eslint-plugin-react-
|
|
66
|
-
"eslint-plugin-react-
|
|
67
|
-
"eslint-plugin-react-
|
|
68
|
-
"eslint-plugin-react-
|
|
69
|
-
"eslint-plugin-
|
|
70
|
-
"eslint-
|
|
71
|
-
"
|
|
72
|
-
"
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
"
|
|
113
|
-
"
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
"@
|
|
117
|
-
"@
|
|
118
|
-
"@
|
|
119
|
-
"@
|
|
120
|
-
"@
|
|
121
|
-
"@
|
|
122
|
-
"
|
|
123
|
-
"
|
|
124
|
-
"eslint-plugin
|
|
125
|
-
"eslint
|
|
126
|
-
"eslint-
|
|
127
|
-
"eslint-plugin-
|
|
128
|
-
"eslint-plugin-
|
|
129
|
-
"eslint-plugin-
|
|
130
|
-
"eslint-plugin-react-
|
|
131
|
-
"eslint-plugin-react-
|
|
132
|
-
"eslint-plugin-react-
|
|
133
|
-
"eslint-plugin-
|
|
134
|
-
"eslint-
|
|
135
|
-
"
|
|
136
|
-
"
|
|
137
|
-
"
|
|
138
|
-
"
|
|
139
|
-
"
|
|
140
|
-
"
|
|
141
|
-
"
|
|
142
|
-
"
|
|
143
|
-
"
|
|
144
|
-
"
|
|
145
|
-
"
|
|
146
|
-
"
|
|
147
|
-
|
|
148
|
-
|
|
52
|
+
"release": "pnpm build && changeset publish",
|
|
53
|
+
"prepack": "pnpm build",
|
|
54
|
+
"prepare": "husky"
|
|
55
|
+
},
|
|
56
|
+
"peerDependencies": {
|
|
57
|
+
"@vitest/eslint-plugin": "^1.6.27",
|
|
58
|
+
"eslint": "^10.10.0",
|
|
59
|
+
"eslint-config-flat-gitignore": "^2.4.0",
|
|
60
|
+
"eslint-plugin-import-x": "^4.17.1",
|
|
61
|
+
"eslint-plugin-jsonc": "^3.4.2",
|
|
62
|
+
"eslint-plugin-perfectionist": "^5.11.0",
|
|
63
|
+
"eslint-plugin-react-debug": "^5.19.0",
|
|
64
|
+
"eslint-plugin-react-dom": "^5.19.0",
|
|
65
|
+
"eslint-plugin-react-hooks-extra": "^2.13.0",
|
|
66
|
+
"eslint-plugin-react-naming-convention": "^5.19.0",
|
|
67
|
+
"eslint-plugin-react-web-api": "^5.19.0",
|
|
68
|
+
"eslint-plugin-react-x": "^5.19.0",
|
|
69
|
+
"eslint-plugin-tailwindcss": "^4.4.0",
|
|
70
|
+
"jsonc-eslint-parser": "^3.3.0",
|
|
71
|
+
"tailwindcss": "^4.0.0",
|
|
72
|
+
"typescript-eslint": "^8.70.0"
|
|
73
|
+
},
|
|
74
|
+
"peerDependenciesMeta": {
|
|
75
|
+
"@vitest/eslint-plugin": {
|
|
76
|
+
"optional": true
|
|
77
|
+
},
|
|
78
|
+
"eslint-config-flat-gitignore": {
|
|
79
|
+
"optional": true
|
|
80
|
+
},
|
|
81
|
+
"eslint-plugin-react-debug": {
|
|
82
|
+
"optional": true
|
|
83
|
+
},
|
|
84
|
+
"eslint-plugin-react-dom": {
|
|
85
|
+
"optional": true
|
|
86
|
+
},
|
|
87
|
+
"eslint-plugin-react-hooks-extra": {
|
|
88
|
+
"optional": true
|
|
89
|
+
},
|
|
90
|
+
"eslint-plugin-react-naming-convention": {
|
|
91
|
+
"optional": true
|
|
92
|
+
},
|
|
93
|
+
"eslint-plugin-react-web-api": {
|
|
94
|
+
"optional": true
|
|
95
|
+
},
|
|
96
|
+
"eslint-plugin-react-x": {
|
|
97
|
+
"optional": true
|
|
98
|
+
},
|
|
99
|
+
"eslint-plugin-tailwindcss": {
|
|
100
|
+
"optional": true
|
|
101
|
+
},
|
|
102
|
+
"tailwindcss": {
|
|
103
|
+
"optional": true
|
|
104
|
+
},
|
|
105
|
+
"typescript-eslint": {
|
|
106
|
+
"optional": true
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
"dependencies": {
|
|
110
|
+
"@eslint/js": "^10.0.1",
|
|
111
|
+
"@stylistic/eslint-plugin": "^5.10.0",
|
|
112
|
+
"globals": "^17.12.0",
|
|
113
|
+
"jsonc-parser": "^3.3.1"
|
|
114
|
+
},
|
|
115
|
+
"devDependencies": {
|
|
116
|
+
"@changesets/cli": "^3.0.2",
|
|
117
|
+
"@commitlint/cli": "^19.8.1",
|
|
118
|
+
"@commitlint/config-conventional": "^19.8.1",
|
|
119
|
+
"@commitlint/types": "^19.8.1",
|
|
120
|
+
"@rollup/plugin-commonjs": "^28.0.6",
|
|
121
|
+
"@rollup/plugin-node-resolve": "^16.0.1",
|
|
122
|
+
"@rollup/plugin-typescript": "^12.1.4",
|
|
123
|
+
"@types/node": "^24.1.0",
|
|
124
|
+
"@vitest/eslint-plugin": "^1.6.27",
|
|
125
|
+
"eslint": "^10.10.0",
|
|
126
|
+
"eslint-config-flat-gitignore": "^2.4.0",
|
|
127
|
+
"eslint-plugin-import-x": "^4.17.1",
|
|
128
|
+
"eslint-plugin-jsonc": "^3.4.2",
|
|
129
|
+
"eslint-plugin-perfectionist": "^5.11.0",
|
|
130
|
+
"eslint-plugin-react-debug": "^5.19.0",
|
|
131
|
+
"eslint-plugin-react-dom": "^5.19.0",
|
|
132
|
+
"eslint-plugin-react-hooks-extra": "^2.13.0",
|
|
133
|
+
"eslint-plugin-react-naming-convention": "^5.19.0",
|
|
134
|
+
"eslint-plugin-react-web-api": "^5.19.0",
|
|
135
|
+
"eslint-plugin-react-x": "^5.19.0",
|
|
136
|
+
"eslint-plugin-tailwindcss": "^4.4.0",
|
|
137
|
+
"eslint-typegen": "^2.3.1",
|
|
138
|
+
"husky": "^9.1.7",
|
|
139
|
+
"jiti": "^2.7.0",
|
|
140
|
+
"jsonc-eslint-parser": "^3.3.0",
|
|
141
|
+
"rimraf": "^6.0.1",
|
|
142
|
+
"rollup": "^4.46.2",
|
|
143
|
+
"rollup-plugin-dts": "^6.2.1",
|
|
144
|
+
"tailwindcss": "^4.3.3",
|
|
145
|
+
"tslib": "^2.8.1",
|
|
146
|
+
"tsx": "^4.20.3",
|
|
147
|
+
"typescript": "^5.8.3",
|
|
148
|
+
"typescript-eslint": "^8.70.0",
|
|
149
|
+
"vitest": "^4.0.18"
|
|
150
|
+
}
|
|
151
|
+
}
|