From edc522b3e6a4f35eca237390861f75c51be1193f Mon Sep 17 00:00:00 2001 From: Dennis Kigen Date: Fri, 13 Dec 2024 21:08:38 +0300 Subject: [PATCH] (chore) Scope testing-library plugin to lint tests only (#2153) 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 --- .eslintrc | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/.eslintrc b/.eslintrc index eb5aff8d7c..ecd2d2ec05 100644 --- a/.eslintrc +++ b/.eslintrc @@ -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",