From d86412cb1d18692c3c717648ce22f71a8c989069 Mon Sep 17 00:00:00 2001 From: Santiago Greco Date: Tue, 12 May 2026 14:49:21 +0200 Subject: [PATCH] CONSOLE-5245 install eslint-plugin-playwright for Playwright and update dependencies Add eslint-plugin-playwright to eslint-plugin-console and create a dedicated .eslintrc.js for e2e/ to scope Playwright rules away from the rest of the frontend codebase. Setup files (auth, cluster, teardown) obtain overrides for rules that don't apply to non-assertion setup logic. Co-Authored-By: Claude Sonnet 4.6 --- frontend/.eslintrc.js | 12 ---------- frontend/e2e/.eslintrc.js | 23 +++++++++++++++++++ frontend/e2e/pages/base-page.ts | 2 ++ .../packages/eslint-plugin-console/index.js | 1 + .../lib/config/playwright.js | 4 ++++ .../lib/config/testing-library-tests.js | 1 + .../eslint-plugin-console/package.json | 1 + frontend/yarn.lock | 19 +++++++++++++++ 8 files changed, 51 insertions(+), 12 deletions(-) create mode 100644 frontend/e2e/.eslintrc.js create mode 100644 frontend/packages/eslint-plugin-console/lib/config/playwright.js diff --git a/frontend/.eslintrc.js b/frontend/.eslintrc.js index 16aa0fa1a54..897a00cec92 100644 --- a/frontend/.eslintrc.js +++ b/frontend/.eslintrc.js @@ -127,18 +127,6 @@ module.exports = { version: 'detect', }, }, - overrides: [ - { - files: ['e2e/**/*.ts'], - parserOptions: { - project: './e2e/tsconfig.json', - }, - rules: { - 'no-console': 'off', - 'no-empty-pattern': 'off', - }, - }, - ], globals: { process: 'readonly', React: true, diff --git a/frontend/e2e/.eslintrc.js b/frontend/e2e/.eslintrc.js new file mode 100644 index 00000000000..932a10c6220 --- /dev/null +++ b/frontend/e2e/.eslintrc.js @@ -0,0 +1,23 @@ +module.exports = { + root: true, + parser: '@typescript-eslint/parser', + parserOptions: { + project: './tsconfig.json', + tsconfigRootDir: __dirname, + }, + extends: ['plugin:console/playwright'], + rules: { + 'no-console': 'off', + 'no-empty-pattern': 'off', + 'playwright/no-conditional-in-test': 'off', + 'playwright/no-skipped-test': ['warn', { allowConditional: true }], + }, + overrides: [ + { + files: ['setup/**/*.ts'], + rules: { + 'playwright/expect-expect': 'off', + }, + }, + ], +}; diff --git a/frontend/e2e/pages/base-page.ts b/frontend/e2e/pages/base-page.ts index ac3b835f454..c4ae455f391 100644 --- a/frontend/e2e/pages/base-page.ts +++ b/frontend/e2e/pages/base-page.ts @@ -70,6 +70,7 @@ export default abstract class BasePage { } catch (clickError) { const msg = clickError instanceof Error ? clickError.message : String(clickError); if (attempt < retries && (msg.includes('intercept') || msg.includes('not visible'))) { + // eslint-disable-next-line playwright/no-force-option await locator.click({ force: true, timeout: attemptTimeout }); return; } @@ -78,6 +79,7 @@ export default abstract class BasePage { } catch (error) { lastError = error; if (attempt < retries && retryDelay > 100) { + // eslint-disable-next-line playwright/no-wait-for-timeout await this.page.waitForTimeout(retryDelay); } } diff --git a/frontend/packages/eslint-plugin-console/index.js b/frontend/packages/eslint-plugin-console/index.js index 3a1be7e9228..251e97a5580 100644 --- a/frontend/packages/eslint-plugin-console/index.js +++ b/frontend/packages/eslint-plugin-console/index.js @@ -13,6 +13,7 @@ module.exports = { // Augmenting configs: choose one or more jest: require('./lib/config/jest'), + playwright: require('./lib/config/playwright'), // React Testing Library (test/spec files only). Also merged into `react-typescript-prettier`. 'testing-library-tests': require('./lib/config/testing-library-tests'), diff --git a/frontend/packages/eslint-plugin-console/lib/config/playwright.js b/frontend/packages/eslint-plugin-console/lib/config/playwright.js new file mode 100644 index 00000000000..7b237448a64 --- /dev/null +++ b/frontend/packages/eslint-plugin-console/lib/config/playwright.js @@ -0,0 +1,4 @@ +module.exports = { + plugins: ['playwright'], + extends: ['plugin:playwright/recommended'], +}; diff --git a/frontend/packages/eslint-plugin-console/lib/config/testing-library-tests.js b/frontend/packages/eslint-plugin-console/lib/config/testing-library-tests.js index fcef4fe1301..09a9efc8714 100644 --- a/frontend/packages/eslint-plugin-console/lib/config/testing-library-tests.js +++ b/frontend/packages/eslint-plugin-console/lib/config/testing-library-tests.js @@ -16,6 +16,7 @@ module.exports = { overrides: [ { files: ['**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[jt]s?(x)'], + excludedFiles: ['e2e/**'], plugins: ['testing-library'], extends: ['plugin:testing-library/react'], rules: { diff --git a/frontend/packages/eslint-plugin-console/package.json b/frontend/packages/eslint-plugin-console/package.json index 8ba3034a2ae..13c39a4947d 100644 --- a/frontend/packages/eslint-plugin-console/package.json +++ b/frontend/packages/eslint-plugin-console/package.json @@ -23,6 +23,7 @@ "eslint-plugin-json": "^2.0.1", "eslint-plugin-jsx-a11y": "^6.8.0", "eslint-plugin-n": "^17.24.0", + "eslint-plugin-playwright": "^2.10.2", "eslint-plugin-prettier": "^4.2.1", "eslint-plugin-promise": "^6.6.0", "eslint-plugin-react": "^7.37.0", diff --git a/frontend/yarn.lock b/frontend/yarn.lock index 53d86b1145f..e6a94a4400b 100644 --- a/frontend/yarn.lock +++ b/frontend/yarn.lock @@ -10947,6 +10947,7 @@ __metadata: eslint-plugin-json: "npm:^2.0.1" eslint-plugin-jsx-a11y: "npm:^6.8.0" eslint-plugin-n: "npm:^17.24.0" + eslint-plugin-playwright: "npm:^2.10.2" eslint-plugin-prettier: "npm:^4.2.1" eslint-plugin-promise: "npm:^6.6.0" eslint-plugin-react: "npm:^7.37.0" @@ -11100,6 +11101,17 @@ __metadata: languageName: node linkType: hard +"eslint-plugin-playwright@npm:^2.10.2": + version: 2.10.2 + resolution: "eslint-plugin-playwright@npm:2.10.2" + dependencies: + globals: "npm:^17.3.0" + peerDependencies: + eslint: ">=8.40.0" + checksum: 10c0/cede6b74aa8c242d058f42da7bfdc29db5119a4184b05d8735ced16a89a0968ca36de217ee7d927cdc6687ef3d32bff3f3f8211e7c62256ca274cb4d3b4e478d + languageName: node + linkType: hard + "eslint-plugin-prettier@npm:^4.2.1": version: 4.2.5 resolution: "eslint-plugin-prettier@npm:4.2.5" @@ -12719,6 +12731,13 @@ __metadata: languageName: node linkType: hard +"globals@npm:^17.3.0": + version: 17.6.0 + resolution: "globals@npm:17.6.0" + checksum: 10c0/cf94fb4329cc5c68cf81018fd68324f413181ee169f0235b0b33b82bc93fe7825a21beea951f83a80e8e4bbdad9c0c80515a145b5fd4b5cb52f2a80db899a93f + languageName: node + linkType: hard + "globalthis@npm:^1.0.4": version: 1.0.4 resolution: "globalthis@npm:1.0.4"