eslint-plugin-cypress 3.6.0 → 4.0.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/FLAT-CONFIG.md +6 -8
- package/README.md +4 -8
- package/circle.yml +0 -23
- package/lib/flat.js +0 -7
- package/package.json +4 -6
package/FLAT-CONFIG.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
This document supplements the [README](README.md) document and describes how to use the Cypress ESLint Plugin (`eslint-plugin-cypress`) in an ESLint flat config environment.
|
|
4
4
|
|
|
5
|
-
Usage with ESLint `
|
|
5
|
+
Usage with ESLint `9.x` is described.
|
|
6
6
|
|
|
7
7
|
## Introduction
|
|
8
8
|
|
|
@@ -10,13 +10,11 @@ Usage with ESLint `8.57.0` and ESLint `9.x` is described.
|
|
|
10
10
|
|
|
11
11
|
Previously, ESLint had announced in their blog post [Flat config rollout plans](https://eslint.org/blog/2023/10/flat-config-rollout-plans/) in October 2023 that flat config was planned to be the default in ESLint `v9.0.0` and that the eslintrc configuration system is planned to be removed in the future ESLint `v10.0.0`.
|
|
12
12
|
|
|
13
|
-
Cypress ESLint Plugin (`eslint-plugin-cypress`) in release [3.2.0](https://github.com/cypress-io/eslint-plugin-cypress/releases/tag/v3.2.0) offered the first support of ESLint `9.x` flat config files using the [Backwards compatibility utility](https://eslint.org/blog/2022/08/new-config-system-part-2/#backwards-compatibility-utility). Current releases have removed the dependency on this utility and the examples in this document have been updated correspondingly.
|
|
14
|
-
|
|
15
13
|
The following information details installation and usage examples for `eslint-plugin-cypress` together with related plugins in an ESLint flat config environment.
|
|
16
14
|
|
|
17
15
|
## Installation
|
|
18
16
|
|
|
19
|
-
|
|
17
|
+
Use a minimum ESLint `9.x`.
|
|
20
18
|
|
|
21
19
|
```shell
|
|
22
20
|
npm install eslint eslint-plugin-cypress --save-dev
|
|
@@ -38,10 +36,10 @@ import pluginCypress from 'eslint-plugin-cypress/flat'
|
|
|
38
36
|
|
|
39
37
|
There are two specific flat configurations available:
|
|
40
38
|
|
|
41
|
-
| Configuration | Content
|
|
42
|
-
| --------------------- |
|
|
43
|
-
| `configs.globals` | defines globals `cy`, `Cypress`, `expect`, `assert` and `chai` used in Cypress test specs as well as `globals.browser` and `globals.mocha` from [globals](https://www.npmjs.com/package/globals).
|
|
44
|
-
| `configs.recommended` | enables [recommended Rules](README.md#rules). It includes also `configs.global` (see above)
|
|
39
|
+
| Configuration | Content |
|
|
40
|
+
| --------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
41
|
+
| `configs.globals` | defines globals `cy`, `Cypress`, `expect`, `assert` and `chai` used in Cypress test specs as well as `globals.browser` and `globals.mocha` from [globals](https://www.npmjs.com/package/globals). This version no longer specifies `languageOptions` for `ecmaVersion` and `sourceType` - see ESLint [JavaScript languageOptions](https://eslint.org/docs/latest/use/configure/language-options#specifying-javascript-options). There are no default rules enabled in this configuration. |
|
|
42
|
+
| `configs.recommended` | enables [recommended Rules](README.md#rules). It includes also `configs.global` (see above) |
|
|
45
43
|
|
|
46
44
|
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.
|
|
47
45
|
|
package/README.md
CHANGED
|
@@ -6,8 +6,8 @@ Note: If you installed ESLint globally then you must also install `eslint-plugin
|
|
|
6
6
|
|
|
7
7
|
## Installation
|
|
8
8
|
|
|
9
|
-
Prerequisites: [ESLint](https://www.npmjs.com/package/eslint) `
|
|
10
|
-
This plugin supports the use of [Flat config files](https://eslint.org/docs/latest/use/configure/configuration-files) with ESLint `
|
|
9
|
+
Prerequisites: [ESLint](https://www.npmjs.com/package/eslint) `v9`. Lower versions are no longer supported.
|
|
10
|
+
This plugin supports the use of [Flat config files](https://eslint.org/docs/latest/use/configure/configuration-files) with ESLint `9.0.0` and above.
|
|
11
11
|
|
|
12
12
|
```sh
|
|
13
13
|
npm install eslint-plugin-cypress --save-dev
|
|
@@ -17,15 +17,11 @@ or
|
|
|
17
17
|
yarn add eslint-plugin-cypress --dev
|
|
18
18
|
```
|
|
19
19
|
|
|
20
|
-
## Deprecations
|
|
21
|
-
|
|
22
|
-
The use of ESLint `v7` and `v8` with `eslint-plugin-cypress` is deprecated and support will be removed in a future version of this plugin. ESLint `v7` reached end-of-life on Apr 9, 2022 and ESLint `v8` reached end-of-life on Oct 5, 2024. Users are encouraged to migrate to ESLint `v9`. See [ESLint Version Support](https://eslint.org/version-support/) for ESLint's current release lines.
|
|
23
|
-
|
|
24
20
|
## Usage
|
|
25
21
|
|
|
26
|
-
|
|
22
|
+
ESLint `v9` uses a [Flat config file](https://eslint.org/docs/latest/use/configure/configuration-files) format with filename `eslint.config.*js` by default. Please refer to [Flat config installation and configuration details](FLAT-CONFIG.md).
|
|
27
23
|
|
|
28
|
-
ESLint `v9`
|
|
24
|
+
You can continue to use a deprecated configuration `.eslintrc.json` with ESLint `v9` if you set the `ESLINT_USE_FLAT_CONFIG` environment variable to `false` (see [ESLint v9 > Configuration Files (Deprecated)](https://eslint.org/docs/latest/use/configure/configuration-files-deprecated)).
|
|
29
25
|
|
|
30
26
|
```json
|
|
31
27
|
{
|
package/circle.yml
CHANGED
|
@@ -5,13 +5,11 @@ workflows:
|
|
|
5
5
|
main:
|
|
6
6
|
jobs:
|
|
7
7
|
- lint
|
|
8
|
-
- test-v7
|
|
9
8
|
- test-v8
|
|
10
9
|
- test-v9
|
|
11
10
|
- release:
|
|
12
11
|
requires:
|
|
13
12
|
- lint
|
|
14
|
-
- test-v7
|
|
15
13
|
- test-v8
|
|
16
14
|
- test-v9
|
|
17
15
|
filters:
|
|
@@ -35,27 +33,6 @@ jobs:
|
|
|
35
33
|
name: Lint code
|
|
36
34
|
command: npm run lint
|
|
37
35
|
|
|
38
|
-
test-v7:
|
|
39
|
-
docker:
|
|
40
|
-
- image: cimg/node:20.12.2
|
|
41
|
-
steps:
|
|
42
|
-
- checkout
|
|
43
|
-
- run:
|
|
44
|
-
name: Install dependencies
|
|
45
|
-
command: npm ci
|
|
46
|
-
- run:
|
|
47
|
-
name: Remove unneeded plugins # minimum eslint@8.23.0 required
|
|
48
|
-
command: npm uninstall eslint-plugin-eslint-plugin eslint-plugin-n
|
|
49
|
-
- run:
|
|
50
|
-
name: Install ESLint 7
|
|
51
|
-
command: npm install eslint@7
|
|
52
|
-
- run:
|
|
53
|
-
name: Show ESLint version
|
|
54
|
-
command: npx eslint --version
|
|
55
|
-
- run:
|
|
56
|
-
name: Test ESLint 7
|
|
57
|
-
command: npm run test:legacy
|
|
58
|
-
|
|
59
36
|
test-v8:
|
|
60
37
|
docker:
|
|
61
38
|
- image: cimg/node:20.12.2
|
package/lib/flat.js
CHANGED
|
@@ -27,11 +27,6 @@ const commonGlobals =
|
|
|
27
27
|
chai: false,
|
|
28
28
|
}, globals.browser, globals.mocha)
|
|
29
29
|
|
|
30
|
-
const commonLanguageOptions = {
|
|
31
|
-
ecmaVersion: 2019,
|
|
32
|
-
sourceType: 'module'
|
|
33
|
-
}
|
|
34
|
-
|
|
35
30
|
Object.assign(plugin.configs, {
|
|
36
31
|
globals: {
|
|
37
32
|
name: 'cypress/globals',
|
|
@@ -41,7 +36,6 @@ Object.assign(plugin.configs, {
|
|
|
41
36
|
languageOptions: {
|
|
42
37
|
globals:
|
|
43
38
|
commonGlobals,
|
|
44
|
-
...commonLanguageOptions
|
|
45
39
|
}
|
|
46
40
|
}
|
|
47
41
|
})
|
|
@@ -61,7 +55,6 @@ Object.assign(plugin.configs, {
|
|
|
61
55
|
languageOptions: {
|
|
62
56
|
globals:
|
|
63
57
|
commonGlobals,
|
|
64
|
-
...commonLanguageOptions
|
|
65
58
|
}
|
|
66
59
|
}
|
|
67
60
|
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-cypress",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"description": "An ESLint plugin for projects using Cypress",
|
|
5
5
|
"main": "legacy.js",
|
|
6
6
|
"exports": {
|
|
@@ -23,18 +23,16 @@
|
|
|
23
23
|
},
|
|
24
24
|
"homepage": "https://github.com/cypress-io/eslint-plugin-cypress#readme",
|
|
25
25
|
"peerDependencies": {
|
|
26
|
-
"eslint": ">=
|
|
26
|
+
"eslint": ">=9"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"globals": "^
|
|
29
|
+
"globals": "^15.11.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@eslint/eslintrc": "^3.1.0",
|
|
33
|
-
"@eslint/js": "^9.11.1",
|
|
34
32
|
"eslint": "^9.12.0",
|
|
35
33
|
"eslint-plugin-eslint-plugin": "^6.2.0",
|
|
36
34
|
"eslint-plugin-mocha": "^10.5.0",
|
|
37
|
-
"eslint-plugin-n": "^17.
|
|
35
|
+
"eslint-plugin-n": "^17.11.1",
|
|
38
36
|
"husky": "^9.1.6",
|
|
39
37
|
"jest": "^29.7.0",
|
|
40
38
|
"semantic-release": "24.1.2"
|