Skip to content

Commit

Permalink
(chore) Scope testing-library plugin to lint tests only (#2153)
Browse files Browse the repository at this point in the history
This PR optimizes our ESLint configuration by only applying testing-library rules to test files. This fixes an issue where
Playwright tests were being linted with Testing Library rules, which caused a lot of redundant lint errors. The specific
changes are:

- Moving testing-library plugin to the `overrides` section of the ESLint config for `.test.tsx` files.
- Adding playwright plugin config for e2e tests
- Disabling the prefer screen queries rule for e2e tests
  • Loading branch information
denniskigen authored Dec 13, 2024
1 parent d80ae61 commit edc522b
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,22 @@
"env": {
"node": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:jest-dom/recommended",
"plugin:testing-library/react"
],
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended", "plugin:jest-dom/recommended"],
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint", "import", "jest-dom", "react-hooks", "testing-library"],
"overrides": [
{
"files": ["**/*.test.tsx"],
"extends": ["plugin:testing-library/react"]
},
{
"files": ["e2e/**/*.spec.ts"],
"extends": ["plugin:playwright/recommended"],
"rules": {
"testing-library/prefer-screen-queries": "off"
}
}
],
"rules": {
"react-hooks/exhaustive-deps": "warn",
"react-hooks/rules-of-hooks": "error",
Expand Down

0 comments on commit edc522b

Please sign in to comment.