{"id":19874,"library":"eslint-plugin-playwright","title":"ESLint Plugin Playwright","description":"ESLint plugin for Playwright testing framework, providing lint rules to catch common mistakes and enforce best practices. Current stable version is v2.10.2, with frequent releases (weekly to bi-weekly). Supports both flat config (eslint.config.js) and legacy .eslintrc. Ships TypeScript types. Key differentiators: it is the official Playwright ESLint plugin, actively maintained, with 30+ rules including 'missing-playwright-await' to detect missing await on Playwright assertions, and 'no-wait-for-selector' replacement for deprecated APIs.","status":"active","version":"2.10.2","language":"javascript","source_language":"en","source_url":"https://github.com/mskelton/eslint-plugin-playwright","tags":["javascript","typescript"],"install":[{"cmd":"npm install eslint-plugin-playwright","lang":"bash","label":"npm"},{"cmd":"yarn add eslint-plugin-playwright","lang":"bash","label":"yarn"},{"cmd":"pnpm add eslint-plugin-playwright","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency for running ESLint rules","package":"eslint","optional":true}],"imports":[{"note":"CommonJS users must use `const playwright = require('eslint-plugin-playwright')`. The default import provides the plugin object with configs and rules.","wrong":"const { configs, rules } = require('eslint-plugin-playwright')","symbol":"default export (entire plugin object)","correct":"import playwright from 'eslint-plugin-playwright'"},{"note":"Since v2, flat config is accessed via `flat/recommended` key. Legacy `recommended` is for .eslintrc only.","wrong":"playwright.configs.recommended","symbol":"flat config (recommended)","correct":"playwright.configs['flat/recommended']"},{"note":"Rules are not exported as named exports; you must access via the `rules` object.","wrong":"import { missingPlaywrightAwait } from 'eslint-plugin-playwright'","symbol":"individual rules","correct":"import { rules } from 'eslint-plugin-playwright' // then reference rules['missing-playwright-await']"}],"quickstart":{"code":"// eslint.config.js (flat config)\nimport { defineConfig } from '@eslint/config'\nimport playwright from 'eslint-plugin-playwright'\n\nexport default defineConfig([\n  {\n    files: ['tests/**'],\n    extends: [playwright.configs['flat/recommended']],\n    rules: {\n      'playwright/max-expects': ['error', { max: 3 }],\n    },\n  },\n])\n","lang":"javascript","description":"Shows flat config usage: targeting tests/ folder, extending recommended flat config, and customizing a rule."},"warnings":[{"fix":"Use `playwright.configs['flat/recommended']` instead of `playwright.configs.recommended`","message":"Flat config breaking change: configs are under 'flat/recommended' not 'recommended'","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Update ESLint to >= 8.40.0 or stay on v1 if using older ESLint","message":"Requires ESLint >= 8.40.0","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Remove usage of page.waitForSelector and let Playwright handle waiting automatically","message":"Rule 'no-wait-for-selector' is deprecated in favor of Playwright's built-in auto-waiting","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Use `const playwright = require('eslint-plugin-playwright')` then `playwright.configs['flat/recommended']`","message":"CommonJS require returns the whole plugin object, not a default export","severity":"gotcha","affected_versions":">=2.0.0"},{"fix":"Choose one config format: flat config (eslint.config.js) or legacy (eslintrc)","message":"Using legacy config (eslintrc) with flat config will cause errors","severity":"gotcha","affected_versions":">=2.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run `npm install -D eslint-plugin-playwright` (or yarn/pnpm)","cause":"Package not installed or not in node_modules","error":"Error: Cannot find module 'eslint-plugin-playwright'"},{"fix":"Ensure eslint-plugin-playwright is installed and in your package.json devDependencies","cause":"Legacy config referencing 'plugin:playwright/recommended' but package not installed","error":"Error: Failed to load plugin 'playwright' declared in 'extends': The plugin is missing."},{"fix":"Add an assertion inside the test, e.g., await expect(page).toHaveTitle(...)","cause":"A test block has no assertion (expect) call","error":"Error: [playwright/expect-expect] Expected assertion to be made in a test body."},{"fix":"Add `await` before the method call: `await page.goto(url)`","cause":"Calling async Playwright method like page.goto() or locator.click() without await","error":"Error: [playwright/missing-playwright-await] Expected 'await' before Playwright async method."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}