Skip to content

Commit c40989d

Browse files
Merge pull request #203 from MikeMcC399/enable/eslint-v9
feat: support eslint v9 through @eslint/eslintrc
2 parents f38cc04 + 25e092e commit c40989d

File tree

4 files changed

+13
-10
lines changed

4 files changed

+13
-10
lines changed

FLAT-CONFIG.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
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.
44

5-
Usage with ESLint `8.57.0` is described. An update to this document is planned to cover ESLint `9.x` additionally.
5+
Usage with ESLint `8.57.0` and ESLint `9.x` is described.
66

77
## Introduction
88

@@ -12,20 +12,20 @@ Previously, ESLint had announced in their blog post [Flat config rollout plans](
1212

1313
The Cypress ESLint Plugin (`eslint-plugin-cypress`) is currently based on ESLint `8.x` and has not yet been migrated to support Flat Config natively. [ESLint's new config system, Part 2: Introduction to flat config](https://eslint.org/blog/2022/08/new-config-system-part-2/) from August 2022 introduced the [Backwards compatibility utility](https://eslint.org/blog/2022/08/new-config-system-part-2/#backwards-compatibility-utility). This gives the capability to use `eslint-plugin-cypress` in an ESLint flat config environment.
1414

15-
The following information details installation and usage examples for `eslint-plugin-cypress` together with related plugins in such an ESLint `8.57.0` flat config environment.
15+
The following information details installation and usage examples for `eslint-plugin-cypress` together with related plugins in an ESLint flat config environment.
1616

1717
## Installation
1818

19-
It is recommended to use a minimum ESLint `v8.x` version [[email protected]](https://github.com/eslint/eslint/releases/tag/v8.57.0).
19+
It is recommended to use a minimum ESLint `8.x` version [[email protected]](https://github.com/eslint/eslint/releases/tag/v8.57.0) or ESLint `9.x`.
2020

2121
```shell
22-
npm install eslint@^8.57.0 @eslint/eslintrc eslint-plugin-cypress --save-dev
22+
npm install eslint @eslint/eslintrc eslint-plugin-cypress@^3.1.1 --save-dev
2323
```
2424

2525
or
2626

2727
```shell
28-
yarn add eslint@^8.57.0 @eslint/eslintrc eslint-plugin-cypress --dev
28+
yarn add eslint @eslint/eslintrc eslint-plugin-cypress@^3.1.1 --dev
2929
```
3030

3131
## Usage examples
@@ -130,3 +130,5 @@ export default [
130130
})
131131
]
132132
```
133+
134+
**Pending the resolution of issue https://github.com/ihordiachenko/eslint-plugin-chai-friendly/issues/32 [eslint-plugin-chai-friendly](https://www.npmjs.com/package/eslint-plugin-chai-friendly) cannot be used with ESLint `v9`.**

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ Note: If you installed ESLint globally then you must also install `eslint-plugin
66

77
## Installation
88

9-
Prerequisites: [ESLint](https://www.npmjs.com/package/eslint) `v7` or `v8`. ESLint `v9` is **not** supported yet.
9+
Prerequisites: [ESLint](https://www.npmjs.com/package/eslint) `v7`, `v8` or `v9`.
10+
This plugin supports the use of [Flat config files](https://eslint.org/docs/latest/use/configure/configuration-files) with ESLint `8.57.0` and above through [@eslint/eslintrc](https://www.npmjs.com/package/@eslint/eslintrc).
1011

1112
```sh
1213
npm install eslint-plugin-cypress --save-dev
@@ -18,9 +19,9 @@ yarn add eslint-plugin-cypress --dev
1819

1920
## Usage
2021

21-
If you are using ESLint `v7` or `v8`, then add an `.eslintrc.json` file to the root directory of your Cypress project with the contents shown below.
22+
If you are using ESLint `v7` or `v8`, then add an `.eslintrc.json` file to the root directory of your Cypress project with the contents shown below. You can continue to use this format 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).
2223

23-
Optionally, if you are using ESLint `v8` with a minimum version of `8.57.0`, you can use the [new configuration file](https://eslint.org/docs/v8.x/use/configure/configuration-files-new) format with filename `eslint.config.*js`. In this case, please refer to [additional Flat config installation and configuration details](FLAT-CONFIG.md).
24+
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 [additional Flat config installation and configuration details](FLAT-CONFIG.md). (You may also use this with ESLint `8.57.0`.)
2425

2526
```json
2627
{

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
},
2020
"homepage": "https://github.com/cypress-io/eslint-plugin-cypress#readme",
2121
"peerDependencies": {
22-
"eslint": ">=7 <9"
22+
"eslint": ">=7"
2323
},
2424
"dependencies": {
2525
"globals": "^13.20.0"

0 commit comments

Comments
 (0)