eslint-plugin-cypress 5.1.1 → 5.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +37 -14
- package/lib/flat.d.ts +12 -0
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -75,6 +75,8 @@ These rules enforce some of the [best practices recommended for using Cypress](h
|
|
|
75
75
|
|
|
76
76
|
In the following sections, different examples of possible configuration file contents are given, together with some brief explanations. Adapt these examples according to your needs.
|
|
77
77
|
|
|
78
|
+
The examples use the `defineConfig()` helper, introduced with ESLint [9.22.0](https://eslint.org/blog/2025/03/eslint-v9.22.0-released/). Refer to the blog article [Evolving flat config with extends](https://eslint.org/blog/2025/03/flat-config-extends-define-config-global-ignores/) for background information. If you are using ESLint `<9.22.0`, import `defineConfig` from [@eslint/config-helpers](https://www.npmjs.com/package/@eslint/config-helpers) instead of from `eslint/config`.
|
|
79
|
+
|
|
78
80
|
### Cypress
|
|
79
81
|
|
|
80
82
|
All rules are available by importing from `eslint-plugin-cypress` and can be individually activated.
|
|
@@ -82,8 +84,9 @@ All rules are available by importing from `eslint-plugin-cypress` and can be ind
|
|
|
82
84
|
- [cypress/unsafe-to-chain-command](https://github.com/cypress-io/eslint-plugin-cypress/blob/master/docs/rules/unsafe-to-chain-command.md) is activated and set to `error`
|
|
83
85
|
|
|
84
86
|
```js
|
|
87
|
+
import { defineConfig } from 'eslint/config'
|
|
85
88
|
import pluginCypress from 'eslint-plugin-cypress'
|
|
86
|
-
export default [
|
|
89
|
+
export default defineConfig([
|
|
87
90
|
{
|
|
88
91
|
plugins: {
|
|
89
92
|
cypress: pluginCypress,
|
|
@@ -92,7 +95,7 @@ export default [
|
|
|
92
95
|
'cypress/unsafe-to-chain-command': 'error',
|
|
93
96
|
},
|
|
94
97
|
},
|
|
95
|
-
]
|
|
98
|
+
])
|
|
96
99
|
```
|
|
97
100
|
|
|
98
101
|
### Cypress recommended
|
|
@@ -102,15 +105,19 @@ The `eslint-plugin-cypress` [recommended rules](#rules) `configs.recommended` ar
|
|
|
102
105
|
- [cypress/no-unnecessary-waiting](https://github.com/cypress-io/eslint-plugin-cypress/blob/master/docs/rules/no-unnecessary-waiting.md) which is set to `off`
|
|
103
106
|
|
|
104
107
|
```js
|
|
108
|
+
import { defineConfig } from 'eslint/config'
|
|
105
109
|
import pluginCypress from 'eslint-plugin-cypress'
|
|
106
|
-
export default [
|
|
107
|
-
pluginCypress.configs.recommended,
|
|
110
|
+
export default defineConfig([
|
|
108
111
|
{
|
|
112
|
+
files: ['cypress/**/*.js'],
|
|
113
|
+
extends: [
|
|
114
|
+
pluginCypress.configs.recommended,
|
|
115
|
+
],
|
|
109
116
|
rules: {
|
|
110
117
|
'cypress/no-unnecessary-waiting': 'off',
|
|
111
118
|
},
|
|
112
119
|
},
|
|
113
|
-
]
|
|
120
|
+
])
|
|
114
121
|
```
|
|
115
122
|
|
|
116
123
|
### Cypress globals
|
|
@@ -118,8 +125,16 @@ export default [
|
|
|
118
125
|
The `configs.globals` are activated.
|
|
119
126
|
|
|
120
127
|
```js
|
|
128
|
+
import { defineConfig } from 'eslint/config'
|
|
121
129
|
import pluginCypress from 'eslint-plugin-cypress'
|
|
122
|
-
export default [
|
|
130
|
+
export default defineConfig([
|
|
131
|
+
{
|
|
132
|
+
files: ['cypress/**/*.js'],
|
|
133
|
+
extends: [
|
|
134
|
+
pluginCypress.configs.globals,
|
|
135
|
+
],
|
|
136
|
+
},
|
|
137
|
+
])
|
|
123
138
|
```
|
|
124
139
|
|
|
125
140
|
## Disable rules
|
|
@@ -187,12 +202,16 @@ npm install eslint-plugin-mocha@^11 --save-dev
|
|
|
187
202
|
```
|
|
188
203
|
|
|
189
204
|
```js
|
|
205
|
+
import { defineConfig } from 'eslint/config'
|
|
190
206
|
import pluginMocha from 'eslint-plugin-mocha'
|
|
191
207
|
import pluginCypress from 'eslint-plugin-cypress'
|
|
192
|
-
export default [
|
|
193
|
-
pluginMocha.configs.recommended,
|
|
194
|
-
pluginCypress.configs.recommended,
|
|
208
|
+
export default defineConfig([
|
|
195
209
|
{
|
|
210
|
+
files: ['cypress/**/*.js'],
|
|
211
|
+
extends: [
|
|
212
|
+
pluginMocha.configs.recommended,
|
|
213
|
+
pluginCypress.configs.recommended,
|
|
214
|
+
],
|
|
196
215
|
rules: {
|
|
197
216
|
'mocha/no-exclusive-tests': 'error',
|
|
198
217
|
'mocha/no-pending-tests': 'error',
|
|
@@ -200,7 +219,7 @@ export default [
|
|
|
200
219
|
'cypress/no-unnecessary-waiting': 'off',
|
|
201
220
|
},
|
|
202
221
|
},
|
|
203
|
-
]
|
|
222
|
+
])
|
|
204
223
|
```
|
|
205
224
|
|
|
206
225
|
### Cypress and Chai recommended
|
|
@@ -216,17 +235,21 @@ npm install eslint-plugin-chai-friendly@^1.0.1 --save-dev
|
|
|
216
235
|
```
|
|
217
236
|
|
|
218
237
|
```js
|
|
238
|
+
import { defineConfig } from 'eslint/config'
|
|
219
239
|
import pluginCypress from 'eslint-plugin-cypress'
|
|
220
240
|
import pluginChaiFriendly from 'eslint-plugin-chai-friendly'
|
|
221
|
-
export default [
|
|
222
|
-
pluginCypress.configs.recommended,
|
|
223
|
-
pluginChaiFriendly.configs.recommendedFlat,
|
|
241
|
+
export default defineConfig([
|
|
224
242
|
{
|
|
243
|
+
files: ['cypress/**/*.js'],
|
|
244
|
+
extends: [
|
|
245
|
+
pluginCypress.configs.recommended,
|
|
246
|
+
pluginChaiFriendly.configs.recommendedFlat,
|
|
247
|
+
],
|
|
225
248
|
rules: {
|
|
226
249
|
'cypress/no-unnecessary-waiting': 'off',
|
|
227
250
|
},
|
|
228
251
|
},
|
|
229
|
-
]
|
|
252
|
+
])
|
|
230
253
|
```
|
|
231
254
|
|
|
232
255
|
## Contributing
|
package/lib/flat.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ESLint, Linter } from 'eslint'
|
|
2
|
+
|
|
3
|
+
declare const plugin: {
|
|
4
|
+
meta: { name: string, version: string }
|
|
5
|
+
configs: {
|
|
6
|
+
globals: Linter.Config<Linter.RulesRecord>
|
|
7
|
+
recommended: Linter.Config<Linter.RulesRecord>
|
|
8
|
+
}
|
|
9
|
+
rules: NonNullable<ESLint.Plugin['rules']>
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export = plugin
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-cypress",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.2.0",
|
|
4
4
|
"description": "An ESLint plugin for projects using Cypress",
|
|
5
5
|
"main": "./lib/flat.js",
|
|
6
6
|
"exports": {
|
|
@@ -34,14 +34,14 @@
|
|
|
34
34
|
"globals": "^16.2.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@stylistic/eslint-plugin": "^
|
|
38
|
-
"eslint": "^9.
|
|
39
|
-
"eslint-plugin-eslint-plugin": "^
|
|
37
|
+
"@stylistic/eslint-plugin": "^5.3.1",
|
|
38
|
+
"eslint": "^9.35.0",
|
|
39
|
+
"eslint-plugin-eslint-plugin": "^7.0.0",
|
|
40
40
|
"eslint-plugin-mocha": "^11.1.0",
|
|
41
41
|
"husky": "^9.1.7",
|
|
42
|
-
"prettier": "^3.
|
|
43
|
-
"semantic-release": "24.2.
|
|
44
|
-
"vitest": "^3.
|
|
42
|
+
"prettier": "^3.6.2",
|
|
43
|
+
"semantic-release": "24.2.7",
|
|
44
|
+
"vitest": "^3.2.4"
|
|
45
45
|
},
|
|
46
46
|
"scripts": {
|
|
47
47
|
"lint": "eslint",
|