Skip to content

Commit

Permalink
[v15] Update eslint-plugin-jest to 27.9.0, switch to recommended rule…
Browse files Browse the repository at this point in the history
…s only (#39571)

* Update eslint-plugin-jest to 27.9.0

https://github.com/jest-community/eslint-plugin-jest/blob/main/CHANGELOG.md#2600-2022-01-24
https://github.com/jest-community/eslint-plugin-jest/blob/main/CHANGELOG.md#2700-2022-08-28

I switched plugin:jest/all to plugin:jest/recommended, since /all just
activates every rule in the package. This might have been fine when this
package was added a couple of years ago, but it doesn't make sense anymore.

27.0.0 requires parserOptions.project to be set, but this returned an error:

    0:0  error  Parsing error: ESLint was configured to run on
    `<tsconfigRootDir>/web/packages/teleport/vite.config.mts` using `parserOptions.project`:
    /users/rav/src/teleport/tsconfig.json
    However, that TSConfig does not include this file. Either:
    - Change ESLint's list of included files to not include this file
    - Change that TSConfig to include this file
    - Create a new TSConfig that includes this file and include it in your parserOptions.project

I updated tsconfig.node.json so that it applies only to .mts files, as
I understand that was the original intention.

* Autofix jest/valid-title

* Do not set parserOptions.project

It makes ESLint slower by ~20s and it is not needed for recommended rules
from eslint-plugin-jest.
  • Loading branch information
ravicious authored Mar 20, 2024
1 parent 44d7406 commit 393d404
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 81 deletions.
2 changes: 0 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@
],
"references": [{ "path": "./tsconfig.node.json" }],
"exclude": [
"**/vite.config.mts",
"web/packages/build/vite/*",
"node_modules",
"**/node_modules/*",
"dist",
Expand Down
4 changes: 2 additions & 2 deletions tsconfig.node.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"allowSyntheticDefaultImports": true
},
"include": [
"web/packages/build/vite/*.ts",
"web/packages/teleport/vite.config.mts"
"e/web/**/*.mts",
"web/**/*.mts"
]
}
2 changes: 1 addition & 1 deletion web/packages/build/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ module.exports = {
files: ['**/*.test.{ts,tsx,js,jsx}'],
plugins: ['jest'],
extends: [
'plugin:jest/all',
'plugin:jest/recommended',
'plugin:testing-library/react',
'plugin:jest-dom/recommended',
],
Expand Down
2 changes: 1 addition & 1 deletion web/packages/build/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"eslint-import-resolver-webpack": "^0.13.7",
"eslint-plugin-babel": "^5.3.1",
"eslint-plugin-import": "2.28.1",
"eslint-plugin-jest": "^25.7.0",
"eslint-plugin-jest": "^27.9.0",
"eslint-plugin-jest-dom": "^5.1.0",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0",
Expand Down
4 changes: 2 additions & 2 deletions web/packages/shared/components/Validation/rules.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ describe('requiredRoleArn', () => {
${'arn:aws:iam::123456789012:role'} | ${false}
${''} | ${false}
${null} | ${false}
`('test role arn valid ($valid): $roleArn', ({ roleArn, valid }) => {
`('role arn valid ($valid): $roleArn', ({ roleArn, valid }) => {
const result = requiredRoleArn(roleArn)();
expect(result.valid).toEqual(valid);
});
Expand All @@ -96,7 +96,7 @@ describe('requiredIamRoleName', () => {
${Array.from('x'.repeat(65)).join('')} | ${false}
${null} | ${false}
${''} | ${false}
`('test IAM role name valid ($valid): $roleArn', ({ roleArn, valid }) => {
`('IAM role name valid ($valid): $roleArn', ({ roleArn, valid }) => {
const result = requiredIamRoleName(roleArn)();
expect(result.valid).toEqual(valid);
});
Expand Down
79 changes: 6 additions & 73 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4458,13 +4458,6 @@
semver "^7.5.4"
ts-api-utils "^1.0.1"

"@typescript-eslint/experimental-utils@^5.0.0":
version "5.50.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-5.50.0.tgz#d33160ef610cdcdfc376e3cb086cabd2c83e70c8"
integrity sha512-gZIhzNRivy0RVqcxjKnQ+ipGc0qolilhBeNmvH+Dvu7Vymug+IfiYxTj2zM7mIlHsw6Q5aH7L7WmuTE3tZyzag==
dependencies:
"@typescript-eslint/utils" "5.50.0"

"@typescript-eslint/[email protected]":
version "7.2.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-7.2.0.tgz#44356312aea8852a3a82deebdacd52ba614ec07a"
Expand All @@ -4476,14 +4469,6 @@
"@typescript-eslint/visitor-keys" "7.2.0"
debug "^4.3.4"

"@typescript-eslint/[email protected]":
version "5.50.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.50.0.tgz#90b8a3b337ad2c52bbfe4eac38f9164614e40584"
integrity sha512-rt03kaX+iZrhssaT974BCmoUikYtZI24Vp/kwTSy841XhiYShlqoshRFDvN1FKKvU2S3gK+kcBW1EA7kNUrogg==
dependencies:
"@typescript-eslint/types" "5.50.0"
"@typescript-eslint/visitor-keys" "5.50.0"

"@typescript-eslint/[email protected]":
version "5.62.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.62.0.tgz#d9457ccc6a0b8d6b37d0eb252a23022478c5460c"
Expand All @@ -4510,11 +4495,6 @@
debug "^4.3.4"
ts-api-utils "^1.0.1"

"@typescript-eslint/[email protected]":
version "5.50.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.50.0.tgz#c461d3671a6bec6c2f41f38ed60bd87aa8a30093"
integrity sha512-atruOuJpir4OtyNdKahiHZobPKFvZnBnfDiyEaBf6d9vy9visE7gDjlmhl+y29uxZ2ZDgvXijcungGFjGGex7w==

"@typescript-eslint/[email protected]":
version "5.62.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.62.0.tgz#258607e60effa309f067608931c3df6fed41fd2f"
Expand All @@ -4525,19 +4505,6 @@
resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-7.2.0.tgz#0feb685f16de320e8520f13cca30779c8b7c403f"
integrity sha512-XFtUHPI/abFhm4cbCDc5Ykc8npOKBSJePY3a3s+lwumt7XWJuzP5cZcfZ610MIPHjQjNsOLlYK8ASPaNG8UiyA==

"@typescript-eslint/[email protected]":
version "5.50.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.50.0.tgz#0b9b82975bdfa40db9a81fdabc7f93396867ea97"
integrity sha512-Gq4zapso+OtIZlv8YNAStFtT6d05zyVCK7Fx3h5inlLBx2hWuc/0465C2mg/EQDDU2LKe52+/jN4f0g9bd+kow==
dependencies:
"@typescript-eslint/types" "5.50.0"
"@typescript-eslint/visitor-keys" "5.50.0"
debug "^4.3.4"
globby "^11.1.0"
is-glob "^4.0.3"
semver "^7.3.7"
tsutils "^3.21.0"

"@typescript-eslint/[email protected]":
version "5.62.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.62.0.tgz#7d17794b77fabcac615d6a48fb143330d962eb9b"
Expand Down Expand Up @@ -4565,20 +4532,6 @@
semver "^7.5.4"
ts-api-utils "^1.0.1"

"@typescript-eslint/[email protected]":
version "5.50.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.50.0.tgz#807105f5ffb860644d30d201eefad7017b020816"
integrity sha512-v/AnUFImmh8G4PH0NDkf6wA8hujNNcrwtecqW4vtQ1UOSNBaZl49zP1SHoZ/06e+UiwzHpgb5zP5+hwlYYWYAw==
dependencies:
"@types/json-schema" "^7.0.9"
"@types/semver" "^7.3.12"
"@typescript-eslint/scope-manager" "5.50.0"
"@typescript-eslint/types" "5.50.0"
"@typescript-eslint/typescript-estree" "5.50.0"
eslint-scope "^5.1.1"
eslint-utils "^3.0.0"
semver "^7.3.7"

"@typescript-eslint/[email protected]":
version "7.2.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-7.2.0.tgz#fc8164be2f2a7068debb4556881acddbf0b7ce2a"
Expand All @@ -4592,7 +4545,7 @@
"@typescript-eslint/typescript-estree" "7.2.0"
semver "^7.5.4"

"@typescript-eslint/utils@^5.58.0":
"@typescript-eslint/utils@^5.10.0", "@typescript-eslint/utils@^5.58.0":
version "5.62.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.62.0.tgz#141e809c71636e4a75daa39faed2fb5f4b10df86"
integrity sha512-n8oxjeb5aIbPFEtmQxQYOLI0i9n5ySBEY/ZEHHZqKQSFnxio1rv6dthascc9dLuwrL0RC5mPCxB7vnAVGAYWAQ==
Expand All @@ -4606,14 +4559,6 @@
eslint-scope "^5.1.1"
semver "^7.3.7"

"@typescript-eslint/[email protected]":
version "5.50.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.50.0.tgz#b752ffc143841f3d7bc57d6dd01ac5c40f8c4903"
integrity sha512-cdMeD9HGu6EXIeGOh2yVW6oGf9wq8asBgZx7nsR/D36gTfQ0odE5kcRYe5M81vjEFAcPeugXrHg78Imu55F6gg==
dependencies:
"@typescript-eslint/types" "5.50.0"
eslint-visitor-keys "^3.3.0"

"@typescript-eslint/[email protected]":
version "5.62.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.62.0.tgz#2174011917ce582875954ffe2f6912d5931e353e"
Expand Down Expand Up @@ -7940,12 +7885,12 @@ eslint-plugin-jest-dom@^5.1.0:
"@babel/runtime" "^7.16.3"
requireindex "^1.2.0"

eslint-plugin-jest@^25.7.0:
version "25.7.0"
resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-25.7.0.tgz#ff4ac97520b53a96187bad9c9814e7d00de09a6a"
integrity sha512-PWLUEXeeF7C9QGKqvdSbzLOiLTx+bno7/HC9eefePfEb257QFHg7ye3dh80AZVkaa/RQsBB1Q/ORQvg2X7F0NQ==
eslint-plugin-jest@^27.9.0:
version "27.9.0"
resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-27.9.0.tgz#7c98a33605e1d8b8442ace092b60e9919730000b"
integrity sha512-QIT7FH7fNmd9n4se7FFKHbsLKGQiw885Ds6Y/sxKgCZ6natwCsXdgPOADnYVxN2QrRweF0FZWbJ6S7Rsn7llug==
dependencies:
"@typescript-eslint/experimental-utils" "^5.0.0"
"@typescript-eslint/utils" "^5.10.0"

eslint-plugin-react-hooks@^4.6.0:
version "4.6.0"
Expand Down Expand Up @@ -8002,18 +7947,6 @@ eslint-scope@^7.2.2:
esrecurse "^4.3.0"
estraverse "^5.2.0"

eslint-utils@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-3.0.0.tgz#8aebaface7345bb33559db0a1f13a1d2d48c3672"
integrity sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==
dependencies:
eslint-visitor-keys "^2.0.0"

eslint-visitor-keys@^2.0.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz#f65328259305927392c938ed44eb0a5c9b2bd303"
integrity sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==

eslint-visitor-keys@^3.3.0, eslint-visitor-keys@^3.4.1, eslint-visitor-keys@^3.4.3:
version "3.4.3"
resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz#0cd72fe8550e3c2eae156a96a4dddcd1c8ac5800"
Expand Down

0 comments on commit 393d404

Please sign in to comment.