eslint-config-seek 13.0.0 → 13.1.0

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/base.js CHANGED
@@ -1,12 +1,8 @@
1
- const path = require('path');
2
1
  const root = require('find-root')(process.cwd());
3
2
 
4
3
  const OFF = 0;
5
4
  const ERROR = 2;
6
5
 
7
- const rulesDirPlugin = require('eslint-plugin-rulesdir');
8
- rulesDirPlugin.RULES_DIR = path.join(__dirname, 'rules');
9
-
10
6
  const baseRules = {
11
7
  // Possible Errors
12
8
  'no-console': ERROR,
@@ -24,6 +20,7 @@ const baseRules = {
24
20
  'no-eval': ERROR,
25
21
  'no-extend-native': ERROR,
26
22
  'no-extra-bind': ERROR,
23
+ 'no-fallthrough': ERROR,
27
24
  'no-floating-decimal': ERROR,
28
25
  'no-implicit-coercion': ERROR,
29
26
  'no-implied-eval': ERROR,
@@ -131,6 +128,7 @@ const baseConfig = {
131
128
  },
132
129
  rules: {
133
130
  '@typescript-eslint/array-type': [ERROR, { default: 'array-simple' }],
131
+ '@typescript-eslint/consistent-type-definitions': OFF,
134
132
  '@typescript-eslint/no-unused-expressions': ERROR,
135
133
  '@typescript-eslint/no-unused-vars': [
136
134
  ERROR,
@@ -217,17 +215,11 @@ const baseConfig = {
217
215
  {
218
216
  // Cypress config
219
217
  files: [`**/cypress/**/*.{${allExtensions}}`],
220
- // eslint-plugin-cypress doesn't support ESLint v8.
221
- // Use fork by `@finsit` until this is solved.
222
- // https://github.com/cypress-io/eslint-plugin-cypress/issues/89
223
- extends: ['plugin:@finsit/cypress/recommended'],
218
+ extends: ['plugin:cypress/recommended'],
224
219
  env: {
225
- '@finsit/cypress/globals': true,
226
- },
227
- plugins: ['@finsit/cypress', 'rulesdir'],
228
- rules: {
229
- 'rulesdir/unsafe-to-chain-command': ERROR,
220
+ 'cypress/globals': true,
230
221
  },
222
+ plugins: ['cypress'],
231
223
  },
232
224
  ],
233
225
  };
package/package.json CHANGED
@@ -1,13 +1,12 @@
1
1
  {
2
2
  "name": "eslint-config-seek",
3
- "version": "13.0.0",
3
+ "version": "13.1.0",
4
4
  "description": "ESLint configuration used by SEEK",
5
5
  "main": "index.js",
6
6
  "files": [
7
7
  "index.js",
8
8
  "base.js",
9
- "extensions.js",
10
- "rules/*"
9
+ "extensions.js"
11
10
  ],
12
11
  "repository": {
13
12
  "type": "git",
@@ -23,7 +22,7 @@
23
22
  "@babel/core": "^7.22.6",
24
23
  "@babel/eslint-parser": "^7.22.6",
25
24
  "@babel/preset-react": "^7.22.5",
26
- "@finsit/eslint-plugin-cypress": "^3.1.1",
25
+ "eslint-plugin-cypress": "^3.0.0",
27
26
  "@typescript-eslint/eslint-plugin": "^7.2.0",
28
27
  "@typescript-eslint/parser": "^7.2.0",
29
28
  "eslint-config-prettier": "^8.8.0",
@@ -32,7 +31,6 @@
32
31
  "eslint-plugin-jest": "^27.9.0",
33
32
  "eslint-plugin-react": "^7.32.2",
34
33
  "eslint-plugin-react-hooks": "^4.6.0",
35
- "eslint-plugin-rulesdir": "^0.2.2",
36
34
  "find-root": "^1.1.0"
37
35
  },
38
36
  "devDependencies": {
@@ -1,96 +0,0 @@
1
- /** This rule was copied from the original `eslint-plugin-cypress` so we can use the fork (which
2
- * supports eslint 8) while having the same recommended rules as the upstream
3
- * https://github.com/foretagsplatsen/eslint-plugin-cypress
4
- * https://github.com/cypress-io/eslint-plugin-cypress/blob/c626ad543f65babf1def5caabd1bc9bb9900d2c7/lib/rules/unsafe-to-chain-command.js
5
- */
6
- // eslint-disable-next-line strict
7
- 'use strict';
8
-
9
- /** @type {import("eslint").Rule.RuleModule} */
10
- module.exports = {
11
- meta: {
12
- type: 'problem',
13
- docs: {
14
- description: 'Actions should be at the end of chains, not in the middle',
15
- category: 'Possible Errors',
16
- recommended: true,
17
- url: 'https://docs.cypress.io/guides/core-concepts/retry-ability#Actions-should-be-at-the-end-of-chains-not-the-middle',
18
- },
19
- schema: [],
20
- fixable: 'code',
21
- messages: {
22
- unexpected:
23
- 'It is unsafe to chain further commands that rely on the subject after this command. It is best to split the chain, chaining again from `cy.` in the next command.',
24
- },
25
- },
26
- create(context) {
27
- return {
28
- CallExpression(node) {
29
- if (
30
- isRootCypress(node) &&
31
- isActionUnsafeToChain(node) &&
32
- node.parent.type === 'MemberExpression'
33
- ) {
34
- context.report({
35
- node,
36
- messageId: 'unexpected',
37
- });
38
- }
39
- },
40
- };
41
- },
42
- };
43
-
44
- /** @param {import("eslint").Rule.Node} node */
45
- function isRootCypress(node) {
46
- while (node.type === 'CallExpression') {
47
- if (node.callee.type !== 'MemberExpression') {
48
- return false;
49
- }
50
-
51
- if (
52
- node.callee.object.type === 'Identifier' &&
53
- node.callee.object.name === 'cy'
54
- ) {
55
- return true;
56
- }
57
-
58
- // eslint-disable-next-line no-param-reassign
59
- node = node.callee.object;
60
- }
61
-
62
- return false;
63
- }
64
-
65
- /** @param {import("eslint").Rule.Node} node */
66
- function isActionUnsafeToChain(node) {
67
- // commands listed in the documentation with text: 'It is unsafe to chain further commands that rely on the subject after xxx'
68
- const unsafeToChainActions = [
69
- 'blur',
70
- 'clear',
71
- 'click',
72
- 'check',
73
- 'dblclick',
74
- 'each',
75
- 'focus',
76
- 'rightclick',
77
- 'screenshot',
78
- 'scrollIntoView',
79
- 'scrollTo',
80
- 'select',
81
- 'selectFile',
82
- 'spread',
83
- 'submit',
84
- 'type',
85
- 'trigger',
86
- 'uncheck',
87
- 'within',
88
- ];
89
-
90
- return (
91
- node.callee &&
92
- node.callee.property &&
93
- node.callee.property.type === 'Identifier' &&
94
- unsafeToChainActions.includes(node.callee.property.name)
95
- );
96
- }