File tree Expand file tree Collapse file tree 3 files changed +26
-23
lines changed
Expand file tree Collapse file tree 3 files changed +26
-23
lines changed Original file line number Diff line number Diff line change 11# Cypress ESLint Plugin
22
3- An ESLint plugin for projects that use Cypress.
3+ An ESLint plugin for projects using [ Cypress] ( https://cypress.io ) for tests .
44
5- Specifies the environment and globals (` cy ` , ` Cypress ` , etc) for use when writing tests using [ Cypress ] ( https://cypress.io ) .
5+ Specifies globals for Cypress (` cy ` & ` Cypress ` ) as well as browser and mocha globals .
66
77## Installation
88
@@ -12,12 +12,17 @@ npm install eslint-plugin-cypress --save-dev
1212
1313## Usage
1414
15- Add ` cypress ` as a plugin in your ` .eslintrc ` :
15+ Add an ` .eslintrc ` file to your ` cypress ` directory with the following :
1616
1717``` json
18+ // my-project/cypress/.eslintrc
19+
1820{
1921 "plugins" : [
2022 " cypress"
21- ]
23+ ],
24+ "env" : {
25+ "cypress/globals" : true
26+ }
2227}
2328```
Original file line number Diff line number Diff line change 1+ const globals = require ( 'globals' )
2+
13module . exports = {
2- env : {
3- browser : true ,
4- } ,
5- parserOptions : {
6- ecmaVersion : 6 ,
4+ environments : {
5+ globals : {
6+ globals : Object . assign ( globals . browser , globals . mocha , {
7+ cy : false ,
8+ Cypress : false ,
9+ expect : false ,
10+ assert : false ,
11+ } ) ,
12+ parserOptions : {
13+ ecmaVersion : 2017 ,
14+ } ,
15+ } ,
716 } ,
8- globals : {
9- cy : true ,
10- Cypress : true ,
11-
12- describe : true ,
13- context : true ,
14- it : true ,
15- before : true ,
16- beforeEach : true ,
17- after : true ,
18- afterEach : true ,
19- expect : true ,
20- assert : true ,
21- }
2217}
Original file line number Diff line number Diff line change 2020 "homepage" : " https://github.com/cypress-io/eslint-plugin-cypress#readme" ,
2121 "peerDependencies" : {
2222 "eslint" : " >= 3.2.1"
23+ },
24+ "dependencies" : {
25+ "globals" : " ^11.0.1"
2326 }
2427}
You can’t perform that action at this time.
0 commit comments