Skip to content

Commit b9faa0f

Browse files
authored
docs: use eslint-doc-generator for rule documentation (#1263)
1 parent ae6cfb7 commit b9faa0f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+282
-786
lines changed

.eslintrc.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ module.exports = {
3232
'@typescript-eslint/ban-types': 'error',
3333
'@typescript-eslint/no-unused-vars': 'error',
3434
'eslint-comments/no-unused-disable': 'error',
35+
'eslint-plugin/require-meta-docs-description': [
36+
'error',
37+
{ pattern: '^(Enforce|Require|Disallow|Suggest|Prefer)' },
38+
],
3539
'eslint-plugin/test-case-property-ordering': 'error',
3640
'no-else-return': 'error',
3741
'no-negated-condition': 'error',

README.md

Lines changed: 81 additions & 80 deletions
Large diffs are not rendered by default.

docs/rules/consistent-test-it.md

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
1-
# Have control over `test` and `it` usages (`consistent-test-it`)
1+
# Enforce `test` and `it` usage conventions (`consistent-test-it`)
22

3-
💼 This rule is enabled in the following
4-
[configs](https://github.com/jest-community/eslint-plugin-jest/blob/main/README.md#shareable-configurations):
5-
`all`.
3+
🔧 This rule is automatically fixable by the
4+
[`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).
65

7-
🔧 This rule is automatically fixable using the `--fix`
8-
[option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix)
9-
on the command line.
10-
11-
<!-- end rule header -->
6+
<!-- end auto-generated rule header -->
127

138
Jest allows you to choose how you want to define your tests, using the `it` or
149
the `test` keywords, with multiple permutations for each:
@@ -81,8 +76,6 @@ describe('foo', function () {
8176
});
8277
```
8378

84-
### Default configuration
85-
8679
The default configuration forces all top-level tests to use `test` and all tests
8780
nested within `describe` to use `it`.
8881

docs/rules/expect-expect.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
# Enforce assertion to be made in a test body (`expect-expect`)
22

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

7-
<!-- end rule header -->
6+
<!-- end auto-generated rule header -->
87

98
Ensure that there is at least one `expect` call made in a test.
109

docs/rules/max-expects.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
# Enforces a maximum number assertion calls in a test body (`max-expects`)
22

3-
💼 This rule is enabled in the following
4-
[configs](https://github.com/jest-community/eslint-plugin-jest/blob/main/README.md#shareable-configurations):
5-
`all`.
6-
7-
<!-- end rule header -->
3+
<!-- end auto-generated rule header -->
84

95
As more assertions are made, there is a possible tendency for the test to be
106
more likely to mix multiple objectives. To avoid this, this rule reports when

docs/rules/max-nested-describe.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
# Enforces a maximum depth to nested describe calls (`max-nested-describe`)
22

3-
💼 This rule is enabled in the following
4-
[configs](https://github.com/jest-community/eslint-plugin-jest/blob/main/README.md#shareable-configurations):
5-
`all`.
6-
7-
<!-- end rule header -->
3+
<!-- end auto-generated rule header -->
84

95
While it's useful to be able to group your tests together within the same file
106
using `describe()`, having too many levels of nesting throughout your tests make

docs/rules/no-alias-methods.md

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
# Disallow alias methods (`no-alias-methods`)
22

3-
💼 This rule is enabled in the following
4-
[configs](https://github.com/jest-community/eslint-plugin-jest/blob/main/README.md#shareable-configurations):
5-
`all`, `recommended`.
3+
💼⚠️ This rule is enabled in the ✅ `recommended`
4+
[config](https://github.com/jest-community/eslint-plugin-jest/blob/main/README.md#shareable-configurations).
5+
This rule _warns_ in the 🎨 `style`
6+
[config](https://github.com/jest-community/eslint-plugin-jest/blob/main/README.md#shareable-configurations).
67

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

11-
<!-- end rule header -->
11+
<!-- end auto-generated rule header -->
1212

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

27-
### Default configuration
28-
2927
The following patterns are considered warnings:
3028

3129
```js

docs/rules/no-commented-out-tests.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
# Disallow commented out tests (`no-commented-out-tests`)
22

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

7-
<!-- end rule header -->
6+
<!-- end auto-generated rule header -->
87

98
This rule raises a warning about commented out tests. It's similar to
109
no-disabled-tests rule.

docs/rules/no-conditional-expect.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
# Prevent calling `expect` conditionally (`no-conditional-expect`)
1+
# Disallow calling `expect` conditionally (`no-conditional-expect`)
22

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

7-
<!-- end rule header -->
6+
<!-- end auto-generated rule header -->
87

98
This rule prevents the use of `expect` in conditional blocks, such as `if`s &
109
`catch`s.

docs/rules/no-conditional-in-test.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
# Disallow conditional logic in tests (`no-conditional-in-test`)
22

3-
💼 This rule is enabled in the following
4-
[configs](https://github.com/jest-community/eslint-plugin-jest/blob/main/README.md#shareable-configurations):
5-
`all`.
6-
7-
<!-- end rule header -->
3+
<!-- end auto-generated rule header -->
84

95
Conditional logic in tests is usually an indication that a test is attempting to
106
cover too much, and not testing the logic it intends to. Each branch of code

0 commit comments

Comments
 (0)