Skip to content

Commit 1f1d286

Browse files
authored
feat: complete ESLint v10 migration (#298)
BREAKING: Remove deprecated eslint-plugin-cypress/flat configuration Use eslint-plugin-cypress instead Update globals to 17.3.0 Other changes: Add package type commonjs Documentation updates related to flat configuration Update Node.js to 24.13.1
1 parent 3964149 commit 1f1d286

File tree

12 files changed

+27
-41
lines changed

12 files changed

+27
-41
lines changed

.node-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
24.13.0
1+
24.13.1

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
24.13.0
1+
24.13.1

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ To add a new rule:
3535
- Run `npm run format`
3636
- Run `npm test` to run [Vitest](https://vitest.dev/)
3737
- Make sure all tests are passing
38-
- Add the rule to [flat.js](https://github.com/cypress-io/eslint-plugin-cypress/blob/master/lib/flat.js)
38+
- Add the rule to [index.js](./lib/index.js)
3939
- Create a git commit with a commit message similar to: `feat: add rule <description>` (see [commit message conventions](https://github.com/semantic-release/semantic-release#commit-message-format))
4040
- Create a PR from your branch
4141

ESLINTRC-CONFIG.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# Cypress ESLint Plugin - Legacy Config
22

3-
This document previously described how to use the Cypress ESLint Plugin (`eslint-plugin-cypress`) with an [ESLint legacy config environment](https://eslint.org/docs/latest/use/configure/configuration-files-deprecated).
3+
This document previously described how to use the Cypress ESLint Plugin (`eslint-plugin-cypress`) with an [ESLint legacy config environment](https://eslint.org/docs/v9.x/use/configure/configuration-files-deprecated).
44

5-
This form of configuration was deprecated with the release of ESLint `v9` and its use with `eslint-plugin-cypress` is no longer supported.
5+
This form of configuration was deprecated with the release of ESLint `v9`, then removed with ESLint `v10`.
6+
Its use with `eslint-plugin-cypress` is no longer supported.
67

78
Users who were previously using a deprecated configuration environment should migrate to a [flat configuration](https://eslint.org/docs/latest/use/configure/configuration-files).

README.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,20 @@ yarn add eslint eslint-plugin-cypress --dev
2020

2121
## Usage
2222

23-
ESLint `v9` and `v10` use a [Flat config file](https://eslint.org/docs/latest/use/configure/configuration-files) format with filename `eslint.config.*js` by default. This plugin no longer supports the use of a deprecated [eslintrc-type](https://eslint.org/docs/latest/use/configure/configuration-files-deprecated) config file from previous ESLint versions.
23+
ESLint as of `v10` and this plugin no longer support the use of the deprecated [eslintrc-type](https://eslint.org/docs/v9.x/use/configure/configuration-files-deprecated) config file format.
24+
You must use a [Flat config file](https://eslint.org/docs/latest/use/configure/configuration-files) format.
25+
This is the default in ESLint `v9`, and in ESLint `v10` it is the only config format available.
2426

2527
To set up a configuration, add a file `eslint.config.mjs` to the root directory of your Cypress project and include the following instructions to import the available configurations using:
2628

2729
```shell
2830
import pluginCypress from 'eslint-plugin-cypress'
2931
```
3032

31-
For backwards compatibility with previous plugin versions `3.3.0` - `4.3.0`, the following equivalent deprecated form is also supported. This is planned to be removed in a future major version:
33+
The configuration `eslint-plugin-cypress/flat`, which was deprecated in plugin version `5.0.0`, is no longer available.
34+
Migrate to using the equivalent configuration `eslint-plugin-cypress` by dropping the `/flat` suffix.
3235

33-
```shell
34-
import pluginCypress from 'eslint-plugin-cypress/flat' # deprecated
35-
```
36+
Refer to ESLint `v10` [Configuration File Resolution](https://eslint.org/docs/latest/use/configure/configuration-files#configuration-file-resolution) for hierachical use of configuration files.
3637

3738
## Configurations
3839

@@ -81,7 +82,7 @@ The examples use the `defineConfig()` helper, introduced with ESLint [9.22.0](ht
8182

8283
All rules are available by importing from `eslint-plugin-cypress` and can be individually activated.
8384

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`
85+
- [cypress/unsafe-to-chain-command](./docs/rules/unsafe-to-chain-command.md) is activated and set to `error`
8586

8687
```js
8788
import { defineConfig } from 'eslint/config'
@@ -102,7 +103,7 @@ export default defineConfig([
102103

103104
The `eslint-plugin-cypress` [recommended rules](#rules) `configs.recommended` are activated, except for
104105

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`
106+
- [cypress/no-unnecessary-waiting](./docs/rules/no-unnecessary-waiting.md) which is set to `off`
106107

107108
```js
108109
import { defineConfig } from 'eslint/config'
@@ -139,7 +140,7 @@ export default defineConfig([
139140

140141
## Disable rules
141142

142-
You can disable specific rules per file, for a portion of a file, or for a single line. See the [ESLint rules](https://eslint.org/docs/latest/use/configure/rules#disabling-rules) documentation. For example ...
143+
You can disable specific rules per file, for a portion of a file, or for a single line. See the [ESLint rules](https://eslint.org/docs/latest/use/configure/rules#disable-rules) documentation. For example ...
143144

144145
Disable the `cypress/no-unnecessary-waiting` rule for the entire file by placing this at the start of the file:
145146

@@ -190,7 +191,7 @@ During test spec development, [Mocha exclusive tests](https://mochajs.org/#exclu
190191

191192
### Cypress and Mocha recommended
192193

193-
[eslint-plugin-mocha@^11](https://www.npmjs.com/package/eslint-plugin-mocha) is added to the example [Cypress recommended](#cypress-recommended). This version of the plugin supports only flat file configurations with the option `configs.recommended`.
194+
[eslint-plugin-mocha@^11](https://www.npmjs.com/package/eslint-plugin-mocha) is added to the example [Cypress recommended](#cypress-recommended).
194195

195196
The settings for individual `mocha` rules from the `configs.recommended` option are changed.
196197

circle.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ version: 2.1
33
executors:
44
docker-executor:
55
docker:
6-
- image: cimg/node:24.13.0
6+
- image: cimg/node:24.13.1
77
resource_class: medium
88

99
workflows:
@@ -23,7 +23,6 @@ workflows:
2323
config-file:
2424
# configurations correspond to examples in README
2525
- 'globals'
26-
- 'one-rule-deprecated' # using deprecated /flat
2726
- 'one-rule'
2827
- 'recommended'
2928
requires:
@@ -122,7 +121,7 @@ jobs:
122121
type: string
123122
config-file:
124123
description: Configuration file
125-
default: 'default'
124+
default: 'recommended'
126125
type: string
127126
executor: docker-executor
128127
working_directory: ./test-project
File renamed without changes.
File renamed without changes.

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@
22
"name": "eslint-plugin-cypress",
33
"version": "0.0.0-development",
44
"description": "An ESLint plugin for projects using Cypress",
5-
"main": "./lib/flat.js",
5+
"main": "./lib/index.js",
66
"exports": {
7-
".": "./lib/flat.js",
8-
"./flat": "./lib/flat.js"
7+
".": "./lib/index.js"
98
},
109
"files": [
1110
"lib",
@@ -14,6 +13,7 @@
1413
],
1514
"author": "Cypress-io",
1615
"license": "MIT",
16+
"type": "commonjs",
1717
"keywords": [
1818
"eslint",
1919
"eslintplugin",
@@ -31,7 +31,7 @@
3131
"eslint": ">=9"
3232
},
3333
"dependencies": {
34-
"globals": "^16.5.0"
34+
"globals": "^17.3.0"
3535
},
3636
"devDependencies": {
3737
"@eslint/js": "^10.0.1",

0 commit comments

Comments
 (0)