Skip to content

Commit

Permalink
feat: deprecate prefer-to-be-null rule
Browse files Browse the repository at this point in the history
  • Loading branch information
G-Rath authored and SimenB committed Oct 10, 2021
1 parent 6204b31 commit 4db9161
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 2 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,6 @@ installations requiring long-term consistency.
| [prefer-spy-on](docs/rules/prefer-spy-on.md) | Suggest using `jest.spyOn()` | | ![fixable][] |
| [prefer-strict-equal](docs/rules/prefer-strict-equal.md) | Suggest using `toStrictEqual()` | | ![suggest][] |
| [prefer-to-be](docs/rules/prefer-to-be.md) | Suggest using `toBe()` for primitive literals | | ![fixable][] |
| [prefer-to-be-null](docs/rules/prefer-to-be-null.md) | Suggest using `toBeNull()` | ![style][] | ![fixable][] |
| [prefer-to-be-undefined](docs/rules/prefer-to-be-undefined.md) | Suggest using `toBeUndefined()` | ![style][] | ![fixable][] |
| [prefer-to-contain](docs/rules/prefer-to-contain.md) | Suggest using `toContain()` | ![style][] | ![fixable][] |
| [prefer-to-have-length](docs/rules/prefer-to-have-length.md) | Suggest using `toHaveLength()` | ![style][] | ![fixable][] |
Expand Down
4 changes: 4 additions & 0 deletions docs/rules/prefer-to-be-null.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Suggest using `toBeNull()` (`prefer-to-be-null`)

## Deprecated

This rule has been deprecated in favor of [`prefer-to-be`](prefer-to-be.md).

In order to have a better failure message, `toBeNull()` should be used upon
asserting expectations on null value.

Expand Down
1 change: 0 additions & 1 deletion src/__tests__/__snapshots__/rules.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ Object {
"jest/prefer-spy-on": "error",
"jest/prefer-strict-equal": "error",
"jest/prefer-to-be": "error",
"jest/prefer-to-be-null": "error",
"jest/prefer-to-be-undefined": "error",
"jest/prefer-to-contain": "error",
"jest/prefer-to-have-length": "error",
Expand Down
2 changes: 2 additions & 0 deletions src/rules/prefer-to-be-null.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ export default createRule({
messages: {
useToBeNull: 'Use toBeNull() instead',
},
deprecated: true,
replacedBy: ['prefer-to-be'],
fixable: 'code',
type: 'suggestion',
schema: [],
Expand Down

0 comments on commit 4db9161

Please sign in to comment.