Gathering detailed insights and metrics for eslint-plugin-cypress
Gathering detailed insights and metrics for eslint-plugin-cypress
Gathering detailed insights and metrics for eslint-plugin-cypress
Gathering detailed insights and metrics for eslint-plugin-cypress
An ESLint plugin for projects that use Cypress
npm install eslint-plugin-cypress
Typescript
Module System
Node Version
NPM Version
94.1
Supply Chain
93.4
Quality
89.8
Maintenance
100
Vulnerability
98.9
License
JavaScript (99.87%)
TypeScript (0.13%)
Total Downloads
587,286,271
Last Day
126,829
Last Week
3,252,433
Last Month
14,193,207
Last Year
155,259,570
MIT License
717 Stars
318 Commits
92 Forks
33 Watchers
7 Branches
70 Contributors
Updated on Jun 06, 2025
Minified
Minified + Gzipped
Latest Version
5.1.0
Package Id
eslint-plugin-cypress@5.1.0
Unpacked Size
52.31 kB
Size
12.58 kB
File Count
30
NPM Version
10.9.2
Node Version
22.16.0
Published on
Jun 03, 2025
Cumulative downloads
Total Downloads
1
1
An ESLint plugin for your Cypress tests.
Note: If you installed ESLint globally then you must also install eslint-plugin-cypress
globally.
Prerequisites: ESLint v9
. Lower versions are no longer supported.
1npm install eslint eslint-plugin-cypress --save-dev
or
1yarn add eslint eslint-plugin-cypress --dev
ESLint v9
uses a Flat config file format with filename eslint.config.*js
by default. This plugin no longer supports the use of a deprecated eslintrc-type config file from previous ESLint versions.
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:
1import 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:
1import pluginCypress from 'eslint-plugin-cypress/flat' # deprecated
There are two specific configurations available:
Configuration | Content |
---|---|
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. There are no default rules enabled in this configuration. |
configs.recommended | enables recommended Rules. It includes also configs.global (see above). |
These rules enforce some of the best practices recommended for using Cypress.
💼 Configurations enabled in.
✅ Set in the recommended
configuration.
Name | Description | 💼 |
---|---|---|
assertion-before-screenshot | require screenshots to be preceded by an assertion | |
no-assigning-return-values | disallow assigning return values of cy calls | ✅ |
no-async-before | disallow using async /await in Cypress before methods | |
no-async-tests | disallow using async /await in Cypress test cases | ✅ |
no-chained-get | disallow chain of cy.get() calls | |
no-debug | disallow using cy.debug() calls | |
no-force | disallow using force: true with action commands | |
no-pause | disallow using cy.pause() calls | |
no-unnecessary-waiting | disallow waiting for arbitrary time periods | ✅ |
no-xpath | disallow using cy.xpath() calls | |
require-data-selectors | require data-* attribute selectors | |
unsafe-to-chain-command | disallow actions within chains | ✅ |
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.
All rules are available by importing from eslint-plugin-cypress
and can be individually activated.
error
1import pluginCypress from 'eslint-plugin-cypress' 2export default [ 3 { 4 plugins: { 5 cypress: pluginCypress 6 }, 7 rules: { 8 'cypress/unsafe-to-chain-command': 'error' 9 } 10 } 11]
The eslint-plugin-cypress
recommended rules configs.recommended
are activated, except for
off
1import pluginCypress from 'eslint-plugin-cypress' 2export default [ 3 pluginCypress.configs.recommended, 4 { 5 rules: { 6 'cypress/no-unnecessary-waiting': 'off' 7 } 8 } 9]
The configs.globals
are activated.
1import pluginCypress from 'eslint-plugin-cypress' 2export default [ 3 pluginCypress.configs.globals 4]
You can disable specific rules per file, for a portion of a file, or for a single line. See the ESLint rules documentation. For example ...
Disable the cypress/no-unnecessary-waiting
rule for the entire file by placing this at the start of the file:
1/* eslint-disable cypress/no-unnecessary-waiting */
Disable the cypress/no-unnecessary-waiting
rule for only a portion of the file:
1it('waits for a second', () => { 2 ... 3 /* eslint-disable cypress/no-unnecessary-waiting */ 4 cy.wait(1000) 5 /* eslint-enable cypress/no-unnecessary-waiting */ 6 ... 7})
Disable the cypress/no-unnecessary-waiting
rule for a specific line:
1it('waits for a second', () => { 2 ... 3 cy.wait(1000) // eslint-disable-line cypress/no-unnecessary-waiting 4 ... 5})
You can also disable a rule for the next line:
1it('waits for a second', () => { 2 ... 3 // eslint-disable-next-line cypress/no-unnecessary-waiting 4 cy.wait(1000) 5 ... 6})
Cypress is built on top of Mocha and Chai. See the following sections for information on using ESLint plugins eslint-plugin-mocha and eslint-plugin-chai-friendly together with eslint-plugin-cypress
.
.only
and .skip
During test spec development, Mocha exclusive tests .only
or Mocha inclusive tests .skip
may be used to control which tests are executed, as described in the Cypress documentation Excluding and Including Tests. To apply corresponding rules, you can install and use eslint-plugin-mocha@^11 plugin version or above. The rule mocha/no-exclusive-tests detects the use of .only
and the mocha/no-pending-tests rule detects the use of .skip
.
eslint-plugin-mocha@^11 is added to the example Cypress recommended. This version of the plugin supports only flat file configurations with the option configs.recommended
.
The settings for individual mocha
rules from the configs.recommended
option are changed.
error
instead of warn
off
instead of error
1npm install eslint-plugin-mocha@^11 --save-dev
1import pluginMocha from 'eslint-plugin-mocha' 2import pluginCypress from 'eslint-plugin-cypress' 3export default [ 4 pluginMocha.configs.recommended, 5 pluginCypress.configs.recommended, 6 { 7 rules: { 8 'mocha/no-exclusive-tests': 'error', 9 'mocha/no-pending-tests': 'error', 10 'mocha/no-mocha-arrows': 'off', 11 'cypress/no-unnecessary-waiting': 'off' 12 } 13 } 14]
Using an assertion such as expect(value).to.be.true
can fail the ESLint rule no-unused-expressions
even though it's not an error in this case. To fix this, you can install and use eslint-plugin-chai-friendly.
eslint-plugin-chai-friendly is combined with the Cypress plugin eslint-plugin-cypress
.
The recommended rules for both plugins are used: pluginCypress.configs.recommended
and pluginChaiFriendly.configs.recommendedFlat
:
1npm install eslint-plugin-chai-friendly@^1.0.1 --save-dev
1import pluginCypress from 'eslint-plugin-cypress' 2import pluginChaiFriendly from 'eslint-plugin-chai-friendly' 3export default [ 4 pluginCypress.configs.recommended, 5 pluginChaiFriendly.configs.recommendedFlat, 6 { 7 rules: { 8 'cypress/no-unnecessary-waiting': 'off', 9 }, 10 } 11]
Please see our Contributing Guideline which explains how to contribute rules or other fixes and features to the repo.
No vulnerabilities found.
Reason
all changesets reviewed
Reason
20 commit(s) and 9 issue activity found in the last 90 days -- score normalized to 10
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
1 existing vulnerabilities detected
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
security policy file not detected
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-06-23
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn MoreLast Day
-7.4%
126,829
Compared to previous day
Last Week
-8.9%
3,252,433
Compared to previous week
Last Month
0.9%
14,193,207
Compared to previous month
Last Year
8.9%
155,259,570
Compared to previous year
@finsit/eslint-plugin-cypress
An ESLint plugin for projects using Cypress
@cypress/eslint-plugin-dev
Common ESLint rules shared by Cypress development-only packages
eslint-plugin-cypress-dev
Common ESLint rules shared by Cypress packages
@nrwl/angular
The Nx Plugin for Angular contains executors, generators, and utilities for managing Angular applications and libraries within an Nx workspace. It provides: - Integration with libraries such as Storybook, Jest, ESLint, Tailwind CSS, and Cypress. - Gen