An ESLint plugin for projects that use Cypress
Switch branches/tags
Nothing to show
Clone or download

Cypress ESLint Plugin

An ESLint plugin for your Cypress tests.

Specifies globals for Cypress cy, Cypress, browser and mocha globals.


npm install eslint-plugin-cypress --save-dev


Add an .eslintrc.json file to your cypress directory with the following:

// my-project/cypress/.eslintrc.json

  "plugins": [
  "env": {
    "cypress/globals": true

Chai and no-unused-expressions

Using an assertion such as expect(value) 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.

npm install --save-dev eslint-plugin-chai-friendly

In your .eslintrc.json:

  "plugins": [
  "rules": {
    "no-unused-expressions": 0,
    "chai-friendly/no-unused-expressions": 2