Skip to content

Commit

Permalink
experimental support for eslint flat config files (#216)
Browse files Browse the repository at this point in the history
* feat: adding experimental support for eslint flat files

* feat: updated
  • Loading branch information
veritem committed Jul 27, 2023
1 parent d55e5b0 commit 7a14a8f
Show file tree
Hide file tree
Showing 58 changed files with 717 additions and 980 deletions.
106 changes: 51 additions & 55 deletions README.md

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions docs/rules/consistent-test-filename.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Forbidden .spec test file pattern (`vitest/consistent-test-filename`)

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

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

### Rule Details
Expand Down
2 changes: 0 additions & 2 deletions docs/rules/consistent-test-it.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Prefer test or it but not both (`vitest/consistent-test-it`)

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

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

<!-- end auto-generated rule header -->
Expand Down
2 changes: 0 additions & 2 deletions docs/rules/expect-expect.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Enforce having expectation in test body (`vitest/expect-expect`)

💼 This rule is enabled in the ✅ `recommended` config.

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

## Rule Details
Expand Down
2 changes: 0 additions & 2 deletions docs/rules/max-expects.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Enforce a maximum number of expect per test (`vitest/max-expects`)

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

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

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

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

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

## Rule Details
Expand Down
2 changes: 0 additions & 2 deletions docs/rules/no-alias-methods.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Disallow alias methods (`vitest/no-alias-methods`)

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

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

<!-- end auto-generated rule header -->
Expand Down
2 changes: 0 additions & 2 deletions docs/rules/no-commented-out-tests.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Disallow commented out tests (`vitest/no-commented-out-tests`)

💼 This rule is enabled in the ✅ `recommended` config.

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

## Rule Details
Expand Down
2 changes: 0 additions & 2 deletions docs/rules/no-conditional-expect.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Disallow conditional expects (`vitest/no-conditional-expect`)

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

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

## Rule Details
Expand Down
2 changes: 0 additions & 2 deletions docs/rules/no-conditional-in-test.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Disallow conditional tests (`vitest/no-conditional-in-test`)

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

<!-- end auto-generated rule header -->
### Rule Details

Expand Down
2 changes: 0 additions & 2 deletions docs/rules/no-conditional-tests.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Disallow conditional tests (`vitest/no-conditional-tests`)

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

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

## Rule Details
Expand Down
2 changes: 0 additions & 2 deletions docs/rules/no-disabled-tests.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Disallow disabled tests (`vitest/no-disabled-tests`)

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

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

## Rule Details
Expand Down
2 changes: 0 additions & 2 deletions docs/rules/no-done-callback.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Disallow using a callback in asynchronous tests and hooks (`vitest/no-done-callback`)

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

💡 This rule is manually fixable by [editor suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions).

<!-- end auto-generated rule header -->
Expand Down
2 changes: 0 additions & 2 deletions docs/rules/no-duplicate-hooks.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Disallow duplicate hooks and teardown hooks (`vitest/no-duplicate-hooks`)

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

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

## Rule Details
Expand Down
2 changes: 0 additions & 2 deletions docs/rules/no-focused-tests.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Disallow focused tests (`vitest/no-focused-tests`)

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

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

<!-- end auto-generated rule header -->
Expand Down
2 changes: 0 additions & 2 deletions docs/rules/no-hooks.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Disallow setup and teardown hooks (`vitest/no-hooks`)

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

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

## Rule details
Expand Down
2 changes: 0 additions & 2 deletions docs/rules/no-identical-title.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Disallow identical titles (`vitest/no-identical-title`)

💼 This rule is enabled in the ✅ `recommended` config.

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

<!-- end auto-generated rule header -->
Expand Down
2 changes: 0 additions & 2 deletions docs/rules/no-interpolation-in-snapshots.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Disallow string interpolation in snapshots (`vitest/no-interpolation-in-snapshots`)

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

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

<!-- end auto-generated rule header -->
Expand Down
2 changes: 0 additions & 2 deletions docs/rules/no-large-snapshots.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Disallow large snapshots (`vitest/no-large-snapshots`)

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

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

## Rule Details
Expand Down
2 changes: 0 additions & 2 deletions docs/rules/no-mocks-import.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Disallow importing from __mocks__ directory (`vitest/no-mocks-import`)

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

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

## Rule Details
Expand Down
2 changes: 0 additions & 2 deletions docs/rules/no-restricted-matchers.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Disallow the use of certain matchers (`vitest/no-restricted-matchers`)

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

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

### Rule Details
Expand Down
2 changes: 0 additions & 2 deletions docs/rules/no-restricted-vi-methods.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Disallow specific `vi.` methods (`vitest/no-restricted-vi-methods`)

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

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

You may wish to restrict the use of specific `vi` methods.
Expand Down
2 changes: 0 additions & 2 deletions docs/rules/no-standalone-expect.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Disallow using `expect` outside of `it` or `test` blocks (`vitest/no-standalone-expect`)

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

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

## Rule Details
Expand Down
2 changes: 0 additions & 2 deletions docs/rules/no-test-prefixes.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Disallow using `test` as a prefix (`vitest/no-test-prefixes`)

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

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

<!-- end auto-generated rule header -->
Expand Down
2 changes: 0 additions & 2 deletions docs/rules/no-test-return-statement.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Disallow return statements in tests (`vitest/no-test-return-statement`)

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

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

### Rule Details
Expand Down
2 changes: 0 additions & 2 deletions docs/rules/prefer-called-with.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Suggest using `toBeCalledWith()` or `toHaveBeenCalledWith()` (`vitest/prefer-called-with`)

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

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

<!-- end auto-generated rule header -->
Expand Down
2 changes: 0 additions & 2 deletions docs/rules/prefer-comparison-matcher.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Suggest using the built-in comparison matchers (`vitest/prefer-comparison-matcher`)

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

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

<!-- end auto-generated rule header -->
Expand Down
2 changes: 0 additions & 2 deletions docs/rules/prefer-each.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Prefer `each` rather than manual loops (`vitest/prefer-each`)

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

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

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

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

💡 This rule is manually fixable by [editor suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions).

<!-- end auto-generated rule header -->
Expand Down
2 changes: 0 additions & 2 deletions docs/rules/prefer-expect-resolves.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Suggest using `expect().resolves` over `expect(await ...)` syntax (`vitest/prefer-expect-resolves`)

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

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

<!-- end auto-generated rule header -->
Expand Down
2 changes: 0 additions & 2 deletions docs/rules/prefer-hooks-in-order.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Prefer having hooks in consistent order (`vitest/prefer-hooks-in-order`)

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

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

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

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

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

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

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

<!-- end auto-generated rule header -->
Expand Down
2 changes: 0 additions & 2 deletions docs/rules/prefer-mock-promise-shorthand.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Prefer mock resolved/rejected shorthands for promises (`vitest/prefer-mock-promise-shorthand`)

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

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

<!-- end auto-generated rule header -->
Expand Down
2 changes: 0 additions & 2 deletions docs/rules/prefer-snapshot-hint.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Prefer including a hint with external snapshots (`vitest/prefer-snapshot-hint`)

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

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

When working with external snapshot matchers it's considered best practice to
Expand Down
2 changes: 0 additions & 2 deletions docs/rules/prefer-spy-on.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Suggest using `vi.spyOn` (`vitest/prefer-spy-on`)

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

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

<!-- end auto-generated rule header -->
Expand Down
2 changes: 0 additions & 2 deletions docs/rules/prefer-strict-equal.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Prefer strict equal over equal (`vitest/prefer-strict-equal`)

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

💡 This rule is manually fixable by [editor suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions).

<!-- end auto-generated rule header -->
Expand Down
2 changes: 0 additions & 2 deletions docs/rules/prefer-to-be-falsy.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Suggest using toBeFalsy() (`vitest/prefer-to-be-falsy`)

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

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

<!-- end auto-generated rule header -->
Expand Down
2 changes: 0 additions & 2 deletions docs/rules/prefer-to-be-object.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Prefer toBeObject() (`vitest/prefer-to-be-object`)

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

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

<!-- end auto-generated rule header -->
Expand Down
2 changes: 0 additions & 2 deletions docs/rules/prefer-to-be-truthy.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Suggest using `toBeTruthy` (`vitest/prefer-to-be-truthy`)

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

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

<!-- end auto-generated rule header -->
Expand Down
2 changes: 0 additions & 2 deletions docs/rules/prefer-to-be.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Suggest using toBe() (`vitest/prefer-to-be`)

💼 This rule is enabled in the ✅ `recommended` config.

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

<!-- end auto-generated rule header -->
Expand Down
2 changes: 0 additions & 2 deletions docs/rules/prefer-to-contain.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Prefer using toContain() (`vitest/prefer-to-contain`)

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

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

<!-- end auto-generated rule header -->
Expand Down
2 changes: 0 additions & 2 deletions docs/rules/prefer-to-have-length.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Suggest using toHaveLength() (`vitest/prefer-to-have-length`)

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

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

<!-- end auto-generated rule header -->
Expand Down
2 changes: 0 additions & 2 deletions docs/rules/prefer-todo.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Suggest using `test.todo` (`vitest/prefer-todo`)

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

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

<!-- end auto-generated rule header -->
Expand Down
2 changes: 0 additions & 2 deletions docs/rules/require-hook.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Require setup and teardown to be within a hook (`vitest/require-hook`)

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

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

It's common when writing tests to need to perform a particular setup work before and after a test suite run. Because Vitest executes all `describe` handlers in a test file _before_ it executes any of the actual tests, it's important to ensure setup and teardown work is done inside `before*` and `after*` handlers respectively, rather than inside the `describe` blocks.
Expand Down
2 changes: 0 additions & 2 deletions docs/rules/require-to-throw-message.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Require toThrow() to be called with an error message (`vitest/require-to-throw-message`)

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

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

This rule triggers a warning if `toThrow()` or `toThrowError()` is used without
Expand Down
2 changes: 0 additions & 2 deletions docs/rules/require-top-level-describe.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Enforce that all tests are in a top-level describe (`vitest/require-top-level-describe`)

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

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

This rule triggers warning if a test case (`test` and `it`) or a hook (`beforeAll`, `beforeEach`, `afterEach`, `afterAll`) is not located in a top-level `describe` block.
Expand Down
2 changes: 0 additions & 2 deletions docs/rules/valid-describe-callback.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Enforce valid describe callback (`vitest/valid-describe-callback`)

💼 This rule is enabled in the ✅ `recommended` config.

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


Expand Down
2 changes: 0 additions & 2 deletions docs/rules/valid-expect.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Enforce valid `expect()` usage (`vitest/valid-expect`)

💼 This rule is enabled in the ✅ `recommended` config.

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

This rule triggers a warning if `expect` is called with no argument or with more than one argument. You change that behavior by setting the `minArgs` and `maxArgs` options.
Expand Down
2 changes: 0 additions & 2 deletions docs/rules/valid-title.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Enforce valid titles (`vitest/valid-title`)

💼 This rule is enabled in the ✅ `recommended` config.

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

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

0 comments on commit 7a14a8f

Please sign in to comment.