Skip to content

Commit

Permalink
feat: deprecate prefer-to-be-undefined 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 4db9161 commit fa08f09
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-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][] |
| [prefer-todo](docs/rules/prefer-todo.md) | Suggest using `test.todo` | | ![fixable][] |
Expand Down
4 changes: 4 additions & 0 deletions docs/rules/prefer-to-be-undefined.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Suggest using `toBeUndefined()` (`prefer-to-be-undefined`)

## Deprecated

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

In order to have a better failure message, `toBeUndefined()` should be used upon
asserting expectations on undefined 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-undefined": "error",
"jest/prefer-to-contain": "error",
"jest/prefer-to-have-length": "error",
"jest/prefer-todo": "error",
Expand Down
2 changes: 2 additions & 0 deletions src/rules/prefer-to-be-undefined.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ export default createRule({
messages: {
useToBeUndefined: 'Use toBeUndefined() instead',
},
deprecated: true,
replacedBy: ['prefer-to-be'],
fixable: 'code',
type: 'suggestion',
schema: [],
Expand Down

0 comments on commit fa08f09

Please sign in to comment.