eslint-plugin-cypress
Advanced tools
Comparing version 2.15.2 to 3.0.0
{ | ||
"name": "eslint-plugin-cypress", | ||
"version": "2.15.2", | ||
"version": "3.0.0", | ||
"description": "An ESLint plugin for projects using Cypress", | ||
@@ -22,3 +22,3 @@ "main": "index.js", | ||
"peerDependencies": { | ||
"eslint": ">= 3.2.1" | ||
"eslint": ">=7 <9" | ||
}, | ||
@@ -29,9 +29,15 @@ "dependencies": { | ||
"devDependencies": { | ||
"@cypress/eslint-plugin-dev": "3.2.0", | ||
"@cypress/eslint-plugin-json": "3.2.1", | ||
"eslint": "^5.7.0", | ||
"@cypress/eslint-plugin-dev": "3.9.1", | ||
"@cypress/eslint-plugin-json": "3.2.3", | ||
"@typescript-eslint/eslint-plugin": "^4.33.0", | ||
"@typescript-eslint/parser": "^4.33.0", | ||
"eslint": "^7.32.0", | ||
"eslint-plugin-mocha": "^6.3.0", | ||
"husky": "^8.0.3", | ||
"jest": "^24.8.0", | ||
"jest": "^29.7.0", | ||
"semantic-release": "19.0.3" | ||
}, | ||
"overrides": { | ||
"eslint-plugin-mocha": "$eslint-plugin-mocha" | ||
}, | ||
"scripts": { | ||
@@ -41,14 +47,7 @@ "lint": "eslint \"*.js\" \"**/**/*.js\"", | ||
"semantic-release": "semantic-release", | ||
"start": "yarn run test-watch", | ||
"start": "npm run test-watch", | ||
"test": "jest", | ||
"test:v4": "npm i eslint@4.x && npm run test", | ||
"test:v6": "npm i eslint@6.x && npm run test", | ||
"test-watch": "jest --watchAll", | ||
"prepare": "husky install" | ||
}, | ||
"jest": { | ||
"testMatch": [ | ||
"**/tests/**/*.js" | ||
] | ||
} | ||
} |
@@ -9,2 +9,4 @@ # Cypress ESLint Plugin [![CircleCI](https://circleci.com/gh/cypress-io/eslint-plugin-cypress/tree/master.svg?style=svg)](https://circleci.com/gh/cypress-io/eslint-plugin-cypress/tree/master) | ||
Prerequisites: [ESLint](https://www.npmjs.com/package/eslint) `v7` or `v8`. ESLint `v9` is **not** supported yet. | ||
```sh | ||
@@ -119,4 +121,2 @@ npm install eslint-plugin-cypress --save-dev | ||
**NOTE**: These rules currently require eslint 5.0 or greater. If you would like support added for eslint 4.x, please 👍 [this issue](https://github.com/cypress-io/eslint-plugin-cypress/issues/14). | ||
| | Rule ID | Description | | ||
@@ -133,2 +133,40 @@ | :-- | :------------------------------------------------------------------------- | :-------------------------------------------------------------- | | ||
## Mocha and Chai | ||
Cypress is built on top of [Mocha](https://on.cypress.io/guides/references/bundled-libraries#Mocha) and [Chai](https://on.cypress.io/guides/references/bundled-libraries#Chai). See the following sections for information on using ESLint plugins [eslint-plugin-mocha](https://www.npmjs.com/package/eslint-plugin-mocha) and [eslint-plugin-chai-friendly](https://www.npmjs.com/package/eslint-plugin-chai-friendly) together with `eslint-plugin-cypress`. | ||
## Mocha `.only` and `.skip` | ||
During test spec development, [Mocha exclusive tests](https://mochajs.org/#exclusive-tests) `.only` or [Mocha inclusive tests](https://mochajs.org/#inclusive-tests) `.skip` may be used to control which tests are executed, as described in the Cypress documentation [Excluding and Including Tests](https://on.cypress.io/guides/core-concepts/writing-and-organizing-tests#Excluding-and-Including-Tests). To apply corresponding rules, you can install and use [eslint-plugin-mocha](https://www.npmjs.com/package/eslint-plugin-mocha). The rule [mocha/no-exclusive-tests](https://github.com/lo1tuma/eslint-plugin-mocha/blob/main/docs/rules/no-exclusive-tests.md) detects the use of `.only` and the [mocha/no-skipped-tests](https://github.com/lo1tuma/eslint-plugin-mocha/blob/main/docs/rules/no-skipped-tests.md) rule detects the use of `.skip`: | ||
```sh | ||
npm install --save-dev eslint-plugin-mocha | ||
``` | ||
In your `.eslintrc.json`: | ||
```json | ||
{ | ||
"plugins": [ | ||
"cypress", | ||
"mocha" | ||
], | ||
"rules": { | ||
"mocha/no-exclusive-tests": "warn", | ||
"mocha/no-skipped-tests": "warn" | ||
} | ||
} | ||
``` | ||
Or you can simply use the `cypress/recommended` and `mocha/recommended` configurations together, for example: | ||
```json | ||
{ | ||
"extends": [ | ||
"plugin:cypress/recommended", | ||
"plugin:mocha/recommended" | ||
] | ||
} | ||
``` | ||
## Chai and `no-unused-expressions` | ||
@@ -165,14 +203,4 @@ | ||
## Contribution Guide | ||
## Contributing | ||
To add a new rule: | ||
* Fork and clone this repository | ||
* Generate a new rule (a [yeoman generator](https://github.com/eslint/generator-eslint) is available) | ||
* Run `yarn start` or `npm start` | ||
* Write test scenarios then implement logic | ||
* Describe the rule in the generated `docs` file | ||
* Make sure all tests are passing | ||
* Add the rule to this README | ||
* Create a PR | ||
Use the following commit message conventions: https://github.com/semantic-release/semantic-release#commit-message-format | ||
Please see our [Contributing Guideline](./CONTRIBUTING.md) which explains how to contribute rules or other fixes and features to the repo. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
53990
42
203
9