Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
24.13.0
24.13.1
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
24.13.0
24.13.1
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ To add a new rule:
- Run `npm run format`
- Run `npm test` to run [Vitest](https://vitest.dev/)
- Make sure all tests are passing
- Add the rule to [flat.js](https://github.com/cypress-io/eslint-plugin-cypress/blob/master/lib/flat.js)
- Add the rule to [index.js](./lib/index.js)
- 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))
- Create a PR from your branch

Expand Down
5 changes: 3 additions & 2 deletions ESLINTRC-CONFIG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Cypress ESLint Plugin - Legacy Config

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).
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).

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

Users who were previously using a deprecated configuration environment should migrate to a [flat configuration](https://eslint.org/docs/latest/use/configure/configuration-files).
19 changes: 10 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,20 @@ yarn add eslint eslint-plugin-cypress --dev

## Usage

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.
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.
You must use a [Flat config file](https://eslint.org/docs/latest/use/configure/configuration-files) format.
This is the default in ESLint `v9`, and in ESLint `v10` it is the only config format available.

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:

```shell
import pluginCypress from 'eslint-plugin-cypress'
```

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:
The configuration `eslint-plugin-cypress/flat`, which was deprecated in plugin version `5.0.0`, is no longer available.
Migrate to using the equivalent configuration `eslint-plugin-cypress` by dropping the `/flat` suffix.

```shell
import pluginCypress from 'eslint-plugin-cypress/flat' # deprecated
```
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.

## Configurations

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

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

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

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

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

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

```js
import { defineConfig } from 'eslint/config'
Expand Down Expand Up @@ -139,7 +140,7 @@ export default defineConfig([

## Disable rules

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

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

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

### Cypress and Mocha recommended

[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`.
[eslint-plugin-mocha@^11](https://www.npmjs.com/package/eslint-plugin-mocha) is added to the example [Cypress recommended](#cypress-recommended).

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

Expand Down
5 changes: 2 additions & 3 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: 2.1
executors:
docker-executor:
docker:
- image: cimg/node:24.13.0
- image: cimg/node:24.13.1
resource_class: medium

workflows:
Expand All @@ -23,7 +23,6 @@ workflows:
config-file:
# configurations correspond to examples in README
- 'globals'
- 'one-rule-deprecated' # using deprecated /flat
- 'one-rule'
- 'recommended'
requires:
Expand Down Expand Up @@ -122,7 +121,7 @@ jobs:
type: string
config-file:
description: Configuration file
default: 'default'
default: 'recommended'
type: string
executor: docker-executor
working_directory: ./test-project
Expand Down
File renamed without changes.
File renamed without changes.
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@
"name": "eslint-plugin-cypress",
"version": "0.0.0-development",
"description": "An ESLint plugin for projects using Cypress",
"main": "./lib/flat.js",
"main": "./lib/index.js",
"exports": {
".": "./lib/flat.js",
"./flat": "./lib/flat.js"
".": "./lib/index.js"
},
"files": [
"lib",
Expand All @@ -14,6 +13,7 @@
],
"author": "Cypress-io",
"license": "MIT",
"type": "commonjs",
"keywords": [
"eslint",
"eslintplugin",
Expand All @@ -31,7 +31,7 @@
"eslint": ">=9"
},
"dependencies": {
"globals": "^16.5.0"
"globals": "^17.3.0"
},
"devDependencies": {
"@eslint/js": "^10.0.1",
Expand Down
15 changes: 0 additions & 15 deletions test-project/eslint-configs/eslint.one-rule-deprecated.mjs

This file was deleted.

2 changes: 1 addition & 1 deletion tests/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
'use strict'

const globals = require('globals')
const config = require('../lib/flat.js')
const config = require('../lib/index.js')

describe('globals languageOptions', () => {
const languageOptions = config.configs.globals.languageOptions
Expand Down