Skip to content

Commit

Permalink
docs: add eslint-doc-generator
Browse files Browse the repository at this point in the history
  • Loading branch information
bmish committed Oct 19, 2022
1 parent 5b1f0ba commit 3a72a8b
Show file tree
Hide file tree
Showing 54 changed files with 181 additions and 714 deletions.
143 changes: 71 additions & 72 deletions README.md

Large diffs are not rendered by default.

11 changes: 2 additions & 9 deletions docs/rules/consistent-test-it.md
@@ -1,12 +1,7 @@
# Have control over `test` and `it` usages (`consistent-test-it`)

💼 This rule is enabled in the following
[configs](https://github.com/jest-community/eslint-plugin-jest/blob/main/README.md#shareable-configurations):
`all`.

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

<!-- end rule header -->

Expand Down Expand Up @@ -81,8 +76,6 @@ describe('foo', function () {
});
```

### Default configuration

The default configuration forces all top-level tests to use `test` and all tests
nested within `describe` to use `it`.

Expand Down
4 changes: 0 additions & 4 deletions docs/rules/expect-expect.md
@@ -1,9 +1,5 @@
# Enforce assertion to be made in a test body (`expect-expect`)

💼 This rule is enabled in the following
[configs](https://github.com/jest-community/eslint-plugin-jest/blob/main/README.md#shareable-configurations):
`all`.

<!-- end rule header -->

Ensure that there is at least one `expect` call made in a test.
Expand Down
4 changes: 0 additions & 4 deletions docs/rules/max-expects.md
@@ -1,9 +1,5 @@
# Enforces a maximum number assertion calls in a test body (`max-expects`)

💼 This rule is enabled in the following
[configs](https://github.com/jest-community/eslint-plugin-jest/blob/main/README.md#shareable-configurations):
`all`.

<!-- end rule header -->

As more assertions are made, there is a possible tendency for the test to be
Expand Down
4 changes: 0 additions & 4 deletions docs/rules/max-nested-describe.md
@@ -1,9 +1,5 @@
# Enforces a maximum depth to nested describe calls (`max-nested-describe`)

💼 This rule is enabled in the following
[configs](https://github.com/jest-community/eslint-plugin-jest/blob/main/README.md#shareable-configurations):
`all`.

<!-- end rule header -->

While it's useful to be able to group your tests together within the same file
Expand Down
14 changes: 5 additions & 9 deletions docs/rules/no-alias-methods.md
@@ -1,17 +1,15 @@
# Disallow alias methods (`no-alias-methods`)

💼 This rule is enabled in the following
[configs](https://github.com/jest-community/eslint-plugin-jest/blob/main/README.md#shareable-configurations):
`all`, `recommended`.
✅ This rule is enabled in the `recommended`
[config](https://github.com/jest-community/eslint-plugin-jest/blob/main/README.md#shareable-configurations).

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

<!-- end rule header -->

> These aliases are going to be removed in the next major version of Jest - see
> https://github.com/facebook/jest/issues/13164 for more
> <https://github.com/facebook/jest/issues/13164> for more
Several Jest methods have alias names, such as `toThrow` having the alias of
`toThrowError`. This rule ensures that only the canonical name as used in the
Expand All @@ -24,8 +22,6 @@ method names used.
This rule triggers a warning if the alias name, rather than the canonical name,
of a method is used.

### Default configuration

The following patterns are considered warnings:

```js
Expand Down
4 changes: 0 additions & 4 deletions docs/rules/no-commented-out-tests.md
@@ -1,9 +1,5 @@
# Disallow commented out tests (`no-commented-out-tests`)

💼 This rule is enabled in the following
[configs](https://github.com/jest-community/eslint-plugin-jest/blob/main/README.md#shareable-configurations):
`all`.

<!-- end rule header -->

This rule raises a warning about commented out tests. It's similar to
Expand Down
5 changes: 2 additions & 3 deletions docs/rules/no-conditional-expect.md
@@ -1,8 +1,7 @@
# Prevent calling `expect` conditionally (`no-conditional-expect`)

💼 This rule is enabled in the following
[configs](https://github.com/jest-community/eslint-plugin-jest/blob/main/README.md#shareable-configurations):
`all`, `recommended`.
✅ This rule is enabled in the `recommended`
[config](https://github.com/jest-community/eslint-plugin-jest/blob/main/README.md#shareable-configurations).

<!-- end rule header -->

Expand Down
4 changes: 0 additions & 4 deletions docs/rules/no-conditional-in-test.md
@@ -1,9 +1,5 @@
# Disallow conditional logic in tests (`no-conditional-in-test`)

💼 This rule is enabled in the following
[configs](https://github.com/jest-community/eslint-plugin-jest/blob/main/README.md#shareable-configurations):
`all`.

<!-- end rule header -->

Conditional logic in tests is usually an indication that a test is attempting to
Expand Down
10 changes: 4 additions & 6 deletions docs/rules/no-deprecated-functions.md
@@ -1,12 +1,10 @@
# Disallow use of deprecated functions (`no-deprecated-functions`)

💼 This rule is enabled in the following
[configs](https://github.com/jest-community/eslint-plugin-jest/blob/main/README.md#shareable-configurations):
`all`, `recommended`.
✅ This rule is enabled in the `recommended`
[config](https://github.com/jest-community/eslint-plugin-jest/blob/main/README.md#shareable-configurations).

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

<!-- end rule header -->

Expand Down
4 changes: 0 additions & 4 deletions docs/rules/no-disabled-tests.md
@@ -1,9 +1,5 @@
# Disallow disabled tests (`no-disabled-tests`)

💼 This rule is enabled in the following
[configs](https://github.com/jest-community/eslint-plugin-jest/blob/main/README.md#shareable-configurations):
`all`.

<!-- end rule header -->

Jest has a feature that allows you to temporarily mark tests as disabled. This
Expand Down
10 changes: 4 additions & 6 deletions docs/rules/no-done-callback.md
@@ -1,12 +1,10 @@
# Avoid using a callback in asynchronous tests and hooks (`no-done-callback`)

💼 This rule is enabled in the following
[configs](https://github.com/jest-community/eslint-plugin-jest/blob/main/README.md#shareable-configurations):
`all`, `recommended`.
✅ This rule is enabled in the `recommended`
[config](https://github.com/jest-community/eslint-plugin-jest/blob/main/README.md#shareable-configurations).

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

<!-- end rule header -->

Expand Down
4 changes: 0 additions & 4 deletions docs/rules/no-duplicate-hooks.md
@@ -1,9 +1,5 @@
# Disallow duplicate setup and teardown hooks (`no-duplicate-hooks`)

💼 This rule is enabled in the following
[configs](https://github.com/jest-community/eslint-plugin-jest/blob/main/README.md#shareable-configurations):
`all`.

<!-- end rule header -->

A `describe` block should not contain duplicate hooks.
Expand Down
5 changes: 2 additions & 3 deletions docs/rules/no-export.md
@@ -1,8 +1,7 @@
# Disallow using `exports` in files containing tests (`no-export`)

💼 This rule is enabled in the following
[configs](https://github.com/jest-community/eslint-plugin-jest/blob/main/README.md#shareable-configurations):
`all`, `recommended`.
✅ This rule is enabled in the `recommended`
[config](https://github.com/jest-community/eslint-plugin-jest/blob/main/README.md#shareable-configurations).

<!-- end rule header -->

Expand Down
10 changes: 4 additions & 6 deletions docs/rules/no-focused-tests.md
@@ -1,12 +1,10 @@
# Disallow focused tests (`no-focused-tests`)

💼 This rule is enabled in the following
[configs](https://github.com/jest-community/eslint-plugin-jest/blob/main/README.md#shareable-configurations):
`all`, `recommended`.
✅ This rule is enabled in the `recommended`
[config](https://github.com/jest-community/eslint-plugin-jest/blob/main/README.md#shareable-configurations).

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

<!-- end rule header -->

Expand Down
4 changes: 0 additions & 4 deletions docs/rules/no-hooks.md
@@ -1,9 +1,5 @@
# Disallow setup and teardown hooks (`no-hooks`)

💼 This rule is enabled in the following
[configs](https://github.com/jest-community/eslint-plugin-jest/blob/main/README.md#shareable-configurations):
`all`.

<!-- end rule header -->

Jest provides global functions for setup and teardown tasks, which are called
Expand Down
5 changes: 2 additions & 3 deletions docs/rules/no-identical-title.md
@@ -1,8 +1,7 @@
# Disallow identical titles (`no-identical-title`)

💼 This rule is enabled in the following
[configs](https://github.com/jest-community/eslint-plugin-jest/blob/main/README.md#shareable-configurations):
`all`, `recommended`.
✅ This rule is enabled in the `recommended`
[config](https://github.com/jest-community/eslint-plugin-jest/blob/main/README.md#shareable-configurations).

<!-- end rule header -->

Expand Down
5 changes: 2 additions & 3 deletions docs/rules/no-interpolation-in-snapshots.md
@@ -1,8 +1,7 @@
# Disallow string interpolation inside snapshots (`no-interpolation-in-snapshots`)

💼 This rule is enabled in the following
[configs](https://github.com/jest-community/eslint-plugin-jest/blob/main/README.md#shareable-configurations):
`all`, `recommended`.
✅ This rule is enabled in the `recommended`
[config](https://github.com/jest-community/eslint-plugin-jest/blob/main/README.md#shareable-configurations).

<!-- end rule header -->

Expand Down
12 changes: 5 additions & 7 deletions docs/rules/no-jasmine-globals.md
@@ -1,12 +1,10 @@
# Disallow Jasmine globals (`no-jasmine-globals`)

💼 This rule is enabled in the following
[configs](https://github.com/jest-community/eslint-plugin-jest/blob/main/README.md#shareable-configurations):
`all`, `recommended`.
✅ This rule is enabled in the `recommended`
[config](https://github.com/jest-community/eslint-plugin-jest/blob/main/README.md#shareable-configurations).

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

<!-- end rule header -->

Expand All @@ -22,7 +20,7 @@ API.
This rule reports on any usage of Jasmine globals, which is not ported to Jest,
and suggests alternatives from Jest's own API.

### Default configuration
## Examples

The following patterns are considered warnings:

Expand Down
6 changes: 1 addition & 5 deletions docs/rules/no-large-snapshots.md
@@ -1,8 +1,4 @@
# disallow large snapshots (`no-large-snapshots`)

💼 This rule is enabled in the following
[configs](https://github.com/jest-community/eslint-plugin-jest/blob/main/README.md#shareable-configurations):
`all`.
# Disallow large snapshots (`no-large-snapshots`)

<!-- end rule header -->

Expand Down
5 changes: 2 additions & 3 deletions docs/rules/no-mocks-import.md
@@ -1,8 +1,7 @@
# Disallow manually importing from `__mocks__` (`no-mocks-import`)

💼 This rule is enabled in the following
[configs](https://github.com/jest-community/eslint-plugin-jest/blob/main/README.md#shareable-configurations):
`all`, `recommended`.
✅ This rule is enabled in the `recommended`
[config](https://github.com/jest-community/eslint-plugin-jest/blob/main/README.md#shareable-configurations).

<!-- end rule header -->

Expand Down
4 changes: 0 additions & 4 deletions docs/rules/no-restricted-matchers.md
@@ -1,9 +1,5 @@
# Disallow specific matchers & modifiers (`no-restricted-matchers`)

💼 This rule is enabled in the following
[configs](https://github.com/jest-community/eslint-plugin-jest/blob/main/README.md#shareable-configurations):
`all`.

<!-- end rule header -->

You may want to ban specific matchers & modifiers from being used.
Expand Down
5 changes: 2 additions & 3 deletions docs/rules/no-standalone-expect.md
@@ -1,8 +1,7 @@
# Disallow using `expect` outside of `it` or `test` blocks (`no-standalone-expect`)

💼 This rule is enabled in the following
[configs](https://github.com/jest-community/eslint-plugin-jest/blob/main/README.md#shareable-configurations):
`all`, `recommended`.
✅ This rule is enabled in the `recommended`
[config](https://github.com/jest-community/eslint-plugin-jest/blob/main/README.md#shareable-configurations).

<!-- end rule header -->

Expand Down
10 changes: 4 additions & 6 deletions docs/rules/no-test-prefixes.md
@@ -1,12 +1,10 @@
# Use `.only` and `.skip` over `f` and `x` (`no-test-prefixes`)

💼 This rule is enabled in the following
[configs](https://github.com/jest-community/eslint-plugin-jest/blob/main/README.md#shareable-configurations):
`all`, `recommended`.
✅ This rule is enabled in the `recommended`
[config](https://github.com/jest-community/eslint-plugin-jest/blob/main/README.md#shareable-configurations).

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

<!-- end rule header -->

Expand Down
4 changes: 0 additions & 4 deletions docs/rules/no-test-return-statement.md
@@ -1,9 +1,5 @@
# Disallow explicitly returning from tests (`no-test-return-statement`)

💼 This rule is enabled in the following
[configs](https://github.com/jest-community/eslint-plugin-jest/blob/main/README.md#shareable-configurations):
`all`.

<!-- end rule header -->

Tests in Jest should be void and not return values.
Expand Down
4 changes: 0 additions & 4 deletions docs/rules/prefer-called-with.md
@@ -1,9 +1,5 @@
# Suggest using `toBeCalledWith()` or `toHaveBeenCalledWith()` (`prefer-called-with`)

💼 This rule is enabled in the following
[configs](https://github.com/jest-community/eslint-plugin-jest/blob/main/README.md#shareable-configurations):
`all`.

<!-- end rule header -->

The `toBeCalled()` matcher is used to assert that a mock function has been
Expand Down
9 changes: 2 additions & 7 deletions docs/rules/prefer-comparison-matcher.md
@@ -1,12 +1,7 @@
# Suggest using the built-in comparison matchers (`prefer-comparison-matcher`)

💼 This rule is enabled in the following
[configs](https://github.com/jest-community/eslint-plugin-jest/blob/main/README.md#shareable-configurations):
`all`.

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

<!-- end rule header -->

Expand Down
4 changes: 0 additions & 4 deletions docs/rules/prefer-each.md
@@ -1,9 +1,5 @@
# Prefer using `.each` rather than manual loops (`prefer-each`)

💼 This rule is enabled in the following
[configs](https://github.com/jest-community/eslint-plugin-jest/blob/main/README.md#shareable-configurations):
`all`.

<!-- end rule header -->

Reports where you might be able to use `.each` instead of native loops.
Expand Down
9 changes: 2 additions & 7 deletions docs/rules/prefer-equality-matcher.md
@@ -1,12 +1,7 @@
# Suggest using the built-in equality matchers (`prefer-equality-matcher`)

💼 This rule is enabled in the following
[configs](https://github.com/jest-community/eslint-plugin-jest/blob/main/README.md#shareable-configurations):
`all`.

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

<!-- end rule header -->

Expand Down
11 changes: 2 additions & 9 deletions docs/rules/prefer-expect-assertions.md
@@ -1,12 +1,7 @@
# Suggest using `expect.assertions()` OR `expect.hasAssertions()` (`prefer-expect-assertions`)

💼 This rule is enabled in the following
[configs](https://github.com/jest-community/eslint-plugin-jest/blob/main/README.md#shareable-configurations):
`all`.

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

<!-- end rule header -->

Expand Down Expand Up @@ -37,8 +32,6 @@ test('my test', () => {
});
```

### Default configuration

The following patterns are considered warnings:

```js
Expand Down

0 comments on commit 3a72a8b

Please sign in to comment.