{"id":13651264,"url":"https://github.com/playwright-community/eslint-plugin-playwright","last_synced_at":"2025-05-14T10:13:03.706Z","repository":{"id":37737489,"uuid":"251400482","full_name":"playwright-community/eslint-plugin-playwright","owner":"playwright-community","description":"ESLint plugin for Playwright","archived":false,"fork":false,"pushed_at":"2025-04-17T17:30:45.000Z","size":1310,"stargazers_count":315,"open_issues_count":19,"forks_count":42,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-05-05T06:03:34.231Z","etag":null,"topics":["eslint","eslint-plugin","jest","jest-playwright","playwright","playwright-test-runner"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/eslint-plugin-playwright","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/playwright-community.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-03-30T18:57:06.000Z","updated_at":"2025-04-29T11:42:32.000Z","dependencies_parsed_at":"2023-10-17T04:39:23.128Z","dependency_job_id":"3b25a8bd-85ea-4724-9a44-ff44f0f76c80","html_url":"https://github.com/playwright-community/eslint-plugin-playwright","commit_stats":{"total_commits":270,"total_committers":28,"mean_commits":9.642857142857142,"dds":0.3111111111111111,"last_synced_commit":"5c20c521c84ebb9f7b3a3f515d22f945bf44e2e5"},"previous_names":["mxschmitt/eslint-plugin-playwright"],"tags_count":66,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/playwright-community%2Feslint-plugin-playwright","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/playwright-community%2Feslint-plugin-playwright/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/playwright-community%2Feslint-plugin-playwright/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/playwright-community%2Feslint-plugin-playwright/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/playwright-community","download_url":"https://codeload.github.com/playwright-community/eslint-plugin-playwright/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253082850,"owners_count":21851169,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["eslint","eslint-plugin","jest","jest-playwright","playwright","playwright-test-runner"],"created_at":"2024-08-02T02:00:47.308Z","updated_at":"2025-05-14T10:13:03.646Z","avatar_url":"https://github.com/playwright-community.png","language":"TypeScript","funding_links":[],"categories":["Plugins","Utils"],"sub_categories":["Testing Tools"],"readme":"# ESLint Plugin Playwright\n\n[![Test](https://github.com/playwright-community/eslint-plugin-playwright/actions/workflows/test.yml/badge.svg)](https://github.com/playwright-community/eslint-plugin-playwright/actions/workflows/test.yml)\n[![npm](https://img.shields.io/npm/v/eslint-plugin-playwright)](https://www.npmjs.com/package/eslint-plugin-playwright)\n[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)\n\nESLint plugin for [Playwright](https://github.com/microsoft/playwright).\n\n## Installation\n\nnpm\n\n```bash\nnpm install -D eslint-plugin-playwright\n```\n\nYarn\n\n```bash\nyarn add -D eslint-plugin-playwright\n```\n\npnpm\n\n```bash\npnpm add -D eslint-plugin-playwright\n```\n\n## Usage\n\nThe recommended setup is to use the `files` field to target only Playwright test\nfiles. In the examples below, this is done by targeting files in the `tests`\ndirectory and only applying the Playwright rules to those files. In your\nproject, you may need to change the `files` field to match your Playwright test\nfile patterns.\n\n[Flat config](https://eslint.org/docs/latest/use/configure/configuration-files-new)\n(**eslint.config.js**)\n\n```javascript\nimport playwright from 'eslint-plugin-playwright'\n\nexport default [\n  {\n    ...playwright.configs['flat/recommended'],\n    files: ['tests/**'],\n    rules: {\n      ...playwright.configs['flat/recommended'].rules,\n      // Customize Playwright rules\n      // ...\n    },\n  },\n]\n```\n\n[Legacy config](https://eslint.org/docs/latest/use/configure/configuration-files)\n(**.eslintrc**)\n\n```json\n{\n  \"overrides\": [\n    {\n      \"files\": \"tests/**\",\n      \"extends\": \"plugin:playwright/recommended\"\n    }\n  ]\n}\n```\n\n## Settings\n\n### Aliased Playwright Globals\n\nIf you import Playwright globals (e.g. `test`, `expect`) with a custom name, you\ncan configure this plugin to be aware of these additional names.\n\n```json\n{\n  \"settings\": {\n    \"playwright\": {\n      \"globalAliases\": {\n        \"test\": [\"myTest\"],\n        \"expect\": [\"myExpect\"]\n      }\n    }\n  }\n}\n```\n\n### Custom Messages\n\nYou can customize the error messages for rules using the\n`settings.playwright.messages` property. This is useful if you would like to\nincrease the verbosity of error messages or provide additional context.\n\nOnly the message ids you define in this setting will be overridden, so any other\nmessages will use the default message defined by the plugin.\n\n```json\n{\n  \"settings\": {\n    \"playwright\": {\n      \"messages\": {\n        \"conditionalExpect\": \"Avoid conditional expects as they can lead to false positives\"\n      }\n    }\n  }\n}\n```\n\n## Rules\n\n✅ Set in the `recommended` configuration\\\n🔧 Automatically fixable by the [`--fix`](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix)\nCLI option\\\n💡 Manually fixable by\n[editor suggestions](https://eslint.org/docs/latest/developer-guide/working-with-rules#providing-suggestions)\n\n| Rule                                                                                                                                                | Description                                                        | ✅  | 🔧  | 💡  |\n| --------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------ | :-: | :-: | :-: |\n| [expect-expect](https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/expect-expect.md)                             | Enforce assertion to be made in a test body                        | ✅  |     |     |\n| [max-expects](https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/max-expects.md)                                 | Enforces a maximum number assertion calls in a test body           |     |     |     |\n| [max-nested-describe](https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/max-nested-describe.md)                 | Enforces a maximum depth to nested describe calls                  | ✅  |     |     |\n| [missing-playwright-await](https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/missing-playwright-await.md)       | Enforce Playwright APIs to be awaited                              | ✅  | 🔧  |     |\n| [no-commented-out-tests](https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/no-commented-out-tests.md)           | Disallow commented out tests                                       |     |     |     |\n| [no-conditional-expect](https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/no-conditional-expect.md)             | Disallow calling `expect` conditionally                            | ✅  |     |     |\n| [no-conditional-in-test](https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/no-conditional-in-test.md)           | Disallow conditional logic in tests                                | ✅  |     |     |\n| [no-duplicate-hooks](https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/no-duplicate-hooks.md)                   | Disallow duplicate setup and teardown hooks                        |     |     |     |\n| [no-element-handle](https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/no-element-handle.md)                     | Disallow usage of element handles                                  | ✅  |     | 💡  |\n| [no-eval](https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/no-eval.md)                                         | Disallow usage of `page.$eval()` and `page.$$eval()`               | ✅  |     |     |\n| [no-focused-test](https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/no-focused-test.md)                         | Disallow usage of `.only` annotation                               | ✅  |     | 💡  |\n| [no-force-option](https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/no-force-option.md)                         | Disallow usage of the `{ force: true }` option                     | ✅  |     |     |\n| [no-get-by-title](https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/no-get-by-title.md)                         | Disallow using `getByTitle()`                                      |     | 🔧  |     |\n| [no-hooks](https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/no-hooks.md)                                       | Disallow setup and teardown hooks                                  |     |     |     |\n| [no-nested-step](https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/no-nested-step.md)                           | Disallow nested `test.step()` methods                              | ✅  |     |     |\n| [no-networkidle](https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/no-networkidle.md)                           | Disallow usage of the `networkidle` option                         | ✅  |     |     |\n| [no-nth-methods](https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/no-nth-methods.md)                           | Disallow usage of `first()`, `last()`, and `nth()` methods         |     |     |     |\n| [no-page-pause](https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/no-page-pause.md)                             | Disallow using `page.pause()`                                      | ✅  |     |     |\n| [no-raw-locators](https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/no-raw-locators.md)                         | Disallow using raw locators                                        |     |     |     |\n| [no-restricted-matchers](https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/no-restricted-matchers.md)           | Disallow specific matchers \u0026 modifiers                             |     |     |     |\n| [no-skipped-test](https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/no-skipped-test.md)                         | Disallow usage of the `.skip` annotation                           | ✅  |     | 💡  |\n| [no-slowed-test](https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/no-slowed-test.md)                           | Disallow usage of the `.slow` annotation                           |     |     | 💡  |\n| [no-standalone-expect](https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/no-standalone-expect.md)               | Disallow using expect outside of `test` blocks                     | ✅  |     |     |\n| [no-unsafe-references](https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/no-unsafe-references.md)               | Prevent unsafe variable references in `page.evaluate()`            | ✅  | 🔧  |     |\n| [no-useless-await](https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/no-useless-await.md)                       | Disallow unnecessary `await`s for Playwright methods               | ✅  | 🔧  |     |\n| [no-useless-not](https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/no-useless-not.md)                           | Disallow usage of `not` matchers when a specific matcher exists    | ✅  | 🔧  |     |\n| [no-wait-for-selector](https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/no-wait-for-selector.md)               | Disallow usage of `page.waitForSelector()`                         | ✅  |     | 💡  |\n| [no-wait-for-timeout](https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/no-wait-for-timeout.md)                 | Disallow usage of `page.waitForTimeout()`                          | ✅  |     | 💡  |\n| [prefer-comparison-matcher](https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/prefer-comparison-matcher.md)     | Suggest using the built-in comparison matchers                     |     | 🔧  |     |\n| [prefer-equality-matcher](https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/prefer-equality-matcher.md)         | Suggest using the built-in equality matchers                       |     |     | 💡  |\n| [prefer-hooks-in-order](https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/prefer-hooks-in-order.md)             | Prefer having hooks in a consistent order                          |     |     |     |\n| [prefer-hooks-on-top](https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/prefer-hooks-on-top.md)                 | Suggest having hooks before any test cases                         |     |     |     |\n| [prefer-lowercase-title](https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/prefer-lowercase-title.md)           | Enforce lowercase test names                                       |     | 🔧  |     |\n| [prefer-native-locators](https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/prefer-native-locators.md)           | Suggest built-in locators over `page.locator()`                    |     | 🔧  |     |\n| [prefer-locator](https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/prefer-locator.md)                           | Suggest locators over page methods                                 |     |     |     |\n| [prefer-strict-equal](https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/prefer-strict-equal.md)                 | Suggest using `toStrictEqual()`                                    |     |     | 💡  |\n| [prefer-to-be](https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/prefer-to-be.md)                               | Suggest using `toBe()`                                             |     | 🔧  |     |\n| [prefer-to-contain](https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/prefer-to-contain.md)                     | Suggest using `toContain()`                                        |     | 🔧  |     |\n| [prefer-to-have-count](https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/prefer-to-have-count.md)               | Suggest using `toHaveCount()`                                      |     | 🔧  |     |\n| [prefer-to-have-length](https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/prefer-to-have-length.md)             | Suggest using `toHaveLength()`                                     |     | 🔧  |     |\n| [prefer-web-first-assertions](https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/prefer-web-first-assertions.md) | Suggest using web first assertions                                 | ✅  | 🔧  |     |\n| [require-hook](https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/require-hook.md)                               | Require setup and teardown code to be within a hook                |     |     |     |\n| [require-soft-assertions](https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/require-soft-assertions.md)         | Require assertions to use `expect.soft()`                          |     | 🔧  |     |\n| [require-to-throw-message](https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/require-to-throw-message.md)       | Require a message for `toThrow()`                                  |     |     |     |\n| [require-top-level-describe](https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/require-top-level-describe.md)   | Require test cases and hooks to be inside a `test.describe` block  |     |     |     |\n| [valid-describe-callback](https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/valid-describe-callback.md)         | Enforce valid `describe()` callback                                | ✅  |     |     |\n| [valid-expect-in-promise](https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/valid-expect-in-promise.md)         | Require promises that have expectations in their chain to be valid | ✅  |     |     |\n| [valid-expect](https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/valid-expect.md)                               | Enforce valid `expect()` usage                                     | ✅  |     |     |\n| [valid-title](https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/valid-title.md)                                 | Enforce valid titles                                               | ✅  | 🔧  |     |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplaywright-community%2Feslint-plugin-playwright","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fplaywright-community%2Feslint-plugin-playwright","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplaywright-community%2Feslint-plugin-playwright/lists"}