eslint-config-seek 0.0.0-cypress-fork-20230525013212 → 0.0.0-pr-136-20240313053421

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
@@ -4,6 +4,9 @@ const root = require('find-root')(process.cwd());
4
4
  const OFF = 0;
5
5
  const ERROR = 2;
6
6
 
7
+ const rulesDirPlugin = require('eslint-plugin-rulesdir');
8
+ rulesDirPlugin.RULES_DIR = path.join(__dirname, 'rules');
9
+
7
10
  const baseRules = {
8
11
  // Possible Errors
9
12
  'no-console': ERROR,
@@ -107,13 +110,16 @@ const baseConfig = {
107
110
  files: [`**/*.{${tsExtensions}}`],
108
111
  parser: '@typescript-eslint/parser',
109
112
  parserOptions: {
110
- ecmaVersion: 2018,
111
- sourceType: 'module',
113
+ // https://github.com/typescript-eslint/typescript-eslint/issues/6544
114
+ allowAutomaticSingleRunInference: true,
115
+ ecmaVersion: 2022,
112
116
  project: true,
117
+ sourceType: 'module',
118
+ warnOnUnsupportedTypeScriptVersion: false,
113
119
  },
114
120
  extends: [
115
- 'plugin:@typescript-eslint/eslint-recommended',
116
121
  'plugin:@typescript-eslint/recommended',
122
+ 'plugin:@typescript-eslint/stylistic',
117
123
  'prettier',
118
124
  ],
119
125
  settings: {
@@ -124,6 +130,7 @@ const baseConfig = {
124
130
  },
125
131
  },
126
132
  rules: {
133
+ '@typescript-eslint/array-type': [ERROR, { default: 'array-simple' }],
127
134
  '@typescript-eslint/no-unused-expressions': ERROR,
128
135
  '@typescript-eslint/no-unused-vars': [
129
136
  ERROR,
@@ -180,7 +187,7 @@ const baseConfig = {
180
187
  settings: {
181
188
  'import/resolver': {
182
189
  node: {
183
- moduleDirectory: [root, path.join(root, 'node_modules')],
190
+ moduleDirectory: [root, 'node_modules'],
184
191
  },
185
192
  },
186
193
  },
@@ -217,9 +224,9 @@ const baseConfig = {
217
224
  env: {
218
225
  '@finsit/cypress/globals': true,
219
226
  },
220
- plugins: ['@finsit/cypress', 'eslint-plugin-local-rules'],
227
+ plugins: ['@finsit/cypress', 'rulesdir'],
221
228
  rules: {
222
- 'local-rules/unsafe-to-chain-command': ERROR,
229
+ 'rulesdir/unsafe-to-chain-command': ERROR,
223
230
  },
224
231
  },
225
232
  ],
package/index.js CHANGED
@@ -10,6 +10,10 @@ const reactRules = {
10
10
  'react/no-children-prop': ERROR,
11
11
  'react/display-name': OFF,
12
12
  'react/prop-types': OFF,
13
+ 'react/jsx-curly-brace-presence': [
14
+ ERROR,
15
+ { props: 'never', children: 'ignore', propElementValues: 'always' },
16
+ ],
13
17
  };
14
18
 
15
19
  /** @type {import('eslint').Linter.Config} */
@@ -23,7 +27,11 @@ const eslintConfig = {
23
27
  },
24
28
  },
25
29
  plugins: ['react', 'react-hooks'],
26
- extends: ['plugin:react/recommended', './base.js'],
30
+ extends: [
31
+ 'plugin:react/recommended',
32
+ 'plugin:react/jsx-runtime',
33
+ './base.js',
34
+ ],
27
35
  parserOptions: {
28
36
  babelOptions: {
29
37
  presets: [require.resolve('@babel/preset-react')],
@@ -32,6 +40,22 @@ const eslintConfig = {
32
40
  rules: {
33
41
  ...reactRules,
34
42
  },
43
+ overrides: [
44
+ {
45
+ // temporary override until everybody removes the React import
46
+ files: [`**/*.tsx`],
47
+ rules: {
48
+ '@typescript-eslint/no-unused-vars': [
49
+ ERROR,
50
+ {
51
+ argsIgnorePattern: '^_',
52
+ ignoreRestSiblings: true,
53
+ varsIgnorePattern: '^React$',
54
+ },
55
+ ],
56
+ },
57
+ },
58
+ ],
35
59
  };
36
60
 
37
61
  module.exports = eslintConfig;
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "eslint-config-seek",
3
- "version": "0.0.0-cypress-fork-20230525013212",
3
+ "version": "0.0.0-pr-136-20240313053421",
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
9
  "extensions.js",
10
- "eslint-local-rules/*"
10
+ "rules/*"
11
11
  ],
12
12
  "repository": {
13
13
  "type": "git",
@@ -20,39 +20,42 @@
20
20
  },
21
21
  "homepage": "https://github.com/seek-oss/eslint-config-seek#readme",
22
22
  "dependencies": {
23
- "@babel/core": "^7.21.0",
24
- "@babel/eslint-parser": "^7.19.1",
25
- "@babel/preset-react": "^7.18.6",
23
+ "@babel/core": "^7.22.6",
24
+ "@babel/eslint-parser": "^7.22.6",
25
+ "@babel/preset-react": "^7.22.5",
26
26
  "@finsit/eslint-plugin-cypress": "^3.1.1",
27
- "@typescript-eslint/eslint-plugin": "^5.53.0",
28
- "@typescript-eslint/parser": "^5.53.0",
29
- "eslint-config-prettier": "^8.6.0",
30
- "eslint-import-resolver-typescript": "3.5.3",
27
+ "@typescript-eslint/eslint-plugin": "^7.2.0",
28
+ "@typescript-eslint/parser": "^7.2.0",
29
+ "eslint-config-prettier": "^8.8.0",
30
+ "eslint-import-resolver-typescript": "3.5.5",
31
31
  "eslint-plugin-import": "^2.27.5",
32
- "eslint-plugin-jest": "^27.2.1",
33
- "eslint-plugin-local-rules": "^1.3.2",
32
+ "eslint-plugin-jest": "^27.9.0",
34
33
  "eslint-plugin-react": "^7.32.2",
35
34
  "eslint-plugin-react-hooks": "^4.6.0",
35
+ "eslint-plugin-rulesdir": "^0.2.2",
36
36
  "find-root": "^1.1.0"
37
37
  },
38
38
  "devDependencies": {
39
- "@changesets/cli": "^2.26.0",
39
+ "@changesets/cli": "^2.26.2",
40
40
  "@changesets/get-github-info": "^0.5.2",
41
- "eslint": "^8.34.0",
41
+ "eslint": "^8.56.0",
42
42
  "prettier": "^2.8.4",
43
- "typescript": "~4.9.5"
43
+ "typescript": "~5.4.2"
44
44
  },
45
45
  "peerDependencies": {
46
- "eslint": ">=6",
47
- "typescript": ">=4.5"
46
+ "eslint": ">=8.56.0",
47
+ "typescript": ">=4.7.5"
48
48
  },
49
- "packageManager": "pnpm@8.5.1",
49
+ "engines": {
50
+ "node": ">=18.18.0"
51
+ },
52
+ "packageManager": "pnpm@8.6.6",
50
53
  "volta": {
51
- "node": "16.19.1"
54
+ "node": "18.18.0"
52
55
  },
53
56
  "scripts": {
54
57
  "release": "changeset publish",
55
- "test": "eslint --config index.js . && eslint --config base.js .",
58
+ "test": "eslint . && eslint --config base.js .",
56
59
  "changeset-version": "changeset version && prettier --write ."
57
60
  }
58
61
  }
@@ -1,4 +1,4 @@
1
- /** This rule is copied from the original `eslint-plugin-cypress` so we can use the fork (which
1
+ /** This rule was copied from the original `eslint-plugin-cypress` so we can use the fork (which
2
2
  * supports eslint 8) while having the same recommended rules as the upstream
3
3
  * https://github.com/foretagsplatsen/eslint-plugin-cypress
4
4
  * https://github.com/cypress-io/eslint-plugin-cypress/blob/c626ad543f65babf1def5caabd1bc9bb9900d2c7/lib/rules/unsafe-to-chain-command.js
@@ -6,18 +6,21 @@
6
6
  // eslint-disable-next-line strict
7
7
  'use strict';
8
8
 
9
+ /** @type {import("eslint").Rule.RuleModule} */
9
10
  module.exports = {
10
11
  meta: {
12
+ type: 'problem',
11
13
  docs: {
12
- description: 'Actions should be in the end of chains, not in the middle',
14
+ description: 'Actions should be at the end of chains, not in the middle',
13
15
  category: 'Possible Errors',
14
16
  recommended: true,
15
17
  url: 'https://docs.cypress.io/guides/core-concepts/retry-ability#Actions-should-be-at-the-end-of-chains-not-the-middle',
16
18
  },
17
19
  schema: [],
20
+ fixable: 'code',
18
21
  messages: {
19
22
  unexpected:
20
- '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 a next command line.',
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.',
21
24
  },
22
25
  },
23
26
  create(context) {
@@ -28,13 +31,17 @@ module.exports = {
28
31
  isActionUnsafeToChain(node) &&
29
32
  node.parent.type === 'MemberExpression'
30
33
  ) {
31
- context.report({ node, messageId: 'unexpected' });
34
+ context.report({
35
+ node,
36
+ messageId: 'unexpected',
37
+ });
32
38
  }
33
39
  },
34
40
  };
35
41
  },
36
42
  };
37
43
 
44
+ /** @param {import("eslint").Rule.Node} node */
38
45
  function isRootCypress(node) {
39
46
  while (node.type === 'CallExpression') {
40
47
  if (node.callee.type !== 'MemberExpression') {
@@ -55,6 +62,7 @@ function isRootCypress(node) {
55
62
  return false;
56
63
  }
57
64
 
65
+ /** @param {import("eslint").Rule.Node} node */
58
66
  function isActionUnsafeToChain(node) {
59
67
  // commands listed in the documentation with text: 'It is unsafe to chain further commands that rely on the subject after xxx'
60
68
  const unsafeToChainActions = [
@@ -1,3 +0,0 @@
1
- module.exports = {
2
- 'unsafe-to-chain-command': require('./unsafe-to-chain-command.js'),
3
- };