Skip to content

igorTT/eslint-plugin-playwright

 
 

Repository files navigation

ESLint Plugin Playwright

Test NPM

ESLint plugin for your Playwright testing needs.

Installation

Yarn

yarn add -D eslint-plugin-playwright

NPM

npm install -D eslint-plugin-playwright

Usage

This plugin bundles two configurations to work with both @playwright/test or jest-playwright.

{
  "extends": ["plugin:playwright/playwright-test"]
}
{
  "extends": ["plugin:playwright/jest-playwright"]
}

List of Supported Rules

βœ”: Enabled in the recommended configuration.
πŸ”§: Some problems reported by this rule are automatically fixable by the --fix command line option.
πŸ’‘: Some problems reported by this rule are manually fixable by editor suggestions.

βœ” πŸ”§ πŸ’‘ Rule Description
βœ” max-nested-describe Enforces a maximum depth to nested describe calls
βœ” πŸ”§ missing-playwright-await Enforce Playwright APIs to be awaited
βœ” no-conditional-in-test Disallow conditional logic in tests
βœ” πŸ’‘ no-element-handle Disallow usage of element handles
βœ” no-eval Disallow usage of page.$eval and page.$$eval
βœ” πŸ’‘ no-focused-test Disallow usage of .only annotation
βœ” no-force-option Disallow usage of the { force: true } option
βœ” no-page-pause Disallow using page.pause
no-restricted-matchers Disallow specific matchers & modifiers
βœ” πŸ’‘ no-skipped-test Disallow usage of the .skip annotation
βœ” πŸ”§ no-useless-not Disallow usage of not matchers when a specific matcher exists
βœ” πŸ’‘ no-wait-for-timeout Disallow usage of page.waitForTimeout
πŸ’‘ prefer-strict-equal Suggest using toStrictEqual()
πŸ”§ prefer-lowercase-title Enforce lowercase test names
πŸ”§ prefer-to-be Suggest using toBe()
πŸ”§ prefer-to-have-length Suggest using toHaveLength()
require-top-level-describe Require test cases and hooks to be inside a test.describe block
πŸ”§ require-soft-assertions Require assertions to use expect.soft()
βœ” valid-expect Enforce valid expect() usage

About

ESLint plugin for your Playwright testing needs.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 99.8%
  • JavaScript 0.2%