eslint-plugin-jest 29.12.0 → 29.12.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/rules/consistent-test-it.md +3 -1
- package/docs/rules/expect-expect.md +3 -1
- package/docs/rules/max-expects.md +3 -1
- package/docs/rules/max-nested-describe.md +3 -1
- package/docs/rules/no-alias-methods.md +3 -1
- package/docs/rules/no-commented-out-tests.md +3 -1
- package/docs/rules/no-conditional-expect.md +3 -1
- package/docs/rules/no-conditional-in-test.md +3 -1
- package/docs/rules/no-confusing-set-timeout.md +3 -1
- package/docs/rules/no-deprecated-functions.md +3 -1
- package/docs/rules/no-disabled-tests.md +3 -1
- package/docs/rules/no-done-callback.md +3 -1
- package/docs/rules/no-duplicate-hooks.md +3 -1
- package/docs/rules/no-error-equal.md +3 -1
- package/docs/rules/no-export.md +3 -1
- package/docs/rules/no-focused-tests.md +3 -1
- package/docs/rules/no-hooks.md +3 -1
- package/docs/rules/no-identical-title.md +3 -1
- package/docs/rules/no-interpolation-in-snapshots.md +3 -1
- package/docs/rules/no-jasmine-globals.md +3 -1
- package/docs/rules/no-large-snapshots.md +3 -1
- package/docs/rules/no-mocks-import.md +3 -1
- package/docs/rules/no-restricted-jest-methods.md +3 -1
- package/docs/rules/no-restricted-matchers.md +3 -1
- package/docs/rules/no-standalone-expect.md +3 -1
- package/docs/rules/no-test-prefixes.md +3 -1
- package/docs/rules/no-test-return-statement.md +3 -1
- package/docs/rules/no-unnecessary-assertion.md +3 -1
- package/docs/rules/no-unneeded-async-expect-function.md +3 -1
- package/docs/rules/no-untyped-mock-factory.md +3 -1
- package/docs/rules/padding-around-after-all-blocks.md +3 -1
- package/docs/rules/padding-around-after-each-blocks.md +3 -1
- package/docs/rules/padding-around-all.md +3 -1
- package/docs/rules/padding-around-before-all-blocks.md +3 -1
- package/docs/rules/padding-around-before-each-blocks.md +3 -1
- package/docs/rules/padding-around-describe-blocks.md +3 -1
- package/docs/rules/padding-around-expect-groups.md +3 -1
- package/docs/rules/padding-around-test-blocks.md +3 -1
- package/docs/rules/prefer-called-with.md +3 -1
- package/docs/rules/prefer-comparison-matcher.md +3 -1
- package/docs/rules/prefer-each.md +3 -1
- package/docs/rules/prefer-ending-with-an-expect.md +3 -1
- package/docs/rules/prefer-equality-matcher.md +3 -1
- package/docs/rules/prefer-expect-assertions.md +3 -1
- package/docs/rules/prefer-expect-resolves.md +3 -1
- package/docs/rules/prefer-hooks-in-order.md +3 -1
- package/docs/rules/prefer-hooks-on-top.md +3 -1
- package/docs/rules/prefer-importing-jest-globals.md +3 -1
- package/docs/rules/prefer-jest-mocked.md +3 -1
- package/docs/rules/prefer-lowercase-title.md +3 -1
- package/docs/rules/prefer-mock-promise-shorthand.md +3 -1
- package/docs/rules/prefer-mock-return-shorthand.md +3 -1
- package/docs/rules/prefer-snapshot-hint.md +3 -1
- package/docs/rules/prefer-spy-on.md +3 -1
- package/docs/rules/prefer-strict-equal.md +3 -1
- package/docs/rules/prefer-to-be.md +3 -1
- package/docs/rules/prefer-to-contain.md +3 -1
- package/docs/rules/prefer-to-have-been-called-times.md +3 -1
- package/docs/rules/prefer-to-have-been-called.md +3 -1
- package/docs/rules/prefer-to-have-length.md +3 -1
- package/docs/rules/prefer-todo.md +3 -1
- package/docs/rules/require-hook.md +3 -1
- package/docs/rules/require-to-throw-message.md +3 -1
- package/docs/rules/require-top-level-describe.md +3 -1
- package/docs/rules/unbound-method.md +3 -1
- package/docs/rules/valid-describe-callback.md +3 -1
- package/docs/rules/valid-expect-in-promise.md +3 -1
- package/docs/rules/valid-expect-with-promise.md +4 -1
- package/docs/rules/valid-expect.md +3 -1
- package/docs/rules/valid-mock-module-path.md +3 -1
- package/docs/rules/valid-title.md +3 -1
- package/lib/rules/no-unnecessary-assertion.js +13 -9
- package/package.json +8 -4
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
#
|
|
1
|
+
# jest/consistent-test-it
|
|
2
|
+
|
|
3
|
+
📝 Enforce `test` and `it` usage conventions.
|
|
2
4
|
|
|
3
5
|
🔧 This rule is automatically fixable by the
|
|
4
6
|
[`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
#
|
|
1
|
+
# jest/expect-expect
|
|
2
|
+
|
|
3
|
+
📝 Enforce assertion to be made in a test body.
|
|
2
4
|
|
|
3
5
|
⚠️ This rule _warns_ in the ✅ `recommended`
|
|
4
6
|
[config](https://github.com/jest-community/eslint-plugin-jest/blob/main/README.md#shareable-configurations).
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
#
|
|
1
|
+
# jest/no-commented-out-tests
|
|
2
|
+
|
|
3
|
+
📝 Disallow commented out tests.
|
|
2
4
|
|
|
3
5
|
⚠️ This rule _warns_ in the ✅ `recommended`
|
|
4
6
|
[config](https://github.com/jest-community/eslint-plugin-jest/blob/main/README.md#shareable-configurations).
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
#
|
|
1
|
+
# jest/no-conditional-expect
|
|
2
|
+
|
|
3
|
+
📝 Disallow calling `expect` conditionally.
|
|
2
4
|
|
|
3
5
|
💼 This rule is enabled in the ✅ `recommended`
|
|
4
6
|
[config](https://github.com/jest-community/eslint-plugin-jest/blob/main/README.md#shareable-configurations).
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
#
|
|
1
|
+
# jest/no-deprecated-functions
|
|
2
|
+
|
|
3
|
+
📝 Disallow use of deprecated functions.
|
|
2
4
|
|
|
3
5
|
💼 This rule is enabled in the ✅ `recommended`
|
|
4
6
|
[config](https://github.com/jest-community/eslint-plugin-jest/blob/main/README.md#shareable-configurations).
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
#
|
|
1
|
+
# jest/no-done-callback
|
|
2
|
+
|
|
3
|
+
📝 Disallow using a callback in asynchronous tests and hooks.
|
|
2
4
|
|
|
3
5
|
💼 This rule is enabled in the ✅ `recommended`
|
|
4
6
|
[config](https://github.com/jest-community/eslint-plugin-jest/blob/main/README.md#shareable-configurations).
|
package/docs/rules/no-export.md
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
#
|
|
1
|
+
# jest/no-export
|
|
2
|
+
|
|
3
|
+
📝 Disallow using `exports` in files containing tests.
|
|
2
4
|
|
|
3
5
|
💼 This rule is enabled in the ✅ `recommended`
|
|
4
6
|
[config](https://github.com/jest-community/eslint-plugin-jest/blob/main/README.md#shareable-configurations).
|
package/docs/rules/no-hooks.md
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
#
|
|
1
|
+
# jest/no-identical-title
|
|
2
|
+
|
|
3
|
+
📝 Disallow identical titles.
|
|
2
4
|
|
|
3
5
|
💼 This rule is enabled in the ✅ `recommended`
|
|
4
6
|
[config](https://github.com/jest-community/eslint-plugin-jest/blob/main/README.md#shareable-configurations).
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
#
|
|
1
|
+
# jest/no-interpolation-in-snapshots
|
|
2
|
+
|
|
3
|
+
📝 Disallow string interpolation inside snapshots.
|
|
2
4
|
|
|
3
5
|
💼 This rule is enabled in the ✅ `recommended`
|
|
4
6
|
[config](https://github.com/jest-community/eslint-plugin-jest/blob/main/README.md#shareable-configurations).
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
#
|
|
1
|
+
# jest/no-jasmine-globals
|
|
2
|
+
|
|
3
|
+
📝 Disallow Jasmine globals.
|
|
2
4
|
|
|
3
5
|
💼 This rule is enabled in the ✅ `recommended`
|
|
4
6
|
[config](https://github.com/jest-community/eslint-plugin-jest/blob/main/README.md#shareable-configurations).
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
#
|
|
1
|
+
# jest/no-mocks-import
|
|
2
|
+
|
|
3
|
+
📝 Disallow manually importing from `__mocks__`.
|
|
2
4
|
|
|
3
5
|
💼 This rule is enabled in the ✅ `recommended`
|
|
4
6
|
[config](https://github.com/jest-community/eslint-plugin-jest/blob/main/README.md#shareable-configurations).
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
#
|
|
1
|
+
# jest/no-standalone-expect
|
|
2
|
+
|
|
3
|
+
📝 Disallow using `expect` outside of `it` or `test` blocks.
|
|
2
4
|
|
|
3
5
|
💼 This rule is enabled in the ✅ `recommended`
|
|
4
6
|
[config](https://github.com/jest-community/eslint-plugin-jest/blob/main/README.md#shareable-configurations).
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
#
|
|
1
|
+
# jest/no-test-prefixes
|
|
2
|
+
|
|
3
|
+
📝 Require using `.only` and `.skip` over `f` and `x`.
|
|
2
4
|
|
|
3
5
|
💼 This rule is enabled in the ✅ `recommended`
|
|
4
6
|
[config](https://github.com/jest-community/eslint-plugin-jest/blob/main/README.md#shareable-configurations).
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
#
|
|
1
|
+
# jest/no-unneeded-async-expect-function
|
|
2
|
+
|
|
3
|
+
📝 Disallow unnecessary async function wrapper for expected promises.
|
|
2
4
|
|
|
3
5
|
🔧 This rule is automatically fixable by the
|
|
4
6
|
[`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
#
|
|
1
|
+
# jest/no-untyped-mock-factory
|
|
2
|
+
|
|
3
|
+
📝 Disallow using `jest.mock()` factories without an explicit type parameter.
|
|
2
4
|
|
|
3
5
|
🔧 This rule is automatically fixable by the
|
|
4
6
|
[`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
#
|
|
1
|
+
# jest/padding-around-after-all-blocks
|
|
2
|
+
|
|
3
|
+
📝 Enforce padding around `afterAll` blocks.
|
|
2
4
|
|
|
3
5
|
🔧 This rule is automatically fixable by the
|
|
4
6
|
[`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
#
|
|
1
|
+
# jest/padding-around-after-each-blocks
|
|
2
|
+
|
|
3
|
+
📝 Enforce padding around `afterEach` blocks.
|
|
2
4
|
|
|
3
5
|
🔧 This rule is automatically fixable by the
|
|
4
6
|
[`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
#
|
|
1
|
+
# jest/padding-around-all
|
|
2
|
+
|
|
3
|
+
📝 Enforce padding around Jest functions.
|
|
2
4
|
|
|
3
5
|
🔧 This rule is automatically fixable by the
|
|
4
6
|
[`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
#
|
|
1
|
+
# jest/padding-around-before-all-blocks
|
|
2
|
+
|
|
3
|
+
📝 Enforce padding around `beforeAll` blocks.
|
|
2
4
|
|
|
3
5
|
🔧 This rule is automatically fixable by the
|
|
4
6
|
[`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
#
|
|
1
|
+
# jest/padding-around-before-each-blocks
|
|
2
|
+
|
|
3
|
+
📝 Enforce padding around `beforeEach` blocks.
|
|
2
4
|
|
|
3
5
|
🔧 This rule is automatically fixable by the
|
|
4
6
|
[`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
#
|
|
1
|
+
# jest/padding-around-describe-blocks
|
|
2
|
+
|
|
3
|
+
📝 Enforce padding around `describe` blocks.
|
|
2
4
|
|
|
3
5
|
🔧 This rule is automatically fixable by the
|
|
4
6
|
[`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
#
|
|
1
|
+
# jest/padding-around-expect-groups
|
|
2
|
+
|
|
3
|
+
📝 Enforce padding around `expect` groups.
|
|
2
4
|
|
|
3
5
|
🔧 This rule is automatically fixable by the
|
|
4
6
|
[`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
#
|
|
1
|
+
# jest/padding-around-test-blocks
|
|
2
|
+
|
|
3
|
+
📝 Enforce padding around `test` and `it` blocks.
|
|
2
4
|
|
|
3
5
|
🔧 This rule is automatically fixable by the
|
|
4
6
|
[`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
#
|
|
1
|
+
# jest/prefer-comparison-matcher
|
|
2
|
+
|
|
3
|
+
📝 Suggest using the built-in comparison matchers.
|
|
2
4
|
|
|
3
5
|
🔧 This rule is automatically fixable by the
|
|
4
6
|
[`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
#
|
|
1
|
+
# jest/prefer-equality-matcher
|
|
2
|
+
|
|
3
|
+
📝 Suggest using the built-in equality matchers.
|
|
2
4
|
|
|
3
5
|
💡 This rule is manually fixable by
|
|
4
6
|
[editor suggestions](https://eslint.org/docs/latest/use/core-concepts#rule-suggestions).
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
#
|
|
1
|
+
# jest/prefer-expect-assertions
|
|
2
|
+
|
|
3
|
+
📝 Suggest using `expect.assertions()` OR `expect.hasAssertions()`.
|
|
2
4
|
|
|
3
5
|
💡 This rule is manually fixable by
|
|
4
6
|
[editor suggestions](https://eslint.org/docs/latest/use/core-concepts#rule-suggestions).
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
#
|
|
1
|
+
# jest/prefer-expect-resolves
|
|
2
|
+
|
|
3
|
+
📝 Prefer `await expect(...).resolves` over `expect(await ...)` syntax.
|
|
2
4
|
|
|
3
5
|
🔧 This rule is automatically fixable by the
|
|
4
6
|
[`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
#
|
|
1
|
+
# jest/prefer-importing-jest-globals
|
|
2
|
+
|
|
3
|
+
📝 Prefer importing Jest globals.
|
|
2
4
|
|
|
3
5
|
🔧 This rule is automatically fixable by the
|
|
4
6
|
[`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
#
|
|
1
|
+
# jest/prefer-jest-mocked
|
|
2
|
+
|
|
3
|
+
📝 Prefer `jest.mocked()` over `fn as jest.Mock`.
|
|
2
4
|
|
|
3
5
|
🔧 This rule is automatically fixable by the
|
|
4
6
|
[`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
#
|
|
1
|
+
# jest/prefer-lowercase-title
|
|
2
|
+
|
|
3
|
+
📝 Enforce lowercase test names.
|
|
2
4
|
|
|
3
5
|
🔧 This rule is automatically fixable by the
|
|
4
6
|
[`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
#
|
|
1
|
+
# jest/prefer-mock-promise-shorthand
|
|
2
|
+
|
|
3
|
+
📝 Prefer mock resolved/rejected shorthands for promises.
|
|
2
4
|
|
|
3
5
|
🔧 This rule is automatically fixable by the
|
|
4
6
|
[`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
#
|
|
1
|
+
# jest/prefer-mock-return-shorthand
|
|
2
|
+
|
|
3
|
+
📝 Prefer mock return shorthands.
|
|
2
4
|
|
|
3
5
|
🔧 This rule is automatically fixable by the
|
|
4
6
|
[`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
#
|
|
1
|
+
# jest/prefer-to-be
|
|
2
|
+
|
|
3
|
+
📝 Suggest using `toBe()` for primitive literals.
|
|
2
4
|
|
|
3
5
|
💼 This rule is enabled in the 🎨 `style`
|
|
4
6
|
[config](https://github.com/jest-community/eslint-plugin-jest/blob/main/README.md#shareable-configurations).
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
#
|
|
1
|
+
# jest/prefer-to-contain
|
|
2
|
+
|
|
3
|
+
📝 Suggest using `toContain()`.
|
|
2
4
|
|
|
3
5
|
💼 This rule is enabled in the 🎨 `style`
|
|
4
6
|
[config](https://github.com/jest-community/eslint-plugin-jest/blob/main/README.md#shareable-configurations).
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
#
|
|
1
|
+
# jest/prefer-to-have-been-called-times
|
|
2
|
+
|
|
3
|
+
📝 Suggest using `toHaveBeenCalledTimes()`.
|
|
2
4
|
|
|
3
5
|
🔧 This rule is automatically fixable by the
|
|
4
6
|
[`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
#
|
|
1
|
+
# jest/prefer-to-have-been-called
|
|
2
|
+
|
|
3
|
+
📝 Suggest using `toHaveBeenCalled`.
|
|
2
4
|
|
|
3
5
|
🔧 This rule is automatically fixable by the
|
|
4
6
|
[`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
#
|
|
1
|
+
# jest/prefer-to-have-length
|
|
2
|
+
|
|
3
|
+
📝 Suggest using `toHaveLength()`.
|
|
2
4
|
|
|
3
5
|
💼 This rule is enabled in the 🎨 `style`
|
|
4
6
|
[config](https://github.com/jest-community/eslint-plugin-jest/blob/main/README.md#shareable-configurations).
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
#
|
|
1
|
+
# jest/unbound-method
|
|
2
|
+
|
|
3
|
+
📝 Enforce unbound methods are called with their expected scope.
|
|
2
4
|
|
|
3
5
|
💭 This rule requires
|
|
4
6
|
[type information](https://typescript-eslint.io/linting/typed-linting).
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
#
|
|
1
|
+
# jest/valid-describe-callback
|
|
2
|
+
|
|
3
|
+
📝 Enforce valid `describe()` callback.
|
|
2
4
|
|
|
3
5
|
💼 This rule is enabled in the ✅ `recommended`
|
|
4
6
|
[config](https://github.com/jest-community/eslint-plugin-jest/blob/main/README.md#shareable-configurations).
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
#
|
|
1
|
+
# jest/valid-expect-in-promise
|
|
2
|
+
|
|
3
|
+
📝 Require promises that have expectations in their chain to be valid.
|
|
2
4
|
|
|
3
5
|
💼 This rule is enabled in the ✅ `recommended`
|
|
4
6
|
[config](https://github.com/jest-community/eslint-plugin-jest/blob/main/README.md#shareable-configurations).
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
#
|
|
1
|
+
# jest/valid-expect-with-promise
|
|
2
|
+
|
|
3
|
+
📝 Require that `resolve` and `reject` modifiers are present (and only) for
|
|
4
|
+
promise-like types.
|
|
2
5
|
|
|
3
6
|
💭 This rule requires
|
|
4
7
|
[type information](https://typescript-eslint.io/linting/typed-linting).
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
#
|
|
1
|
+
# jest/valid-expect
|
|
2
|
+
|
|
3
|
+
📝 Enforce valid `expect()` usage.
|
|
2
4
|
|
|
3
5
|
💼 This rule is enabled in the ✅ `recommended`
|
|
4
6
|
[config](https://github.com/jest-community/eslint-plugin-jest/blob/main/README.md#shareable-configurations).
|
|
@@ -67,16 +67,20 @@ var _default = exports.default = (0, _utils2.createRule)({
|
|
|
67
67
|
return;
|
|
68
68
|
}
|
|
69
69
|
const [argument] = jestFnCall.head.node.parent.arguments;
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
},
|
|
77
|
-
node
|
|
78
|
-
});
|
|
70
|
+
let desiredType = TypeFlags.Any | TypeFlags.Unknown;
|
|
71
|
+
|
|
72
|
+
// add in the appropriate type flag based on the matcher being used
|
|
73
|
+
desiredType |= matcherName === 'toBeNaN' ? TypeFlags.NumberLike : matcherName === 'toBeNull' ? TypeFlags.Null : TypeFlags.Undefined;
|
|
74
|
+
if (canBe(services.getTypeAtLocation(argument), desiredType)) {
|
|
75
|
+
return;
|
|
79
76
|
}
|
|
77
|
+
context.report({
|
|
78
|
+
messageId: 'unnecessaryAssertion',
|
|
79
|
+
data: {
|
|
80
|
+
thing: matcherName === 'toBeNaN' ? 'a number' : matcherName === 'toBeNull' ? 'null' : 'undefined'
|
|
81
|
+
},
|
|
82
|
+
node
|
|
83
|
+
});
|
|
80
84
|
}
|
|
81
85
|
};
|
|
82
86
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-jest",
|
|
3
|
-
"version": "29.12.
|
|
3
|
+
"version": "29.12.2",
|
|
4
4
|
"description": "ESLint rules for Jest",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
"@babel/preset-typescript": "^7.3.3",
|
|
84
84
|
"@commitlint/cli": "^20.0.0",
|
|
85
85
|
"@commitlint/config-conventional": "^20.0.0",
|
|
86
|
-
"@eslint-community/eslint-plugin-eslint-comments": "^4.
|
|
86
|
+
"@eslint-community/eslint-plugin-eslint-comments": "^4.6.0",
|
|
87
87
|
"@schemastore/package": "^0.0.10",
|
|
88
88
|
"@semantic-release/changelog": "^6.0.0",
|
|
89
89
|
"@semantic-release/git": "^10.0.0",
|
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
"dedent": "^1.5.0",
|
|
101
101
|
"eslint": "^9.0.0",
|
|
102
102
|
"eslint-config-prettier": "^10.0.0",
|
|
103
|
-
"eslint-doc-generator": "^
|
|
103
|
+
"eslint-doc-generator": "^3.0.0",
|
|
104
104
|
"eslint-plugin-eslint-plugin": "^6.0.0",
|
|
105
105
|
"eslint-plugin-import": "^2.25.1",
|
|
106
106
|
"eslint-plugin-n": "^17.0.0",
|
|
@@ -124,7 +124,8 @@
|
|
|
124
124
|
"peerDependencies": {
|
|
125
125
|
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
|
126
126
|
"eslint": "^8.57.0 || ^9.0.0",
|
|
127
|
-
"jest": "*"
|
|
127
|
+
"jest": "*",
|
|
128
|
+
"typescript": ">=4.8.4 <6.0.0"
|
|
128
129
|
},
|
|
129
130
|
"peerDependenciesMeta": {
|
|
130
131
|
"@typescript-eslint/eslint-plugin": {
|
|
@@ -132,6 +133,9 @@
|
|
|
132
133
|
},
|
|
133
134
|
"jest": {
|
|
134
135
|
"optional": true
|
|
136
|
+
},
|
|
137
|
+
"typescript": {
|
|
138
|
+
"optional": true
|
|
135
139
|
}
|
|
136
140
|
},
|
|
137
141
|
"packageManager": "yarn@4.12.0",
|