@@ -28,14 +28,11 @@ pnpm add -D eslint-plugin-playwright
28
28
29
29
## Usage
30
30
31
- This plugin bundles two configurations to work with both ` @playwright/test ` or
32
- ` jest-playwright ` . The recommended setup is to use the ` files ` field to target
33
- only Playwright test files. In the examples below, this is done by targeting
34
- files in the ` tests ` directory and only applying the Playwright rules to those
35
- files. In your project, you may need to change the ` files ` field to match your
36
- Playwright test file patterns.
37
-
38
- ### With [ Playwright test runner] ( https://playwright.dev/docs/writing-tests )
31
+ The recommended setup is to use the ` files ` field to target only Playwright test
32
+ files. In the examples below, this is done by targeting files in the ` tests `
33
+ directory and only applying the Playwright rules to those files. In your
34
+ project, you may need to change the ` files ` field to match your Playwright test
35
+ file patterns.
39
36
40
37
[ Flat config] ( https://eslint.org/docs/latest/use/configure/configuration-files-new )
41
38
(** eslint.config.js** )
@@ -47,10 +44,8 @@ export default [
47
44
{
48
45
... playwright .configs [' flat/recommended' ],
49
46
files: [' tests/**' ],
50
- },
51
- {
52
- files: [' tests/**' ],
53
47
rules: {
48
+ ... playwright .configs [' flat/recommended' ].rules ,
54
49
// Customize Playwright rules
55
50
// ...
56
51
},
@@ -72,45 +67,6 @@ export default [
72
67
}
73
68
```
74
69
75
- ### With [ Jest Playwright] ( https://github.com/playwright-community/jest-playwright )
76
-
77
- [ Flat config] ( https://eslint.org/docs/latest/use/configure/configuration-files-new )
78
- (** eslint.config.js** )
79
-
80
- ``` javascript
81
- import playwright from ' eslint-plugin-playwright'
82
- import jest from ' eslint-plugin-jest'
83
-
84
- export default [
85
- {
86
- ... playwright .configs [' flat/jest-playwright' ],
87
- files: [' tests/**' ],
88
- },
89
- {
90
- files: [' tests/**' ],
91
- plugins: { jest },
92
- rules: {
93
- // Customize Playwright rules
94
- // ...
95
- },
96
- },
97
- ]
98
- ```
99
-
100
- [ Legacy config] ( https://eslint.org/docs/latest/use/configure/configuration-files )
101
- (** .eslintrc** )
102
-
103
- ``` json
104
- {
105
- "overrides" : [
106
- {
107
- "files" : " tests/**" ,
108
- "extends" : " plugin:playwright/jest-playwright"
109
- }
110
- ]
111
- }
112
- ```
113
-
114
70
## Settings
115
71
116
72
### Aliased Playwright Globals
0 commit comments