Skip to content

Commit

Permalink
feat(eslint): add playwright config
Browse files Browse the repository at this point in the history
Resolves #22
  • Loading branch information
mrmckeb committed Sep 21, 2022
1 parent 4f8c60f commit 0180600
Show file tree
Hide file tree
Showing 7 changed files with 82 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -44,6 +44,7 @@ The following optional configs are available:

- `@vercel/style-guide/eslint/jest`
- `@vercel/style-guide/eslint/next` (requires `@vercel/style-guide/eslint/react`)
- `@vercel/style-guide/eslint/playwright-test`
- `@vercel/style-guide/eslint/react`
- `@vercel/style-guide/eslint/typescript` (requires [additional configuration](#configuring-eslint-for-typescript))

Expand Down
1 change: 1 addition & 0 deletions eslint/jest.js
Expand Up @@ -7,6 +7,7 @@ module.exports = {
'plugin:testing-library/react',
],
rules: {
// Prefer the Jest version of this rule.
'@typescript-eslint/unbound-method': 'off',
'jest/unbound-method': 'error',
},
Expand Down
6 changes: 6 additions & 0 deletions eslint/playwright-test.js
@@ -0,0 +1,6 @@
module.exports = {
extends: [
'plugin:playwright/playwright-test',
require.resolve('./rules/playwright-test.js'),
],
};
22 changes: 22 additions & 0 deletions eslint/rules/playwright-test.js
@@ -0,0 +1,22 @@
module.exports = {
rules: {
/**
* Require lowercase test names.
*
* 🔧 Fixable - https://github.com/playwright-community/eslint-plugin-playwright/blob/main/docs/rules/prefer-lowercase-title.md
*/
'prefer-lowercase-title': 'warn',
/**
* Require using `toHaveLength` over explicitly checking lengths.
*
* 🔧 Fixable - https://github.com/playwright-community/eslint-plugin-playwright/blob/main/docs/rules/prefer-lowercase-title.md
*/
'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
*/
'require-top-level-describe': 'error',
},
};
1 change: 0 additions & 1 deletion eslint/rules/react.js
Expand Up @@ -19,7 +19,6 @@ module.exports = {
* 🚫 Not fixable - https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/button-has-type.md
*/
'react/button-has-type': 'warn',

/**
* Require consistent function type for function components.
*
Expand Down
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -37,6 +37,7 @@
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jest": "^27.0.4",
"eslint-plugin-jsx-a11y": "^6.6.1",
"eslint-plugin-playwright": "^0.11.1",
"eslint-plugin-react": "^7.31.8",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-testing-library": "^5.6.4",
Expand Down
52 changes: 51 additions & 1 deletion pnpm-lock.yaml

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

0 comments on commit 0180600

Please sign in to comment.