eslint-plugin-cypress
Advanced tools
Comparing version 2.11.2 to 2.11.3
@@ -45,3 +45,3 @@ 'use strict' | ||
node.arguments.some((arg) => { | ||
return arg.type === 'ObjectExpression' && arg.properties.some((propNode) => propNode.key.name === 'force') | ||
return arg.type === 'ObjectExpression' && arg.properties.some((propNode) => propNode.key && propNode.key.name === 'force') | ||
}) | ||
@@ -48,0 +48,0 @@ } |
{ | ||
"name": "eslint-plugin-cypress", | ||
"version": "2.11.2", | ||
"version": "2.11.3", | ||
"description": "An ESLint plugin for projects using Cypress", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -65,2 +65,47 @@ # 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) | ||
## Disable rules | ||
You can disable specific rules per file, for a portion of a file, or for a single line. | ||
Disable the `cypress/no-unnecessary-waiting` rule for the entire file by placing this at the start of the file: | ||
```js | ||
/* eslint-disable cypress/no-unnecessary-waiting */ | ||
``` | ||
Disable the `cypress/no-unnecessary-waiting` rule for a portion of the file: | ||
```js | ||
it('waits for a second', () => { | ||
... | ||
/* eslint-disable cypress/no-unnecessary-waiting */ | ||
cy.wait(1000) | ||
/* eslint-enable cypress/no-unnecessary-waiting */ | ||
... | ||
}) | ||
``` | ||
Disable the `cypress/no-unnecessary-waiting` rule for a specific line: | ||
```js | ||
it('waits for a second', () => { | ||
... | ||
cy.wait(1000) // eslint-disable-line cypress/no-unnecessary-waiting | ||
... | ||
}) | ||
``` | ||
You can also disable a rule for the next line: | ||
```js | ||
it('waits for a second', () => { | ||
... | ||
// eslint-disable-next-line cypress/no-unnecessary-waiting | ||
cy.wait(1000) | ||
... | ||
}) | ||
``` | ||
For more, see the [ESLint rules](https://eslint.org/docs/user-guide/configuring/rules) documentation. | ||
## Rules | ||
@@ -67,0 +112,0 @@ |
@@ -12,3 +12,3 @@ 'use strict' | ||
const errors = [{ messageId: 'unexpected' }] | ||
const parserOptions = { ecmaVersion: 6 } | ||
const parserOptions = { ecmaVersion: 2018 } | ||
@@ -28,8 +28,9 @@ //------------------------------------------------------------------------------ | ||
{ code: `cy.get('input').type('somth')`, parserOptions }, | ||
{ code: `cy.get('input').type('somth', {anyoption: true})`, parserOptions, errors }, | ||
{ code: `cy.get('input').trigger('click', {anyoption: true})`, parserOptions, errors }, | ||
{ code: `cy.get('input').rightclick({anyoption: true})`, parserOptions, errors }, | ||
{ code: `cy.get('input').check()`, parserOptions, errors }, | ||
{ code: `cy.get('input').select()`, parserOptions, errors }, | ||
{ code: `cy.get('input').focus()`, parserOptions, errors }, | ||
{ code: `cy.get('input').type('somth', {anyoption: true})`, parserOptions }, | ||
{ code: `cy.get('input').trigger('click', {anyoption: true})`, parserOptions }, | ||
{ code: `cy.get('input').rightclick({anyoption: true})`, parserOptions }, | ||
{ code: `cy.get('input').check()`, parserOptions }, | ||
{ code: `cy.get('input').select()`, parserOptions }, | ||
{ code: `cy.get('input').focus()`, parserOptions }, | ||
{ code: `cy.document().trigger("keydown", { ...event })`, parserOptions }, | ||
], | ||
@@ -36,0 +37,0 @@ |
@@ -29,2 +29,25 @@ 'use strict' | ||
{ code: 'const customWait = (ms) => { cy.wait(ms) }', parserOptions, errors }, | ||
// disable the eslint rule | ||
{ | ||
code: ` | ||
cy.wait(100); // eslint-disable-line no-unnecessary-waiting | ||
`, | ||
parserOptions, | ||
}, | ||
{ | ||
code: ` | ||
/* eslint-disable-next-line no-unnecessary-waiting */ | ||
cy.wait(100) | ||
`, | ||
parserOptions, | ||
}, | ||
{ | ||
code: ` | ||
/* eslint-disable no-unnecessary-waiting */ | ||
cy.wait(100) | ||
/* eslint-enable no-unnecessary-waiting */ | ||
`, | ||
parserOptions, | ||
}, | ||
], | ||
@@ -31,0 +54,0 @@ |
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
38554
627
171