Skip to content

Commit 8e3dc9f

Browse files
committed
Add ESLint plugins
1 parent 57938d0 commit 8e3dc9f

File tree

4 files changed

+98
-65
lines changed

4 files changed

+98
-65
lines changed

eslint.config.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import path from 'node:path';
22
import { globalIgnores } from 'eslint/config';
33
import jest from 'eslint-plugin-jest';
4+
import jestDom from 'eslint-plugin-jest-dom';
45
import prettierRecommended from 'eslint-plugin-prettier/recommended';
6+
import testingLibrary from 'eslint-plugin-testing-library';
57
import globals from 'globals';
68
import tsEslint from 'typescript-eslint';
79
import { includeIgnoreFile } from '@eslint/compat';
@@ -190,11 +192,22 @@ const config = tsEslint.config([
190192
{
191193
files: ['node_package/tests/**', '**/*.test.{js,jsx,ts,tsx}'],
192194

193-
extends: [jest.configs['flat/recommended'], jest.configs['flat/style']],
195+
extends: [
196+
jest.configs['flat/recommended'],
197+
jest.configs['flat/style'],
198+
jestDom.configs['flat/recommended'],
199+
testingLibrary.configs['flat/react'],
200+
],
194201

195202
rules: {
196203
// Allows Jest mocks before import
197204
'import/first': 'off',
205+
'testing-library/no-unnecessary-act': [
206+
'error',
207+
{
208+
isStrict: false,
209+
},
210+
],
198211
},
199212
},
200213
// must be the last config in the array

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,13 @@
4040
"eslint-import-resolver-alias": "^1.1.2",
4141
"eslint-plugin-import": "^2.31.0",
4242
"eslint-plugin-jest": "^28.11.0",
43+
"eslint-plugin-jest-dom": "^5.5.0",
4344
"eslint-plugin-jsx-a11y": "^6.10.2",
4445
"eslint-plugin-prettier": "^5.2.3",
4546
"eslint-plugin-react": "^7.37.4",
4647
"eslint-plugin-react-hooks": "^5.2.0",
4748
"typescript-eslint": "^8.29.1",
49+
"eslint-plugin-testing-library": "^7.1.1",
4850
"globals": "^16.0.0",
4951
"jest": "^29.7.0",
5052
"jest-environment-jsdom": "^29.7.0",

script/convert

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,11 @@ gsub_file_content("../Gemfile.development_dependencies", /gem "shakapacker", "[^
2121
gsub_file_content("../spec/dummy/package.json", /"shakapacker": "[^"]*",/, '"shakapacker": "6.6.0",')
2222

2323
# The below packages don't work on the oldest supported Node version and aren't needed there anyway
24-
gsub_file_content("../package.json", /"eslint": "[^"]*",/, "")
25-
gsub_file_content("../package.json", /"eslint-plugin-jest": "[^"]*",/, "")
24+
gsub_file_content("../package.json", /"[^"]*eslint[^"]*": "[^"]*",/, "")
2625
gsub_file_content("../package.json", /"globals": "[^"]*",/, "")
2726
gsub_file_content("../package.json", /"knip": "[^"]*",/, "")
2827
gsub_file_content("../package.json", /"publint": "[^"]*",/, "")
29-
gsub_file_content("../package.json", /"typescript-eslint": "[^"]*",/, "")
3028
gsub_file_content("../package.json", %r{"@arethetypeswrong/cli": "[^"]*",}, "")
31-
gsub_file_content("../package.json", %r{"@eslint/compat": "[^"]*",}, "")
3229
gsub_file_content("../package.json", %r{"@testing-library/dom": "[^"]*",}, "")
3330
gsub_file_content("../package.json", %r{"@testing-library/react": "[^"]*",}, "")
3431

yarn.lock

Lines changed: 81 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1009,10 +1009,10 @@
10091009
resolved "https://registry.yarnpkg.com/@babel/regjsgen/-/regjsgen-0.8.0.tgz#f0ba69b075e1f05fb2825b7fad991e7adbb18310"
10101010
integrity sha512-x/rqGMdzj+fWZvCOYForTghzbtqPDZ5gPwaoNGHdgDfF2QA/XZbCBp4Moo5scrkAMPhB7z26XM/AaHuIJdgauA==
10111011

1012-
"@babel/runtime@^7.12.5", "@babel/runtime@^7.8.4", "@babel/runtime@^7.9.2":
1013-
version "7.23.8"
1014-
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.23.8.tgz#8ee6fe1ac47add7122902f257b8ddf55c898f650"
1015-
integrity sha512-Y7KbAP984rn1VGMbGqKmBLio9V7y5Je9GvU4rQPCPinCyNfUcToxIXl06d59URp/F3LwinvODxab5N/G6qggkw==
1012+
"@babel/runtime@^7.12.5", "@babel/runtime@^7.16.3", "@babel/runtime@^7.8.4", "@babel/runtime@^7.9.2":
1013+
version "7.27.0"
1014+
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.27.0.tgz#fbee7cf97c709518ecc1f590984481d5460d4762"
1015+
integrity sha512-VtPOkrdPHZsKc/clNqyi9WUA8TINkZ4cGk63UUE3u4pmB2k+ZMQRDuIOagv8UVd6j7k0T3+RRIb7beKTebNbcw==
10161016
dependencies:
10171017
regenerator-runtime "^0.14.0"
10181018

@@ -1695,85 +1695,85 @@
16951695
dependencies:
16961696
"@types/yargs-parser" "*"
16971697

1698-
"@typescript-eslint/eslint-plugin@8.29.1":
1699-
version "8.29.1"
1700-
resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.29.1.tgz#593639d9bb5239b2d877d65757b7e2c9100a2e84"
1701-
integrity sha512-ba0rr4Wfvg23vERs3eB+P3lfj2E+2g3lhWcCVukUuhtcdUx5lSIFZlGFEBHKr+3zizDa/TvZTptdNHVZWAkSBg==
1698+
"@typescript-eslint/eslint-plugin@8.31.0":
1699+
version "8.31.0"
1700+
resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.31.0.tgz#ef3ece95406a80026f82a19a2984c1e375981711"
1701+
integrity sha512-evaQJZ/J/S4wisevDvC1KFZkPzRetH8kYZbkgcTRyql3mcKsf+ZFDV1BVWUGTCAW5pQHoqn5gK5b8kn7ou9aFQ==
17021702
dependencies:
17031703
"@eslint-community/regexpp" "^4.10.0"
1704-
"@typescript-eslint/scope-manager" "8.29.1"
1705-
"@typescript-eslint/type-utils" "8.29.1"
1706-
"@typescript-eslint/utils" "8.29.1"
1707-
"@typescript-eslint/visitor-keys" "8.29.1"
1704+
"@typescript-eslint/scope-manager" "8.31.0"
1705+
"@typescript-eslint/type-utils" "8.31.0"
1706+
"@typescript-eslint/utils" "8.31.0"
1707+
"@typescript-eslint/visitor-keys" "8.31.0"
17081708
graphemer "^1.4.0"
17091709
ignore "^5.3.1"
17101710
natural-compare "^1.4.0"
17111711
ts-api-utils "^2.0.1"
17121712

1713-
"@typescript-eslint/parser@8.29.1":
1714-
version "8.29.1"
1715-
resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-8.29.1.tgz#10bf37411be0a199c27b6515726e22fe8d3df8d0"
1716-
integrity sha512-zczrHVEqEaTwh12gWBIJWj8nx+ayDcCJs06yoNMY0kwjMWDM6+kppljY+BxWI06d2Ja+h4+WdufDcwMnnMEWmg==
1713+
"@typescript-eslint/parser@8.31.0":
1714+
version "8.31.0"
1715+
resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-8.31.0.tgz#5ec28823d06dd20ed5f67b61224823f12ccde095"
1716+
integrity sha512-67kYYShjBR0jNI5vsf/c3WG4u+zDnCTHTPqVMQguffaWWFs7artgwKmfwdifl+r6XyM5LYLas/dInj2T0SgJyw==
17171717
dependencies:
1718-
"@typescript-eslint/scope-manager" "8.29.1"
1719-
"@typescript-eslint/types" "8.29.1"
1720-
"@typescript-eslint/typescript-estree" "8.29.1"
1721-
"@typescript-eslint/visitor-keys" "8.29.1"
1718+
"@typescript-eslint/scope-manager" "8.31.0"
1719+
"@typescript-eslint/types" "8.31.0"
1720+
"@typescript-eslint/typescript-estree" "8.31.0"
1721+
"@typescript-eslint/visitor-keys" "8.31.0"
17221722
debug "^4.3.4"
17231723

1724-
"@typescript-eslint/scope-manager@8.29.1":
1725-
version "8.29.1"
1726-
resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-8.29.1.tgz#cfdfd4144f20c38b9d3e430efd6480e297ef52f6"
1727-
integrity sha512-2nggXGX5F3YrsGN08pw4XpMLO1Rgtnn4AzTegC2MDesv6q3QaTU5yU7IbS1tf1IwCR0Hv/1EFygLn9ms6LIpDA==
1724+
"@typescript-eslint/scope-manager@8.31.0", "@typescript-eslint/scope-manager@^8.15.0":
1725+
version "8.31.0"
1726+
resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-8.31.0.tgz#48c7f7d729ea038e36cae0ff511e48c2412fb11c"
1727+
integrity sha512-knO8UyF78Nt8O/B64i7TlGXod69ko7z6vJD9uhSlm0qkAbGeRUSudcm0+K/4CrRjrpiHfBCjMWlc08Vav1xwcw==
17281728
dependencies:
1729-
"@typescript-eslint/types" "8.29.1"
1730-
"@typescript-eslint/visitor-keys" "8.29.1"
1729+
"@typescript-eslint/types" "8.31.0"
1730+
"@typescript-eslint/visitor-keys" "8.31.0"
17311731

1732-
"@typescript-eslint/type-utils@8.29.1":
1733-
version "8.29.1"
1734-
resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-8.29.1.tgz#653dfff5c1711bc920a6a46a5a2c274899f00179"
1735-
integrity sha512-DkDUSDwZVCYN71xA4wzySqqcZsHKic53A4BLqmrWFFpOpNSoxX233lwGu/2135ymTCR04PoKiEEEvN1gFYg4Tw==
1732+
"@typescript-eslint/type-utils@8.31.0":
1733+
version "8.31.0"
1734+
resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-8.31.0.tgz#01536a993fae23e2def885b006aaa991cbfbe9e7"
1735+
integrity sha512-DJ1N1GdjI7IS7uRlzJuEDCgDQix3ZVYVtgeWEyhyn4iaoitpMBX6Ndd488mXSx0xah/cONAkEaYyylDyAeHMHg==
17361736
dependencies:
1737-
"@typescript-eslint/typescript-estree" "8.29.1"
1738-
"@typescript-eslint/utils" "8.29.1"
1737+
"@typescript-eslint/typescript-estree" "8.31.0"
1738+
"@typescript-eslint/utils" "8.31.0"
17391739
debug "^4.3.4"
17401740
ts-api-utils "^2.0.1"
17411741

1742-
"@typescript-eslint/types@8.29.1":
1743-
version "8.29.1"
1744-
resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-8.29.1.tgz#984ed1283fedbfb41d3993a9abdcb7b299971500"
1745-
integrity sha512-VT7T1PuJF1hpYC3AGm2rCgJBjHL3nc+A/bhOp9sGMKfi5v0WufsX/sHCFBfNTx2F+zA6qBc/PD0/kLRLjdt8mQ==
1742+
"@typescript-eslint/types@8.31.0":
1743+
version "8.31.0"
1744+
resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-8.31.0.tgz#c48e20ec47a43b72747714f49ea9f7b38a4fa6c1"
1745+
integrity sha512-Ch8oSjVyYyJxPQk8pMiP2FFGYatqXQfQIaMp+TpuuLlDachRWpUAeEu1u9B/v/8LToehUIWyiKcA/w5hUFRKuQ==
17461746

1747-
"@typescript-eslint/typescript-estree@8.29.1":
1748-
version "8.29.1"
1749-
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-8.29.1.tgz#4ac085665ed5390d11c0e3426427978570e3b747"
1750-
integrity sha512-l1enRoSaUkQxOQnbi0KPUtqeZkSiFlqrx9/3ns2rEDhGKfTa+88RmXqedC1zmVTOWrLc2e6DEJrTA51C9iLH5g==
1747+
"@typescript-eslint/typescript-estree@8.31.0":
1748+
version "8.31.0"
1749+
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-8.31.0.tgz#9c7f84eff6ad23d63cf086c6e93af571cd561270"
1750+
integrity sha512-xLmgn4Yl46xi6aDSZ9KkyfhhtnYI15/CvHbpOy/eR5NWhK/BK8wc709KKwhAR0m4ZKRP7h07bm4BWUYOCuRpQQ==
17511751
dependencies:
1752-
"@typescript-eslint/types" "8.29.1"
1753-
"@typescript-eslint/visitor-keys" "8.29.1"
1752+
"@typescript-eslint/types" "8.31.0"
1753+
"@typescript-eslint/visitor-keys" "8.31.0"
17541754
debug "^4.3.4"
17551755
fast-glob "^3.3.2"
17561756
is-glob "^4.0.3"
17571757
minimatch "^9.0.4"
17581758
semver "^7.6.0"
17591759
ts-api-utils "^2.0.1"
17601760

1761-
"@typescript-eslint/utils@8.29.1", "@typescript-eslint/utils@^6.0.0 || ^7.0.0 || ^8.0.0":
1762-
version "8.29.1"
1763-
resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-8.29.1.tgz#3d206c8c8def3527a8eb0588e94e3e60f7e167c9"
1764-
integrity sha512-QAkFEbytSaB8wnmB+DflhUPz6CLbFWE2SnSCrRMEa+KnXIzDYbpsn++1HGvnfAsUY44doDXmvRkO5shlM/3UfA==
1761+
"@typescript-eslint/utils@8.31.0", "@typescript-eslint/utils@^6.0.0 || ^7.0.0 || ^8.0.0", "@typescript-eslint/utils@^8.15.0":
1762+
version "8.31.0"
1763+
resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-8.31.0.tgz#6fb52471a29fdd16fc253d568c5ad4b048f78ba4"
1764+
integrity sha512-qi6uPLt9cjTFxAb1zGNgTob4x9ur7xC6mHQJ8GwEzGMGE9tYniublmJaowOJ9V2jUzxrltTPfdG2nKlWsq0+Ww==
17651765
dependencies:
17661766
"@eslint-community/eslint-utils" "^4.4.0"
1767-
"@typescript-eslint/scope-manager" "8.29.1"
1768-
"@typescript-eslint/types" "8.29.1"
1769-
"@typescript-eslint/typescript-estree" "8.29.1"
1767+
"@typescript-eslint/scope-manager" "8.31.0"
1768+
"@typescript-eslint/types" "8.31.0"
1769+
"@typescript-eslint/typescript-estree" "8.31.0"
17701770

1771-
"@typescript-eslint/visitor-keys@8.29.1":
1772-
version "8.29.1"
1773-
resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-8.29.1.tgz#9b74e5098c71138d42bbf2178fbe4dfad45d6b9a"
1774-
integrity sha512-RGLh5CRaUEf02viP5c1Vh1cMGffQscyHe7HPAzGpfmfflFg1wUz2rYxd+OZqwpeypYvZ8UxSxuIpF++fmOzEcg==
1771+
"@typescript-eslint/visitor-keys@8.31.0":
1772+
version "8.31.0"
1773+
resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-8.31.0.tgz#9a1a97ed16c60d4d1e7399b41c11a6d94ebc1ce5"
1774+
integrity sha512-QcGHmlRHWOl93o64ZUMNewCdwKGU6WItOU52H0djgNmn1EOrhVudrDzXz4OycCRSCPwFCDrE2iIt5vmuUdHxuQ==
17751775
dependencies:
1776-
"@typescript-eslint/types" "8.29.1"
1776+
"@typescript-eslint/types" "8.31.0"
17771777
eslint-visitor-keys "^4.2.0"
17781778

17791779
abab@^2.0.6:
@@ -2967,6 +2967,14 @@ eslint-plugin-import@^2.31.0:
29672967
string.prototype.trimend "^1.0.8"
29682968
tsconfig-paths "^3.15.0"
29692969

2970+
eslint-plugin-jest-dom@^5.5.0:
2971+
version "5.5.0"
2972+
resolved "https://registry.yarnpkg.com/eslint-plugin-jest-dom/-/eslint-plugin-jest-dom-5.5.0.tgz#3ccdfe197eddb4108f390db583057a5dacccd4a0"
2973+
integrity sha512-CRlXfchTr7EgC3tDI7MGHY6QjdJU5Vv2RPaeeGtkXUHnKZf04kgzMPIJUXt4qKCvYWVVIEo9ut9Oq1vgXAykEA==
2974+
dependencies:
2975+
"@babel/runtime" "^7.16.3"
2976+
requireindex "^1.2.0"
2977+
29702978
eslint-plugin-jest@^28.11.0:
29712979
version "28.11.0"
29722980
resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-28.11.0.tgz#2641ecb4411941bbddb3d7cf8a8ff1163fbb510e"
@@ -3032,6 +3040,14 @@ eslint-plugin-react@^7.28.0, eslint-plugin-react@^7.37.4:
30323040
string.prototype.matchall "^4.0.12"
30333041
string.prototype.repeat "^1.0.0"
30343042

3043+
eslint-plugin-testing-library@^7.1.1:
3044+
version "7.1.1"
3045+
resolved "https://registry.yarnpkg.com/eslint-plugin-testing-library/-/eslint-plugin-testing-library-7.1.1.tgz#df834e821e53fa81c1eb1fad5a0d9ba4c510f9ea"
3046+
integrity sha512-nszC833aZPwB6tik1nMkbFqmtgIXTT0sfJEYs0zMBKMlkQ4to2079yUV96SvmLh00ovSBJI4pgcBC1TiIP8mXg==
3047+
dependencies:
3048+
"@typescript-eslint/scope-manager" "^8.15.0"
3049+
"@typescript-eslint/utils" "^8.15.0"
3050+
30353051
30363052
version "5.1.1"
30373053
resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.1.1.tgz#e786e59a66cb92b3f6c1fb0d508aab174848f48c"
@@ -5342,6 +5358,11 @@ require-main-filename@^2.0.0:
53425358
resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-2.0.0.tgz#d0b329ecc7cc0f61649f62215be69af54aa8989b"
53435359
integrity sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==
53445360

5361+
requireindex@^1.2.0:
5362+
version "1.2.0"
5363+
resolved "https://registry.yarnpkg.com/requireindex/-/requireindex-1.2.0.tgz#3463cdb22ee151902635aa6c9535d4de9c2ef1ef"
5364+
integrity sha512-L9jEkOi3ASd9PYit2cwRfyppc9NoABujTP8/5gFcbERmo5jUoAKovIC3fsF17pkTnGsrByysqX+Kxd2OTNI1ww==
5365+
53455366
requires-port@^1.0.0:
53465367
version "1.0.0"
53475368
resolved "https://registry.yarnpkg.com/requires-port/-/requires-port-1.0.0.tgz#925d2601d39ac485e091cf0da5c6e694dc3dcaff"
@@ -6008,13 +6029,13 @@ typed-array-length@^1.0.7:
60086029
reflect.getprototypeof "^1.0.6"
60096030

60106031
typescript-eslint@^8.29.1:
6011-
version "8.29.1"
6012-
resolved "https://registry.yarnpkg.com/typescript-eslint/-/typescript-eslint-8.29.1.tgz#c0b205e542ade22f9027caaaa9c4ec31a202010f"
6013-
integrity sha512-f8cDkvndhbQMPcysk6CUSGBWV+g1utqdn71P5YKwMumVMOG/5k7cHq0KyG4O52nB0oKS4aN2Tp5+wB4APJGC+w==
6032+
version "8.31.0"
6033+
resolved "https://registry.yarnpkg.com/typescript-eslint/-/typescript-eslint-8.31.0.tgz#955e2e81011afbc11db3abd5f1d073a4b12e1270"
6034+
integrity sha512-u+93F0sB0An8WEAPtwxVhFby573E8ckdjwUUQUj9QA4v8JAvgtoDdIyYR3XFwFHq2W1KJ1AurwJCO+w+Y1ixyQ==
60146035
dependencies:
6015-
"@typescript-eslint/eslint-plugin" "8.29.1"
6016-
"@typescript-eslint/parser" "8.29.1"
6017-
"@typescript-eslint/utils" "8.29.1"
6036+
"@typescript-eslint/eslint-plugin" "8.31.0"
6037+
"@typescript-eslint/parser" "8.31.0"
6038+
"@typescript-eslint/utils" "8.31.0"
60186039

60196040
60206041
version "5.6.1-rc"

0 commit comments

Comments
 (0)