Skip to content

Commit

Permalink
flat configs support (#407)
Browse files Browse the repository at this point in the history
* feat: try flat configs

* chore: update

* chore: update

* chore: update

* chore: update
  • Loading branch information
veritem committed Apr 5, 2024
1 parent c3f4d11 commit 9885b9f
Show file tree
Hide file tree
Showing 63 changed files with 327 additions and 311 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
name: ci

on:
push:

jobs:
test:
runs-on: ubuntu-latest
Expand All @@ -9,7 +11,7 @@ jobs:

strategy:
matrix:
node-version: [16.x, 18.x]
node-version: [18.x, 19.x]
os: [ubuntu-latest, windows-latest]

fail-fast: false
Expand Down
110 changes: 54 additions & 56 deletions README.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/rules/consistent-test-filename.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Forbidden .spec test file pattern (`vitest/consistent-test-filename`)

⚠️ This rule _warns_ in the 🌐 `all` config.
⚠️ This rule _warns_ in the `all-legacy` config.

<!-- end auto-generated rule header -->

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/consistent-test-it.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Prefer test or it but not both (`vitest/consistent-test-it`)

⚠️ This rule _warns_ in the 🌐 `all` config.
⚠️ This rule _warns_ in the `all-legacy` config.

🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/expect-expect.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Enforce having expectation in test body (`vitest/expect-expect`)

💼 This rule is enabled in the `recommended` config.
💼 This rule is enabled in the `recommended-legacy` config.

<!-- end auto-generated rule header -->

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/max-expects.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Enforce a maximum number of expect per test (`vitest/max-expects`)

⚠️ This rule _warns_ in the 🌐 `all` config.
⚠️ This rule _warns_ in the `all-legacy` config.

<!-- end auto-generated rule header -->

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/max-nested-describe.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Nested describe block should be less than set max value or default value (`vitest/max-nested-describe`)

⚠️ This rule _warns_ in the 🌐 `all` config.
⚠️ This rule _warns_ in the `all-legacy` config.

<!-- end auto-generated rule header -->

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-alias-methods.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Disallow alias methods (`vitest/no-alias-methods`)

⚠️ This rule _warns_ in the 🌐 `all` config.
⚠️ This rule _warns_ in the `all-legacy` config.

🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-commented-out-tests.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Disallow commented out tests (`vitest/no-commented-out-tests`)

💼 This rule is enabled in the `recommended` config.
💼 This rule is enabled in the `recommended-legacy` config.

<!-- end auto-generated rule header -->

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-conditional-expect.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Disallow conditional expects (`vitest/no-conditional-expect`)

⚠️ This rule _warns_ in the 🌐 `all` config.
⚠️ This rule _warns_ in the `all-legacy` config.

<!-- end auto-generated rule header -->

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-conditional-in-test.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Disallow conditional tests (`vitest/no-conditional-in-test`)

⚠️ This rule _warns_ in the 🌐 `all` config.
⚠️ This rule _warns_ in the `all-legacy` config.

<!-- end auto-generated rule header -->
### Rule Details
Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-conditional-tests.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Disallow conditional tests (`vitest/no-conditional-tests`)

⚠️ This rule _warns_ in the 🌐 `all` config.
⚠️ This rule _warns_ in the `all-legacy` config.

<!-- end auto-generated rule header -->

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-disabled-tests.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Disallow disabled tests (`vitest/no-disabled-tests`)

⚠️ This rule _warns_ in the 🌐 `all` config.
⚠️ This rule _warns_ in the `all-legacy` config.

<!-- end auto-generated rule header -->

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-done-callback.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

❌ This rule is deprecated.

⚠️ This rule _warns_ in the 🌐 `all` config.
⚠️ This rule _warns_ in the `all-legacy` config.

💡 This rule is manually fixable by [editor suggestions](https://eslint.org/docs/latest/use/core-concepts#rule-suggestions).

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-duplicate-hooks.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Disallow duplicate hooks and teardown hooks (`vitest/no-duplicate-hooks`)

⚠️ This rule _warns_ in the 🌐 `all` config.
⚠️ This rule _warns_ in the `all-legacy` config.

<!-- end auto-generated rule header -->

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-focused-tests.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Disallow focused tests (`vitest/no-focused-tests`)

⚠️ This rule _warns_ in the 🌐 `all` config.
⚠️ This rule _warns_ in the `all-legacy` config.

🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-hooks.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Disallow setup and teardown hooks (`vitest/no-hooks`)

⚠️ This rule _warns_ in the 🌐 `all` config.
⚠️ This rule _warns_ in the `all-legacy` config.

<!-- end auto-generated rule header -->

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-identical-title.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Disallow identical titles (`vitest/no-identical-title`)

💼 This rule is enabled in the `recommended` config.
💼 This rule is enabled in the `recommended-legacy` config.

🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-import-node-test.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Disallow importing `node:test` (`vitest/no-import-node-test`)

💼 This rule is enabled in the `recommended` config.
💼 This rule is enabled in the `recommended-legacy` config.

🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-interpolation-in-snapshots.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Disallow string interpolation in snapshots (`vitest/no-interpolation-in-snapshots`)

⚠️ This rule _warns_ in the 🌐 `all` config.
⚠️ This rule _warns_ in the `all-legacy` config.

🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-large-snapshots.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Disallow large snapshots (`vitest/no-large-snapshots`)

⚠️ This rule _warns_ in the 🌐 `all` config.
⚠️ This rule _warns_ in the `all-legacy` config.

<!-- end auto-generated rule header -->

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-mocks-import.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Disallow importing from __mocks__ directory (`vitest/no-mocks-import`)

⚠️ This rule _warns_ in the 🌐 `all` config.
⚠️ This rule _warns_ in the `all-legacy` config.

<!-- end auto-generated rule header -->

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-restricted-matchers.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Disallow the use of certain matchers (`vitest/no-restricted-matchers`)

⚠️ This rule _warns_ in the 🌐 `all` config.
⚠️ This rule _warns_ in the `all-legacy` config.

<!-- end auto-generated rule header -->

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-restricted-vi-methods.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Disallow specific `vi.` methods (`vitest/no-restricted-vi-methods`)

⚠️ This rule _warns_ in the 🌐 `all` config.
⚠️ This rule _warns_ in the `all-legacy` config.

<!-- end auto-generated rule header -->

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-standalone-expect.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Disallow using `expect` outside of `it` or `test` blocks (`vitest/no-standalone-expect`)

⚠️ This rule _warns_ in the 🌐 `all` config.
⚠️ This rule _warns_ in the `all-legacy` config.

<!-- end auto-generated rule header -->

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-test-prefixes.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Disallow using `test` as a prefix (`vitest/no-test-prefixes`)

⚠️ This rule _warns_ in the 🌐 `all` config.
⚠️ This rule _warns_ in the `all-legacy` config.

🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-test-return-statement.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Disallow return statements in tests (`vitest/no-test-return-statement`)

⚠️ This rule _warns_ in the 🌐 `all` config.
⚠️ This rule _warns_ in the `all-legacy` config.

<!-- end auto-generated rule header -->

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/prefer-called-with.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Suggest using `toBeCalledWith()` or `toHaveBeenCalledWith()` (`vitest/prefer-called-with`)

⚠️ This rule _warns_ in the 🌐 `all` config.
⚠️ This rule _warns_ in the `all-legacy` config.

🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/prefer-comparison-matcher.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Suggest using the built-in comparison matchers (`vitest/prefer-comparison-matcher`)

⚠️ This rule _warns_ in the 🌐 `all` config.
⚠️ This rule _warns_ in the `all-legacy` config.

🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/prefer-each.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Prefer `each` rather than manual loops (`vitest/prefer-each`)

⚠️ This rule _warns_ in the 🌐 `all` config.
⚠️ This rule _warns_ in the `all-legacy` config.

<!-- end auto-generated rule header -->

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/prefer-equality-matcher.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Suggest using the built-in quality matchers (`vitest/prefer-equality-matcher`)

⚠️ This rule _warns_ in the 🌐 `all` config.
⚠️ This rule _warns_ in the `all-legacy` config.

💡 This rule is manually fixable by [editor suggestions](https://eslint.org/docs/latest/use/core-concepts#rule-suggestions).

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/prefer-expect-assertions.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Suggest using expect assertions instead of callbacks (`vitest/prefer-expect-assertions`)

⚠️ This rule _warns_ in the 🌐 `all` config.
⚠️ This rule _warns_ in the `all-legacy` config.

💡 This rule is manually fixable by [editor suggestions](https://eslint.org/docs/latest/use/core-concepts#rule-suggestions).

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/prefer-expect-resolves.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Suggest using `expect().resolves` over `expect(await ...)` syntax (`vitest/prefer-expect-resolves`)

⚠️ This rule _warns_ in the 🌐 `all` config.
⚠️ This rule _warns_ in the `all-legacy` config.

🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/prefer-hooks-in-order.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Prefer having hooks in consistent order (`vitest/prefer-hooks-in-order`)

⚠️ This rule _warns_ in the 🌐 `all` config.
⚠️ This rule _warns_ in the `all-legacy` config.

<!-- end auto-generated rule header -->

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/prefer-hooks-on-top.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Suggest having hooks before any test cases (`vitest/prefer-hooks-on-top`)

⚠️ This rule _warns_ in the 🌐 `all` config.
⚠️ This rule _warns_ in the `all-legacy` config.

<!-- end auto-generated rule header -->
```ts
Expand Down
2 changes: 1 addition & 1 deletion docs/rules/prefer-lowercase-title.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Enforce lowercase titles (`vitest/prefer-lowercase-title`)

⚠️ This rule _warns_ in the 🌐 `all` config.
⚠️ This rule _warns_ in the `all-legacy` config.

🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/prefer-mock-promise-shorthand.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Prefer mock resolved/rejected shorthands for promises (`vitest/prefer-mock-promise-shorthand`)

⚠️ This rule _warns_ in the 🌐 `all` config.
⚠️ This rule _warns_ in the `all-legacy` config.

🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/prefer-snapshot-hint.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Prefer including a hint with external snapshots (`vitest/prefer-snapshot-hint`)

⚠️ This rule _warns_ in the 🌐 `all` config.
⚠️ This rule _warns_ in the `all-legacy` config.

<!-- end auto-generated rule header -->

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/prefer-spy-on.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Suggest using `vi.spyOn` (`vitest/prefer-spy-on`)

⚠️ This rule _warns_ in the 🌐 `all` config.
⚠️ This rule _warns_ in the `all-legacy` config.

🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/prefer-strict-equal.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Prefer strict equal over equal (`vitest/prefer-strict-equal`)

⚠️ This rule _warns_ in the 🌐 `all` config.
⚠️ This rule _warns_ in the `all-legacy` config.

💡 This rule is manually fixable by [editor suggestions](https://eslint.org/docs/latest/use/core-concepts#rule-suggestions).

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/prefer-to-be-falsy.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Suggest using toBeFalsy() (`vitest/prefer-to-be-falsy`)

⚠️ This rule _warns_ in the 🌐 `all` config.
⚠️ This rule _warns_ in the `all-legacy` config.

🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/prefer-to-be-object.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Prefer toBeObject() (`vitest/prefer-to-be-object`)

⚠️ This rule _warns_ in the 🌐 `all` config.
⚠️ This rule _warns_ in the `all-legacy` config.

🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/prefer-to-be-truthy.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Suggest using `toBeTruthy` (`vitest/prefer-to-be-truthy`)

⚠️ This rule _warns_ in the 🌐 `all` config.
⚠️ This rule _warns_ in the `all-legacy` config.

🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/prefer-to-be.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Suggest using toBe() (`vitest/prefer-to-be`)

⚠️ This rule _warns_ in the 🌐 `all` config.
⚠️ This rule _warns_ in the `all-legacy` config.

🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/prefer-to-contain.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Prefer using toContain() (`vitest/prefer-to-contain`)

⚠️ This rule _warns_ in the 🌐 `all` config.
⚠️ This rule _warns_ in the `all-legacy` config.

🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/prefer-to-have-length.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Suggest using toHaveLength() (`vitest/prefer-to-have-length`)

⚠️ This rule _warns_ in the 🌐 `all` config.
⚠️ This rule _warns_ in the `all-legacy` config.

🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/prefer-todo.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Suggest using `test.todo` (`vitest/prefer-todo`)

⚠️ This rule _warns_ in the 🌐 `all` config.
⚠️ This rule _warns_ in the `all-legacy` config.

🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/require-hook.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Require setup and teardown to be within a hook (`vitest/require-hook`)

⚠️ This rule _warns_ in the 🌐 `all` config.
⚠️ This rule _warns_ in the `all-legacy` config.

<!-- end auto-generated rule header -->

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Require local Test Context for concurrent snapshot tests (`vitest/require-local-test-context-for-concurrent-snapshots`)

💼 This rule is enabled in the `recommended` config.
💼 This rule is enabled in the `recommended-legacy` config.

<!-- end auto-generated rule header -->

Expand Down
Loading

0 comments on commit 9885b9f

Please sign in to comment.