-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/fix/issue-with-unsafe-to-chain-c…
…ommand-that-is-not-action' into fix/issue-with-unsafe-to-chain-command-that-is-not-action
- Loading branch information
Showing
31 changed files
with
13,941 additions
and
19,950 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
module.exports = { | ||
"env": { | ||
"node": true, | ||
"es6": true | ||
}, | ||
"plugins": [ | ||
"eslint-plugin", | ||
"n", | ||
"mocha" | ||
], | ||
"extends": [ | ||
"eslint:recommended", | ||
"plugin:eslint-plugin/recommended", | ||
"plugin:n/recommended", | ||
"plugin:mocha/recommended" | ||
], | ||
"rules": { | ||
"eslint-plugin/require-meta-docs-url": | ||
["error", { "pattern": "https://github.com/cypress-io/eslint-plugin-cypress/blob/master/docs/rules/{{name}}.md" }], | ||
"eslint-plugin/require-meta-docs-description": "error", | ||
"n/no-extraneous-require": | ||
["error", { "allowModules": ["jest-config"] }], | ||
"no-redeclare": "off", | ||
"mocha/no-mocha-arrows": "off", | ||
"mocha/no-setup-in-describe": "off" | ||
}, | ||
"parserOptions": { | ||
"ecmaVersion": 2020 | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
npm run lint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
20.12.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
20.12.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Contributing to cypress-io/eslint-plugin-cypress | ||
|
||
Thanks for taking the time to contribute! :smile: | ||
|
||
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) | ||
* Write test scenarios then implement logic | ||
* Describe the rule in the generated `docs` file | ||
* Run `npm test` to run [Jest](https://jestjs.io/) or | ||
* Run `npm start` to run [Jest](https://jestjs.io/) in [watchAll](https://jestjs.io/docs/cli#--watchall) mode where it remains active and reruns when source changes are made | ||
* Make sure all tests are passing | ||
* Add the rule to the [README](README.md) file | ||
* Create a PR | ||
|
||
Use the following commit message conventions: https://github.com/semantic-release/semantic-release#commit-message-format |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,15 +5,13 @@ workflows: | |
main: | ||
jobs: | ||
- lint | ||
- test-v4 | ||
- test-v5 | ||
- test-v6 | ||
- test-v7 | ||
- test-v8 | ||
- release: | ||
requires: | ||
- lint | ||
- test-v4 | ||
- test-v5 | ||
- test-v6 | ||
- test-v7 | ||
- test-v8 | ||
filters: | ||
branches: | ||
only: | ||
|
@@ -22,60 +20,66 @@ workflows: | |
jobs: | ||
lint: | ||
docker: | ||
- image: circleci/node:16 | ||
- image: cimg/node:20.12.2 | ||
steps: | ||
- checkout | ||
- run: | ||
name: Install dependencies | ||
command: npm install | ||
command: npm ci | ||
- run: | ||
name: Show ESLint version | ||
command: npx eslint --version | ||
- run: | ||
name: Lint code | ||
command: npm run lint | ||
|
||
test-v4: | ||
test-v7: | ||
docker: | ||
- image: circleci/node:16 | ||
- image: cimg/node:20.12.2 | ||
steps: | ||
- checkout | ||
- run: | ||
name: Install dependencies | ||
command: npm install | ||
command: npm ci | ||
- run: | ||
name: Test ESLint 4 | ||
command: npm run test:v4 | ||
|
||
test-v5: | ||
docker: | ||
- image: circleci/node:16 | ||
steps: | ||
- checkout | ||
name: Remove unneeded plugins # minimum [email protected] required | ||
command: npm uninstall eslint-plugin-eslint-plugin eslint-plugin-n | ||
- run: | ||
name: Install dependencies | ||
command: npm install | ||
name: Install ESLint 7 | ||
command: npm install eslint@7 | ||
- run: | ||
name: Show ESLint version | ||
command: npx eslint --version | ||
- run: | ||
name: Test ESLint 5 | ||
command: npm run test | ||
name: Test ESLint 7 | ||
command: npm test | ||
|
||
test-v6: | ||
test-v8: | ||
docker: | ||
- image: circleci/node:16 | ||
- image: cimg/node:20.12.2 | ||
steps: | ||
- checkout | ||
- run: | ||
name: Install dependencies | ||
command: npm install | ||
command: npm ci | ||
- run: | ||
name: Install ESLint 8 | ||
command: npm install eslint@8 | ||
- run: | ||
name: Show ESLint version | ||
command: npx eslint --version | ||
- run: | ||
name: Test ESLint 6 | ||
command: npm run test:v6 | ||
name: Test ESLint 8 | ||
command: npm test | ||
|
||
release: | ||
docker: | ||
- image: circleci/node:16 | ||
- image: cimg/node:20.12.2 | ||
steps: | ||
- checkout | ||
- run: | ||
name: Install dependencies | ||
command: npm install | ||
command: npm ci | ||
- run: | ||
name: Run semantic release | ||
command: npm run semantic-release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
## No Assigning Return Values | ||
# Disallow assigning return values of `cy` calls (`cypress/no-assigning-return-values`) | ||
|
||
💼 This rule is enabled in the ✅ `recommended` config. | ||
|
||
<!-- end auto-generated rule header --> | ||
## Further Reading | ||
|
||
See [the Cypress Best Practices guide](https://on.cypress.io/best-practices#Assigning-Return-Values). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# Disallow using `async`/`await` in Cypress `before` methods (`cypress/no-async-before`) | ||
|
||
<!-- end auto-generated rule header --> | ||
Cypress commands that return a promise may cause side effects in `before`/`beforeEach` hooks, possibly causing unexpected behavior. | ||
|
||
## Rule Details | ||
|
||
This rule disallows using `async` `before` and `beforeEach` functions. | ||
|
||
Examples of **incorrect** code for this rule: | ||
|
||
```js | ||
describe('my feature', () => { | ||
before('my test case', async () => { | ||
await cy.get('.myClass') | ||
// other operations | ||
}) | ||
}) | ||
``` | ||
|
||
```js | ||
describe('my feature', () => { | ||
before('my test case', async () => { | ||
cy | ||
.get('.myClass') | ||
.click() | ||
|
||
await someAsyncFunction() | ||
}) | ||
}) | ||
``` | ||
|
||
Examples of **correct** code for this rule: | ||
|
||
```js | ||
describe('my feature', () => { | ||
before('my test case', () => { | ||
cy.get('.myClass') | ||
// other operations | ||
}) | ||
}) | ||
``` | ||
|
||
## When Not To Use It | ||
|
||
If there are genuine use-cases for using `async/await` in your `before` hooks then you may not want to include this rule (or at least demote it to a warning). | ||
|
||
## Further Reading | ||
|
||
- [Mixing Async and Sync code](https://on.cypress.io/guides/core-concepts/introduction-to-cypress#Mixing-Async-and-Sync-code) | ||
- [Commands Are Asynchronous](https://on.cypress.io/guides/core-concepts/introduction-to-cypress.html#Commands-Are-Asynchronous) |
Oops, something went wrong.