eslint-plugin-cypress
Advanced tools
Comparing version 2.0.1 to 2.1.0
const globals = require('globals') | ||
module.exports = { | ||
rules: { | ||
'no-assigning-return-values': require('./lib/rules/no-assigning-return-values'), | ||
'no-unnecessary-waiting': require('./lib/rules/no-unnecessary-waiting'), | ||
}, | ||
configs: { | ||
recommended: require('./lib/config/recommended'), | ||
}, | ||
environments: { | ||
@@ -5,0 +12,0 @@ globals: { |
@@ -1,1 +0,1 @@ | ||
{"name":"eslint-plugin-cypress","version":"2.0.1","description":"An ESLint plugin for projects using Cypress","main":"index.js","author":"Chris Breiding (chris@cypress.io)","license":"MIT","keywords":["eslint","eslintplugin","cypress"],"repository":{"type":"git","url":"git+https://github.com/cypress-io/eslint-plugin-cypress.git"},"bugs":{"url":"https://github.com/cypress-io/eslint-plugin-cypress/issues"},"homepage":"https://github.com/cypress-io/eslint-plugin-cypress#readme","peerDependencies":{"eslint":">= 3.2.1"},"dependencies":{"globals":"^11.0.1"},"devDependencies":{"condition-circle":"1.5.0","github-post-release":"1.13.1","husky":"^0.14.3","semantic-release":"8.2.0","simple-commit-message":"3.3.1"},"scripts":{"precommit":"eslint *.js","semantic-release":"semantic-release pre && npm publish --access public && semantic-release post"},"release":{"verifyConditions":"condition-circle","analyzeCommits":"simple-commit-message","generateNotes":"github-post-release"}} | ||
{"name":"eslint-plugin-cypress","version":"2.1.0","description":"An ESLint plugin for projects using Cypress","main":"index.js","author":"Chris Breiding (chris@cypress.io)","license":"MIT","keywords":["eslint","eslintplugin","cypress"],"repository":{"type":"git","url":"git+https://github.com/cypress-io/eslint-plugin-cypress.git"},"bugs":{"url":"https://github.com/cypress-io/eslint-plugin-cypress/issues"},"homepage":"https://github.com/cypress-io/eslint-plugin-cypress#readme","peerDependencies":{"eslint":">= 3.2.1"},"dependencies":{"globals":"^11.0.1"},"devDependencies":{"condition-circle":"1.5.0","eslint":"^5.7.0","eslint-plugin-cypress-dev":"1.1.2","github-post-release":"1.13.1","husky":"^0.14.3","jest":"^23.6.0","semantic-release":"8.2.0","simple-commit-message":"3.3.1"},"scripts":{"precommit":"npm run lint","lint":"eslint *.js","semantic-release":"semantic-release pre && npm publish --access public && semantic-release post","start":"yarn run test:watch","test":"jest","test-watch":"jest --watchAll"},"release":{"verifyConditions":"condition-circle","analyzeCommits":"simple-commit-message","generateNotes":"github-post-release"},"jest":{"testMatch":["**/tests/**/*.js"]}} |
@@ -15,6 +15,6 @@ # Cypress ESLint Plugin | ||
Add an `.eslintrc` file to your `cypress` directory with the following: | ||
Add an `.eslintrc.json` file to your `cypress` directory with the following: | ||
```json | ||
// my-project/cypress/.eslintrc | ||
// my-project/cypress/.eslintrc.json | ||
@@ -25,2 +25,5 @@ { | ||
], | ||
"extends": [ | ||
"plugin:cypress/recommended" | ||
], | ||
"env": { | ||
@@ -31,1 +34,54 @@ "cypress/globals": true | ||
``` | ||
## Rules | ||
Rules are grouped by category to help you understand their purpose. | ||
Rules with a check mark (✅) are enabled by default while using | ||
the `plugin:cypress/recommended` config. | ||
The --fix option on the command line automatically fixes problems reported by | ||
rules which have a wrench (🔧) below. | ||
### Possible Errors | ||
| | Rule ID | Description | | ||
|:---|:--------|:------------| | ||
| ✅ | [no-assigning-return-values](./docs/rules/no-assigning-return-values.md) | Prevent assigning return values of cy calls | | ||
| ✅ | [no-unnecessary-waiting](./docs/rules/no-unnecessary-waiting.md) | Prevent waiting for arbitrary time periods | | ||
## Chai and `no-unused-expressions` | ||
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](https://www.npmjs.com/package/eslint-plugin-chai-friendly). | ||
```sh | ||
npm install --save-dev eslint-plugin-chai-friendly | ||
``` | ||
In your `.eslintrc.json`: | ||
```json | ||
{ | ||
"plugins": [ | ||
"cypress", | ||
"chai-friendly" | ||
], | ||
"rules": { | ||
"no-unused-expressions": 0, | ||
"chai-friendly/no-unused-expressions": 2 | ||
} | ||
} | ||
``` | ||
## Contribution Guide | ||
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 |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9121
12
161
85
8