Skip to content

Commit 2580563

Browse files
bmishG-Rath
andauthored
fix: consistent rule doc notices and sections (#1226)
Co-authored-by: Gareth Jones <[email protected]>
1 parent 90cdc0c commit 2580563

Some content is hidden

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

53 files changed

+659
-41
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ installations requiring long-term consistency.
215215
| [no-focused-tests](docs/rules/no-focused-tests.md) | Disallow focused tests | ![recommended][] | ![suggest][] |
216216
| [no-hooks](docs/rules/no-hooks.md) | Disallow setup and teardown hooks | | |
217217
| [no-identical-title](docs/rules/no-identical-title.md) | Disallow identical titles | ![recommended][] | |
218+
| [no-if](docs/rules/no-if.md) | Disallow conditional logic | ![deprecated][] | |
218219
| [no-interpolation-in-snapshots](docs/rules/no-interpolation-in-snapshots.md) | Disallow string interpolation inside snapshots | ![recommended][] | |
219220
| [no-jasmine-globals](docs/rules/no-jasmine-globals.md) | Disallow Jasmine globals | ![recommended][] | ![fixable][] |
220221
| [no-large-snapshots](docs/rules/no-large-snapshots.md) | disallow large snapshots | | |
@@ -308,4 +309,5 @@ https://github.com/istanbuljs/eslint-plugin-istanbul
308309
[suggest]: https://img.shields.io/badge/-suggest-yellow.svg
309310
[fixable]: https://img.shields.io/badge/-fixable-green.svg
310311
[style]: https://img.shields.io/badge/-style-blue.svg
312+
[deprecated]: https://img.shields.io/badge/-deprecated-red.svg
311313
[`no-deprecated-functions`]: docs/rules/no-deprecated-functions.md

docs/rules/consistent-test-it.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,26 @@
11
# Have control over `test` and `it` usages (`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`.
6+
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 -->
12+
313
Jest allows you to choose how you want to define your tests, using the `it` or
414
the `test` keywords, with multiple permutations for each:
515

616
- **it:** `it`, `xit`, `fit`, `it.only`, `it.skip`.
717
- **test:** `test`, `xtest`, `test.only`, `test.skip`.
818

19+
## Rule details
20+
921
This rule gives you control over the usage of these keywords in your codebase.
1022

11-
## Rule Details
23+
## Options
1224

1325
This rule can be configured as follows
1426

docs/rules/expect-expect.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
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`.
6+
7+
<!-- end rule header -->
8+
39
Ensure that there is at least one `expect` call made in a test.
410

511
## Rule details

docs/rules/max-expects.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
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 -->
8+
39
As more assertions are made, there is a possible tendency for the test to be
410
more likely to mix multiple objectives. To avoid this, this rule reports when
511
the maximum number of assertions is exceeded.
612

7-
## Rule Details
13+
## Rule details
814

915
This rule enforces a maximum number of `expect()` calls.
1016

docs/rules/max-nested-describe.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
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 -->
8+
39
While it's useful to be able to group your tests together within the same file
410
using `describe()`, having too many levels of nesting throughout your tests make
511
them difficult to read.
612

7-
## Rule Details
13+
## Rule details
814

915
This rule enforces a maximum depth to nested `describe()` calls to improve code
1016
clarity in your tests.

docs/rules/no-alias-methods.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
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`.
6+
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 -->
12+
313
> These aliases are going to be removed in the next major version of Jest - see
414
> https://github.com/facebook/jest/issues/13164 for more
515

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
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`.
6+
7+
<!-- end rule header -->
8+
39
This rule raises a warning about commented out tests. It's similar to
410
no-disabled-tests rule.
511

6-
## Rule Details
12+
## Rule details
713

814
The rule uses fuzzy matching to do its best to determine what constitutes a
915
commented out test, checking for a presence of `it(`, `describe(`, `it.skip(`,

docs/rules/no-conditional-expect.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
# Prevent 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`.
6+
7+
<!-- end rule header -->
8+
39
This rule prevents the use of `expect` in conditional blocks, such as `if`s &
410
`catch`s.
511

612
This includes using `expect` in callbacks to functions named `catch`, which are
713
assumed to be promises.
814

9-
## Rule Details
15+
## Rule details
1016

1117
Jest only considers a test to have failed if it throws an error, meaning if
1218
calls to assertion functions like `expect` occur in conditional code such as a

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
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 -->
8+
39
Conditional logic in tests is usually an indication that a test is attempting to
410
cover too much, and not testing the logic it intends to. Each branch of code
511
executing within a conditional statement will usually be better served by a test
612
devoted to it.
713

8-
## Rule Details
14+
## Rule details
915

1016
This rule reports on any use of a conditional statement such as `if`, `switch`,
1117
and ternary expressions.

docs/rules/no-deprecated-functions.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# Disallow use of deprecated functions (`no-deprecated-functions`)
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`.
6+
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 -->
12+
313
Over the years Jest has accrued some debt in the form of functions that have
414
either been renamed for clarity, or replaced with more powerful APIs.
515

0 commit comments

Comments
 (0)