Skip to content

Commit

Permalink
Add more Playwright rules (#31)
Browse files Browse the repository at this point in the history
* Add more Playwright rules

* Changeset
  • Loading branch information
Mark Skelton authored Jan 18, 2023
1 parent 3278147 commit b3d51d5
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/tasty-donkeys-agree.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'eslint-config-widen': minor
---

Add more Playwright rules
2 changes: 1 addition & 1 deletion packages/eslint-config-widen/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"eslint": ">= 8",
"eslint-plugin-jest": ">= 25",
"eslint-plugin-jsx-a11y": ">= 6",
"eslint-plugin-playwright": ">=0.11.1",
"eslint-plugin-playwright": ">=0.12.0",
"eslint-plugin-react": ">= 7",
"eslint-plugin-react-hooks": ">= 4",
"eslint-plugin-sort": ">= 2",
Expand Down
18 changes: 18 additions & 0 deletions packages/eslint-config-widen/src/playwright.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,28 @@ export = {
extends: ['plugin:playwright/playwright-test'],
plugins: ['playwright'],
rules: {
'playwright/missing-playwright-await': [
'error',
{ customMatchers: ['toBeAccessible', 'toPassAxe'] },
],
'playwright/no-restricted-matchers': [
'warn',
{
toEqualValue: 'Use `toHaveValue` instead.',
toHaveSelector: 'Use `toBeVisible` instead.',
toHaveSelectorCount: 'Use `toHaveCount` instead.',
toMatchAttribute: 'Use `toHaveAttribute` instead.',
toMatchText: 'Use `toHaveText` instead.',
toMatchURL: 'Use `toHaveURL` instead.',
toMatchValue: 'Use `toHaveValue` instead.',
},
],
'playwright/prefer-lowercase-title': [
'warn',
{ ignoreTopLevelDescribe: true },
],
'playwright/prefer-strict-equal': 'warn',
'playwright/prefer-to-be': 'warn',
'playwright/prefer-to-have-length': 'warn',
'playwright/require-top-level-describe': 'warn',
},
Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3852,7 +3852,7 @@ __metadata:
eslint: ">= 8"
eslint-plugin-jest: ">= 25"
eslint-plugin-jsx-a11y: ">= 6"
eslint-plugin-playwright: ">=0.11.1"
eslint-plugin-playwright: ">=0.12.0"
eslint-plugin-react: ">= 7"
eslint-plugin-react-hooks: ">= 4"
eslint-plugin-sort: ">= 2"
Expand Down

0 comments on commit b3d51d5

Please sign in to comment.