From 94cb5bb0919addf0b9cb97168aea765ea48333d7 Mon Sep 17 00:00:00 2001 From: Randy Coulman Date: Fri, 12 Oct 2018 11:46:55 -0700 Subject: [PATCH] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20Upgrade=20to=20eslint-plug?= =?UTF-8?q?in-jest=2021.24.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - New rule: `jest/expect-expect` defaults to `off` for now, as we are unable to configure it to recognize `td.verify` as an assertion method. See https://github.com/jest-community/eslint-plugin-jest/issues/175. - New rule: `jest/no-alias-methods` defaults to `off` because we prefer `toThrowError` over `toThrow` and there's no way to configure the rule to allow some aliases but not all. - New rule: `jest/no-test-return-statement` defaults to `warn` - New rule: `jest/prefer-inline-snapshots` defaults to `off` - New rule: `jest/prefer-strict-equal` defaults to `warn` - New rule: `jest/require-tothrow-message` defaults to `warn` --- README.md | 2 +- jest.js | 13 +++++++++++++ package.json | 2 +- yarn.lock | 6 +++--- 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index c2e2f4e..e9b087e 100644 --- a/README.md +++ b/README.md @@ -135,7 +135,7 @@ This plugin contains all of the rules available in: - [eslint-plugin-react](https://github.com/yannickcr/eslint-plugin-react): 7.10.0 - [eslint-plugin-react-native](https://github.com/intellicode/eslint-plugin-react-native): 3.2.1 - [eslint-plugin-import](https://github.com/benmosher/eslint-plugin-import): 2.14.0 -- [eslint-plugin-jest](https://www.npmjs.com/package/eslint-plugin-jest): 21.15.0 +- [eslint-plugin-jest](https://www.npmjs.com/package/eslint-plugin-jest): 21.24.1 ## License diff --git a/jest.js b/jest.js index f7c8d17..2fe7c14 100644 --- a/jest.js +++ b/jest.js @@ -17,8 +17,13 @@ module.exports = { // // Enforce consistent test or it keyword "jest/consistent-test-it": ["warn", { fn: "test", withinDescribe: "test" }], + // Enforce assertion to be made in a test body + // Off for now, pending a resolution to https://github.com/jest-community/eslint-plugin-jest/issues/175 + "jest/expect-expect": "off", // Disallow capitalized test names "jest/lowercase-name": "warn", + // Don't use alias methods + "jest/no-alias-methods": "off", // Disallow disabled tests "jest/no-disabled-tests": "warn", // Disallow focused tests @@ -35,14 +40,22 @@ module.exports = { "jest/no-large-snapshots": "warn", // Disallow using f & x prefixes to define focused/skipped tests "jest/no-test-prefixes": "off", + // Disallow explicitly returning from tests + "jest/no-test-return-statement": "warn", // Suggest using expect.assertions() OR expect.hasAssertions() "jest/prefer-expect-assertions": "off", + // Suggest using inline snapshots + "jest/prefer-inline-snapshots": "off", + // Suggest using toStrictEqual() + "jest/prefer-strict-equal": "warn", // Suggest using toHaveLength() "jest/prefer-to-have-length": "warn", // Suggest using toBeNull() "jest/prefer-to-be-null": "warn", // Suggest using toBeUndefined() "jest/prefer-to-be-undefined": "warn", + // Require a message for toThrow() + "jest/require-tothrow-message": "warn", // Enforce valid describe() callback "jest/valid-describe": "warn", // Ensure expect is called correctly diff --git a/package.json b/package.json index 3730f49..9657883 100644 --- a/package.json +++ b/package.json @@ -48,7 +48,7 @@ "eslint-config-prettier": "^3.1.0", "eslint-find-rules": "^3.3.1", "eslint-plugin-import": "2.14.0", - "eslint-plugin-jest": "21.17.0", + "eslint-plugin-jest": "21.24.1", "eslint-plugin-react": "7.10.0", "eslint-plugin-react-native": "3.2.1", "husky": "^1.1.2", diff --git a/yarn.lock b/yarn.lock index f1d82d9..f6358cf 100644 --- a/yarn.lock +++ b/yarn.lock @@ -652,9 +652,9 @@ eslint-plugin-import@2.14.0: read-pkg-up "^2.0.0" resolve "^1.6.0" -eslint-plugin-jest@21.17.0: - version "21.17.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-21.17.0.tgz#fdb00e2f9ff16987d6ebcf2c75c7add105760bbb" +eslint-plugin-jest@21.24.1: + version "21.24.1" + resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-21.24.1.tgz#aaf3c34e816f07add83d1e9c20696fdc31fac8dc" eslint-plugin-react-native-globals@^0.1.1: version "0.1.2"