Skip to content

Commit

Permalink
feat(eslint): update eslint-plugin-playwright (#98)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrmckeb committed Mar 5, 2024
1 parent dc392a1 commit 4b89216
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 21 deletions.
9 changes: 5 additions & 4 deletions eslint/playwright-test.js
@@ -1,6 +1,7 @@
module.exports = {
extends: [
'plugin:playwright/playwright-test',
require.resolve('./rules/playwright-test.js'),
],
plugins: ['playwright'],
extends: [require.resolve('./rules/playwright-test.js')],
env: {
'shared-node-browser': true,
},
};
15 changes: 8 additions & 7 deletions eslint/rules/playwright-test.js
@@ -1,9 +1,10 @@
// Source: https://github.com/playwright-community/eslint-plugin-playwright/blob/main/src/index.ts
// Source: https://github.com/playwright-community/eslint-plugin-playwright/blob/v1.5.1/src/index.ts#L101-L129
const recommended = {
'no-empty-pattern': 'off',
'playwright/expect-expect': 'warn',
'playwright/max-nested-describe': 'warn',
'playwright/missing-playwright-await': 'error',
'playwright/no-conditional-expect': 'warn',
'playwright/no-conditional-in-test': 'warn',
'playwright/no-element-handle': 'warn',
'playwright/no-eval': 'warn',
Expand All @@ -13,11 +14,17 @@ const recommended = {
'playwright/no-networkidle': 'error',
'playwright/no-page-pause': 'warn',
'playwright/no-skipped-test': 'warn',
'playwright/no-standalone-expect': 'error',
'playwright/no-unsafe-references': 'error',
'playwright/no-useless-await': 'warn',
'playwright/no-useless-not': 'warn',
'playwright/no-wait-for-selector': 'warn',
'playwright/no-wait-for-timeout': 'warn',
'playwright/prefer-web-first-assertions': 'error',
'playwright/valid-describe-callback': 'error',
'playwright/valid-expect': 'error',
'playwright/valid-expect-in-promise': 'error',
'playwright/valid-title': 'error',
};

module.exports = {
Expand All @@ -35,11 +42,5 @@ module.exports = {
* 🔧 Fixable - https://github.com/playwright-community/eslint-plugin-playwright/blob/main/docs/rules/prefer-lowercase-title.md
*/
'playwright/prefer-to-have-length': 'warn',
/**
* Require test cases and hooks to be inside a `test.describe` block.
*
* 🚫 Not fixable - https://github.com/playwright-community/eslint-plugin-playwright/blob/main/docs/rules/prefer-lowercase-title.md
*/
'playwright/require-top-level-describe': 'error',
},
};
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -49,7 +49,7 @@
"eslint-plugin-import": "^2.28.1",
"eslint-plugin-jest": "^27.2.3",
"eslint-plugin-jsx-a11y": "^6.7.1",
"eslint-plugin-playwright": "^0.16.0",
"eslint-plugin-playwright": "^1.5.1",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-testing-library": "^6.0.1",
Expand Down
27 changes: 18 additions & 9 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 4b89216

Please sign in to comment.