Skip to content

Commit d0b43bd

Browse files
committed
Add recommended config
1 parent d0a79eb commit d0b43bd

File tree

3 files changed

+38
-30
lines changed

3 files changed

+38
-30
lines changed

README.md

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,40 @@
11
# ESLint Plugin Playwright
22

33
[![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)
4-
[![NPM](https://img.shields.io/npm/v/eslint-plugin-playwright)](https://www.npmjs.com/package/eslint-plugin-playwright)
4+
[![npm](https://img.shields.io/npm/v/eslint-plugin-playwright)](https://www.npmjs.com/package/eslint-plugin-playwright)
55

6-
> ESLint plugin for your [Playwright](https://github.com/microsoft/playwright)
7-
> testing needs.
6+
ESLint plugin for [Playwright](https://github.com/microsoft/playwright).
87

98
## Installation
109

10+
npm
11+
12+
```bash
13+
npm install -D eslint-plugin-playwright
14+
```
15+
1116
Yarn
1217

1318
```bash
1419
yarn add -D eslint-plugin-playwright
1520
```
1621

17-
NPM
22+
pnpm
1823

1924
```bash
20-
npm install -D eslint-plugin-playwright
25+
pnpm add -D eslint-plugin-playwright
2126
```
2227

2328
## Usage
2429

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

28-
### With [Playwright test runner](https://playwright.dev/docs/test-intro)
33+
### With [Playwright test runner](https://playwright.dev/docs/writing-tests)
2934

3035
```json
3136
{
32-
"extends": ["plugin:playwright/playwright-test"]
37+
"extends": ["plugin:playwright/recommended"]
3338
}
3439
```
3540

examples/.eslintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"extends": ["plugin:playwright/playwright-test"],
2+
"extends": ["plugin:playwright/recommended"],
33
"parserOptions": {
44
"sourceType": "module",
55
"ecmaVersion": 2022

src/index.ts

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -19,30 +19,33 @@ import requireTopLevelDescribe from './rules/require-top-level-describe';
1919
import validExpect from './rules/valid-expect';
2020
import preferWebFirstAssertions from './rules/prefer-web-first-assertions';
2121

22+
const recommended = {
23+
plugins: ['playwright'],
24+
env: {
25+
'shared-node-browser': true,
26+
},
27+
rules: {
28+
'no-empty-pattern': 'off',
29+
'playwright/missing-playwright-await': 'error',
30+
'playwright/no-page-pause': 'warn',
31+
'playwright/no-element-handle': 'warn',
32+
'playwright/no-eval': 'warn',
33+
'playwright/no-focused-test': 'error',
34+
'playwright/no-skipped-test': 'warn',
35+
'playwright/no-wait-for-timeout': 'warn',
36+
'playwright/no-force-option': 'warn',
37+
'playwright/max-nested-describe': 'warn',
38+
'playwright/no-conditional-in-test': 'warn',
39+
'playwright/no-useless-not': 'warn',
40+
'playwright/prefer-web-first-assertions': 'error',
41+
'playwright/valid-expect': 'error',
42+
},
43+
};
44+
2245
export = {
2346
configs: {
24-
'playwright-test': {
25-
plugins: ['playwright'],
26-
env: {
27-
'shared-node-browser': true,
28-
},
29-
rules: {
30-
'no-empty-pattern': 'off',
31-
'playwright/missing-playwright-await': 'error',
32-
'playwright/no-page-pause': 'warn',
33-
'playwright/no-element-handle': 'warn',
34-
'playwright/no-eval': 'warn',
35-
'playwright/no-focused-test': 'error',
36-
'playwright/no-skipped-test': 'warn',
37-
'playwright/no-wait-for-timeout': 'warn',
38-
'playwright/no-force-option': 'warn',
39-
'playwright/max-nested-describe': 'warn',
40-
'playwright/no-conditional-in-test': 'warn',
41-
'playwright/no-useless-not': 'warn',
42-
'playwright/prefer-web-first-assertions': 'error',
43-
'playwright/valid-expect': 'error',
44-
},
45-
},
47+
recommended,
48+
'playwright-test': recommended,
4649
'jest-playwright': {
4750
plugins: ['jest', 'playwright'],
4851
env: {

0 commit comments

Comments
 (0)