eslint-plugin-cypress 3.0.0 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.json +34 -3
- package/circle.yml +3 -0
- package/index.js +1 -0
- package/lib/rules/assertion-before-screenshot.js +2 -0
- package/lib/rules/no-assigning-return-values.js +2 -1
- package/lib/rules/no-async-before.js +3 -0
- package/lib/rules/no-async-tests.js +3 -0
- package/lib/rules/no-force.js +2 -0
- package/lib/rules/no-pause.js +2 -0
- package/lib/rules/no-unnecessary-waiting.js +2 -1
- package/lib/rules/require-data-selectors.js +3 -2
- package/lib/rules/unsafe-to-chain-command.js +2 -1
- package/package.json +5 -10
- package/tests/lib/rules/require-data-selectors.js +2 -2
package/.eslintrc.json
CHANGED
|
@@ -1,8 +1,39 @@
|
|
|
1
1
|
{
|
|
2
|
+
"env": {
|
|
3
|
+
"node": true,
|
|
4
|
+
"es6": true
|
|
5
|
+
},
|
|
2
6
|
"plugins": [
|
|
3
|
-
"
|
|
7
|
+
"eslint-plugin",
|
|
8
|
+
"n",
|
|
9
|
+
"mocha"
|
|
4
10
|
],
|
|
5
11
|
"extends": [
|
|
6
|
-
"
|
|
7
|
-
|
|
12
|
+
"eslint:recommended",
|
|
13
|
+
"plugin:eslint-plugin/recommended",
|
|
14
|
+
"plugin:n/recommended",
|
|
15
|
+
"plugin:mocha/recommended"
|
|
16
|
+
],
|
|
17
|
+
"rules": {
|
|
18
|
+
"eslint-plugin/require-meta-docs-url": [
|
|
19
|
+
"error",
|
|
20
|
+
{
|
|
21
|
+
"pattern": "https://github.com/cypress-io/eslint-plugin-cypress/blob/master/docs/rules/{{name}}.md"
|
|
22
|
+
}
|
|
23
|
+
],
|
|
24
|
+
"n/no-extraneous-require": [
|
|
25
|
+
"error",
|
|
26
|
+
{
|
|
27
|
+
"allowModules": [
|
|
28
|
+
"jest-config"
|
|
29
|
+
]
|
|
30
|
+
}
|
|
31
|
+
],
|
|
32
|
+
"no-redeclare": "off",
|
|
33
|
+
"mocha/no-mocha-arrows": "off",
|
|
34
|
+
"mocha/no-setup-in-describe": "off"
|
|
35
|
+
},
|
|
36
|
+
"parserOptions": {
|
|
37
|
+
"ecmaVersion": 2018
|
|
38
|
+
}
|
|
8
39
|
}
|
package/circle.yml
CHANGED
|
@@ -41,6 +41,9 @@ jobs:
|
|
|
41
41
|
- run:
|
|
42
42
|
name: Install dependencies
|
|
43
43
|
command: npm ci
|
|
44
|
+
- run:
|
|
45
|
+
name: Remove unneeded plugins # minimum eslint@8.23.0 required
|
|
46
|
+
command: npm uninstall eslint-plugin-eslint-plugin eslint-plugin-n
|
|
44
47
|
- run:
|
|
45
48
|
name: Install ESLint 7
|
|
46
49
|
command: npm install eslint@7
|
package/index.js
CHANGED
|
@@ -5,6 +5,7 @@ module.exports = {
|
|
|
5
5
|
'no-assigning-return-values': require('./lib/rules/no-assigning-return-values'),
|
|
6
6
|
'unsafe-to-chain-command': require('./lib/rules/unsafe-to-chain-command'),
|
|
7
7
|
'no-unnecessary-waiting': require('./lib/rules/no-unnecessary-waiting'),
|
|
8
|
+
'no-async-before': require('./lib/rules/no-async-before'),
|
|
8
9
|
'no-async-tests': require('./lib/rules/no-async-tests'),
|
|
9
10
|
'assertion-before-screenshot': require('./lib/rules/assertion-before-screenshot'),
|
|
10
11
|
'require-data-selectors': require('./lib/rules/require-data-selectors'),
|
|
@@ -16,10 +16,12 @@ const assertionCommands = [
|
|
|
16
16
|
|
|
17
17
|
module.exports = {
|
|
18
18
|
meta: {
|
|
19
|
+
type: 'problem',
|
|
19
20
|
docs: {
|
|
20
21
|
description: 'Assert on the page state before taking a screenshot, so the screenshot is consistent',
|
|
21
22
|
category: 'Possible Errors',
|
|
22
23
|
recommended: false,
|
|
24
|
+
url: 'https://github.com/cypress-io/eslint-plugin-cypress/blob/master/docs/rules/assertion-before-screenshot.md',
|
|
23
25
|
},
|
|
24
26
|
schema: [],
|
|
25
27
|
messages: {
|
|
@@ -17,11 +17,12 @@ function get (obj, propertyString = '') {
|
|
|
17
17
|
|
|
18
18
|
module.exports = {
|
|
19
19
|
meta: {
|
|
20
|
+
type: 'problem',
|
|
20
21
|
docs: {
|
|
21
22
|
description: 'Prevent assigning return values of cy calls',
|
|
22
23
|
category: 'Possible Errors',
|
|
23
24
|
recommended: true,
|
|
24
|
-
url: 'https://
|
|
25
|
+
url: 'https://github.com/cypress-io/eslint-plugin-cypress/blob/master/docs/rules/no-assigning-return-values.md',
|
|
25
26
|
},
|
|
26
27
|
schema: [],
|
|
27
28
|
messages: {
|
|
@@ -2,11 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
module.exports = {
|
|
4
4
|
meta: {
|
|
5
|
+
type: 'problem',
|
|
5
6
|
docs: {
|
|
6
7
|
description: 'Prevent using async/await in Cypress before methods',
|
|
7
8
|
category: 'Possible Errors',
|
|
8
9
|
recommended: true,
|
|
10
|
+
url: 'https://github.com/cypress-io/eslint-plugin-cypress/blob/master/docs/rules/no-async-before.md',
|
|
9
11
|
},
|
|
12
|
+
schema: [],
|
|
10
13
|
messages: {
|
|
11
14
|
unexpected: 'Avoid using async functions with Cypress before / beforeEach functions',
|
|
12
15
|
},
|
|
@@ -2,11 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
module.exports = {
|
|
4
4
|
meta: {
|
|
5
|
+
type: 'problem',
|
|
5
6
|
docs: {
|
|
6
7
|
description: 'Prevent using async/await in Cypress test cases',
|
|
7
8
|
category: 'Possible Errors',
|
|
8
9
|
recommended: true,
|
|
10
|
+
url: 'https://github.com/cypress-io/eslint-plugin-cypress/blob/master/docs/rules/no-async-tests.md',
|
|
9
11
|
},
|
|
12
|
+
schema: [],
|
|
10
13
|
messages: {
|
|
11
14
|
unexpected: 'Avoid using async functions with Cypress tests',
|
|
12
15
|
},
|
package/lib/rules/no-force.js
CHANGED
|
@@ -6,10 +6,12 @@
|
|
|
6
6
|
|
|
7
7
|
module.exports = {
|
|
8
8
|
meta: {
|
|
9
|
+
type: 'suggestion',
|
|
9
10
|
docs: {
|
|
10
11
|
description: 'Disallow using of \'force: true\' option for click and type calls',
|
|
11
12
|
category: 'Possible Errors',
|
|
12
13
|
recommended: false,
|
|
14
|
+
url: 'https://github.com/cypress-io/eslint-plugin-cypress/blob/master/docs/rules/no-force.md',
|
|
13
15
|
},
|
|
14
16
|
fixable: null, // or "code" or "whitespace"
|
|
15
17
|
schema: [],
|
package/lib/rules/no-pause.js
CHANGED
|
@@ -6,10 +6,12 @@
|
|
|
6
6
|
|
|
7
7
|
module.exports = {
|
|
8
8
|
meta: {
|
|
9
|
+
type: 'suggestion',
|
|
9
10
|
docs: {
|
|
10
11
|
description: 'Disallow using of \'cy.pause\' calls',
|
|
11
12
|
category: 'Possible Errors',
|
|
12
13
|
recommended: false,
|
|
14
|
+
url: 'https://github.com/cypress-io/eslint-plugin-cypress/blob/master/docs/rules/no-pause.md',
|
|
13
15
|
},
|
|
14
16
|
fixable: null, // or "code" or "whitespace"
|
|
15
17
|
schema: [],
|
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
module.exports = {
|
|
4
4
|
meta: {
|
|
5
|
+
type: 'problem',
|
|
5
6
|
docs: {
|
|
6
7
|
description: 'Prevent waiting for arbitrary time periods',
|
|
7
8
|
category: 'Possible Errors',
|
|
8
9
|
recommended: true,
|
|
9
|
-
url: 'https://
|
|
10
|
+
url: 'https://github.com/cypress-io/eslint-plugin-cypress/blob/master/docs/rules/no-unnecessary-waiting.md',
|
|
10
11
|
},
|
|
11
12
|
schema: [],
|
|
12
13
|
messages: {
|
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
module.exports = {
|
|
4
4
|
meta: {
|
|
5
|
+
type: 'suggestion',
|
|
5
6
|
docs: {
|
|
6
|
-
description: 'Use data-* attributes to provide context to your selectors and insulate them from CSS or JS changes
|
|
7
|
+
description: 'Use data-* attributes to provide context to your selectors and insulate them from CSS or JS changes',
|
|
7
8
|
category: 'Possible Errors',
|
|
8
9
|
recommended: false,
|
|
9
|
-
url: 'https://
|
|
10
|
+
url: 'https://github.com/cypress-io/eslint-plugin-cypress/blob/master/docs/rules/require-data-selectors.md',
|
|
10
11
|
},
|
|
11
12
|
schema: [],
|
|
12
13
|
messages: {
|
|
@@ -69,11 +69,12 @@ const getDefaultOptions = (context) => {
|
|
|
69
69
|
/** @type {import('eslint').Rule.RuleModule} */
|
|
70
70
|
module.exports = {
|
|
71
71
|
meta: {
|
|
72
|
+
type: 'problem',
|
|
72
73
|
docs: {
|
|
73
74
|
description: DESCRIPTION,
|
|
74
75
|
category: 'Possible Errors',
|
|
75
76
|
recommended: true,
|
|
76
|
-
url: 'https://
|
|
77
|
+
url: 'https://github.com/cypress-io/eslint-plugin-cypress/blob/master/docs/rules/unsafe-to-chain-command.md',
|
|
77
78
|
},
|
|
78
79
|
schema: [schema],
|
|
79
80
|
messages: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-cypress",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.1",
|
|
4
4
|
"description": "An ESLint plugin for projects using Cypress",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"author": "Cypress-io",
|
|
@@ -25,19 +25,14 @@
|
|
|
25
25
|
"globals": "^13.20.0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"eslint": "^7.32.0",
|
|
33
|
-
"eslint-plugin-mocha": "^6.3.0",
|
|
28
|
+
"eslint": "^8.57.0",
|
|
29
|
+
"eslint-plugin-eslint-plugin": "^6.0.0",
|
|
30
|
+
"eslint-plugin-mocha": "^10.4.3",
|
|
31
|
+
"eslint-plugin-n": "^17.2.1",
|
|
34
32
|
"husky": "^8.0.3",
|
|
35
33
|
"jest": "^29.7.0",
|
|
36
34
|
"semantic-release": "19.0.3"
|
|
37
35
|
},
|
|
38
|
-
"overrides": {
|
|
39
|
-
"eslint-plugin-mocha": "$eslint-plugin-mocha"
|
|
40
|
-
},
|
|
41
36
|
"scripts": {
|
|
42
37
|
"lint": "eslint \"*.js\" \"**/**/*.js\"",
|
|
43
38
|
"lint-fix": "npm run lint -- --fix",
|
|
@@ -15,7 +15,7 @@ ruleTester.run('require-data-selectors', rule, {
|
|
|
15
15
|
{ code: 'cy.clock(5000)', parserOptions },
|
|
16
16
|
{ code: 'cy.scrollTo(0, 10)', parserOptions },
|
|
17
17
|
{ code: 'cy.tick(500)', parserOptions },
|
|
18
|
-
{ code: 'cy.get(\`[data-cy=${1}]\`)', parserOptions },
|
|
18
|
+
{ code: 'cy.get(\`[data-cy=${1}]\`)', parserOptions }, // eslint-disable-line no-useless-escape
|
|
19
19
|
{ code: 'cy.get("@my-alias")', parserOptions, errors },
|
|
20
20
|
{ code: 'cy.get(`@my-alias`)', parserOptions, errors },
|
|
21
21
|
],
|
|
@@ -26,6 +26,6 @@ ruleTester.run('require-data-selectors', rule, {
|
|
|
26
26
|
{ code: 'cy.get(".btn-large").click()', parserOptions, errors },
|
|
27
27
|
{ code: 'cy.get(".btn-.large").click()', parserOptions, errors },
|
|
28
28
|
{ code: 'cy.get(".a")', parserOptions, errors },
|
|
29
|
-
{ code: 'cy.get(\`[daedta-cy=${1}]\`)', parserOptions, errors },
|
|
29
|
+
{ code: 'cy.get(\`[daedta-cy=${1}]\`)', parserOptions, errors }, // eslint-disable-line no-useless-escape
|
|
30
30
|
],
|
|
31
31
|
})
|