eslint-config-seek 0.0.0-fix-curly-braces-20231115033054 → 0.0.0-fix-naming-convention-rule-format-20250602054747
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/README.md +12 -16
- package/base.js +174 -140
- package/index.js +39 -38
- package/package.json +23 -27
- package/rules/unsafe-to-chain-command.js +0 -96
package/README.md
CHANGED
|
@@ -5,35 +5,31 @@
|
|
|
5
5
|
|
|
6
6
|
This package includes the shareable ESLint configuration used by [SEEK](https://github.com/seek-oss/).
|
|
7
7
|
|
|
8
|
-
## Usage in sku Projects
|
|
8
|
+
## Usage in sku and skuba Projects
|
|
9
9
|
|
|
10
|
-
The easiest way to use this configuration is with [sku](https://github.com/seek-oss/sku)
|
|
10
|
+
The easiest way to use this configuration is with [sku](https://github.com/seek-oss/sku) or [skuba](https://github.com/seek-oss/skuba).
|
|
11
11
|
|
|
12
|
-
**You don’t need to install it separately in sku projects.**
|
|
12
|
+
**You don’t need to install it separately in sku and skuba projects.**
|
|
13
13
|
|
|
14
|
-
## Usage Outside of sku
|
|
14
|
+
## Usage Outside of sku and skuba
|
|
15
15
|
|
|
16
|
-
If you want to use this ESLint configuration in a project not built with sku, you can install it with following steps.
|
|
16
|
+
If you want to use this ESLint configuration in a project not built with sku or skuba, you can install it with following steps.
|
|
17
17
|
|
|
18
|
-
First, install this package,
|
|
18
|
+
First, install this package, and the necessary peer dependencies listed in this project's [package.json](package.json).
|
|
19
19
|
|
|
20
|
-
Then create a file named
|
|
20
|
+
Then create a file named `eslint.config.js` with the following contents in the root folder of your project:
|
|
21
21
|
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
"extends": "seek"
|
|
25
|
-
}
|
|
22
|
+
```js
|
|
23
|
+
module.exports = require('eslint-config-seek');
|
|
26
24
|
```
|
|
27
25
|
|
|
28
26
|
The default configuration includes support for React projects. For projects that are not based on React, the "base" configuration should be used instead:
|
|
29
27
|
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
"extends": "seek/base"
|
|
33
|
-
}
|
|
28
|
+
```js
|
|
29
|
+
module.exports = require('eslint-config-seek/base');
|
|
34
30
|
```
|
|
35
31
|
|
|
36
|
-
You can override the settings from `eslint-config-seek` by editing the
|
|
32
|
+
You can override the settings from `eslint-config-seek` by editing the `eslint.config.js` file. Learn more about [configuring ESLint](https://eslint.org/docs/latest/use/configure/) on the ESLint website.
|
|
37
33
|
|
|
38
34
|
## License
|
|
39
35
|
|
package/base.js
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
1
|
+
const importX = require('eslint-plugin-import-x');
|
|
2
|
+
const globals = require('globals');
|
|
3
|
+
const jestPlugin = require('eslint-plugin-jest');
|
|
4
|
+
const cypress = require('eslint-plugin-cypress/flat');
|
|
5
|
+
const eslintConfigPrettier = require('eslint-config-prettier');
|
|
6
|
+
const tseslint = require('typescript-eslint');
|
|
3
7
|
|
|
4
8
|
const OFF = 0;
|
|
9
|
+
const WARN = 1;
|
|
5
10
|
const ERROR = 2;
|
|
6
11
|
|
|
7
|
-
const rulesDirPlugin = require('eslint-plugin-rulesdir');
|
|
8
|
-
rulesDirPlugin.RULES_DIR = path.join(__dirname, 'rules');
|
|
9
|
-
|
|
10
12
|
const baseRules = {
|
|
11
13
|
// Possible Errors
|
|
12
14
|
'no-console': ERROR,
|
|
13
15
|
'no-unexpected-multiline': ERROR,
|
|
14
16
|
'block-scoped-var': ERROR,
|
|
15
|
-
curly: [ERROR, 'all'],
|
|
16
17
|
'default-case': ERROR,
|
|
17
18
|
'dot-notation': ERROR,
|
|
18
19
|
eqeqeq: [ERROR, 'always', { null: 'ignore' }],
|
|
@@ -24,6 +25,7 @@ const baseRules = {
|
|
|
24
25
|
'no-eval': ERROR,
|
|
25
26
|
'no-extend-native': ERROR,
|
|
26
27
|
'no-extra-bind': ERROR,
|
|
28
|
+
'no-fallthrough': ERROR,
|
|
27
29
|
'no-floating-decimal': ERROR,
|
|
28
30
|
'no-implicit-coercion': ERROR,
|
|
29
31
|
'no-implied-eval': ERROR,
|
|
@@ -79,157 +81,189 @@ const baseRules = {
|
|
|
79
81
|
'no-return-await': OFF,
|
|
80
82
|
};
|
|
81
83
|
|
|
84
|
+
const eslintConfigPrettierOverrideRules = {
|
|
85
|
+
curly: [ERROR, 'all'],
|
|
86
|
+
};
|
|
87
|
+
|
|
82
88
|
const { js: jsExtensions, ts: tsExtensions } = require('./extensions');
|
|
83
89
|
const allExtensions = [...jsExtensions, ...tsExtensions];
|
|
84
90
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
parserOptions: {
|
|
89
|
-
requireConfigFile: false,
|
|
90
|
-
sourceType: 'module',
|
|
91
|
-
},
|
|
92
|
-
root: true,
|
|
93
|
-
env: {
|
|
91
|
+
const settings = {
|
|
92
|
+
'import-x/resolver': {
|
|
93
|
+
typescript: true,
|
|
94
94
|
node: true,
|
|
95
95
|
},
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
...baseRules,
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
module.exports = [
|
|
99
|
+
{
|
|
100
|
+
plugins: {
|
|
101
|
+
jest: jestPlugin,
|
|
102
|
+
cypress,
|
|
103
|
+
'@typescript-eslint': tseslint.plugin,
|
|
104
|
+
},
|
|
106
105
|
},
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
106
|
+
importX.flatConfigs.typescript,
|
|
107
|
+
{
|
|
108
|
+
rules: importX.flatConfigs.errors.rules,
|
|
109
|
+
files: [`**/*.{${jsExtensions}}`],
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
rules: importX.flatConfigs.warnings.rules,
|
|
113
|
+
files: [`**/*.{${jsExtensions}}`],
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
languageOptions: {
|
|
117
|
+
globals: {
|
|
118
|
+
...globals.node,
|
|
119
|
+
},
|
|
120
|
+
|
|
112
121
|
parserOptions: {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
ecmaVersion: 2022,
|
|
116
|
-
project: true,
|
|
122
|
+
requireConfigFile: false,
|
|
123
|
+
ecmaVersion: 'latest',
|
|
117
124
|
sourceType: 'module',
|
|
118
|
-
warnOnUnsupportedTypeScriptVersion: false,
|
|
119
125
|
},
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
typescript: {},
|
|
130
|
-
},
|
|
126
|
+
},
|
|
127
|
+
settings,
|
|
128
|
+
rules: baseRules,
|
|
129
|
+
},
|
|
130
|
+
eslintConfigPrettier,
|
|
131
|
+
{
|
|
132
|
+
languageOptions: {
|
|
133
|
+
globals: {
|
|
134
|
+
...globals.node,
|
|
131
135
|
},
|
|
132
|
-
rules: {
|
|
133
|
-
'@typescript-eslint/array-type': [ERROR, { default: 'array-simple' }],
|
|
134
|
-
'@typescript-eslint/no-unused-expressions': ERROR,
|
|
135
|
-
'@typescript-eslint/no-unused-vars': [
|
|
136
|
-
ERROR,
|
|
137
|
-
{ argsIgnorePattern: '^_', ignoreRestSiblings: true },
|
|
138
|
-
],
|
|
139
|
-
'@typescript-eslint/no-use-before-define': OFF,
|
|
140
|
-
'@typescript-eslint/no-non-null-assertion': OFF,
|
|
141
|
-
'@typescript-eslint/ban-ts-comment': OFF,
|
|
142
|
-
'@typescript-eslint/no-explicit-any': OFF,
|
|
143
|
-
'@typescript-eslint/explicit-function-return-type': OFF,
|
|
144
|
-
'@typescript-eslint/no-empty-function': OFF,
|
|
145
|
-
'@typescript-eslint/no-empty-interface': OFF,
|
|
146
|
-
'@typescript-eslint/no-inferrable-types': [
|
|
147
|
-
ERROR,
|
|
148
|
-
{ ignoreParameters: true },
|
|
149
|
-
],
|
|
150
|
-
// prefer TypeScript exhaustiveness checking
|
|
151
|
-
// https://www.typescriptlang.org/docs/handbook/advanced-types.html#exhaustiveness-checking
|
|
152
|
-
'default-case': OFF,
|
|
153
|
-
'arrow-body-style': [ERROR, 'as-needed'],
|
|
154
|
-
// Use `typescript-eslint`'s no-shadow to avoid false positives with enums
|
|
155
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-shadow.md
|
|
156
|
-
'no-shadow': OFF,
|
|
157
|
-
'@typescript-eslint/no-shadow': ERROR,
|
|
158
136
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
'
|
|
162
|
-
|
|
163
|
-
{ fixStyle: 'inline-type-imports' },
|
|
164
|
-
],
|
|
165
|
-
// https://typescript-eslint.io/rules/consistent-type-exports
|
|
166
|
-
'@typescript-eslint/consistent-type-exports': [
|
|
167
|
-
ERROR,
|
|
168
|
-
{ fixMixedExportsWithInlineTypeSpecifier: true },
|
|
169
|
-
],
|
|
170
|
-
// https://typescript-eslint.io/rules/no-import-type-side-effects
|
|
171
|
-
'@typescript-eslint/no-import-type-side-effects': ERROR,
|
|
172
|
-
|
|
173
|
-
// This rule deals with merging multiple imports from the same module.
|
|
174
|
-
// In this case, we want type imports to be inlined when merging with the other imports.
|
|
175
|
-
// However, there is a pending PR which improves the behaviour of this rule https://github.com/import-js/eslint-plugin-import/pull/2716
|
|
176
|
-
// https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-duplicates.md#inline-type-imports
|
|
177
|
-
'import/no-duplicates': [ERROR, { 'prefer-inline': true }],
|
|
137
|
+
parserOptions: {
|
|
138
|
+
requireConfigFile: false,
|
|
139
|
+
ecmaVersion: 'latest',
|
|
140
|
+
sourceType: 'module',
|
|
178
141
|
},
|
|
179
142
|
},
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
143
|
+
settings,
|
|
144
|
+
rules: eslintConfigPrettierOverrideRules,
|
|
145
|
+
},
|
|
146
|
+
...[...tseslint.configs.recommended, ...tseslint.configs.stylistic].map(
|
|
147
|
+
({ plugins, ...config }) => ({
|
|
148
|
+
...config,
|
|
149
|
+
files: [`**/*.{${tsExtensions}}`],
|
|
150
|
+
}),
|
|
151
|
+
),
|
|
152
|
+
{
|
|
153
|
+
files: [`**/*.{${tsExtensions}}`],
|
|
154
|
+
|
|
155
|
+
languageOptions: {
|
|
156
|
+
parser: tseslint.parser,
|
|
157
|
+
|
|
158
|
+
parserOptions: {
|
|
159
|
+
projectService: true,
|
|
160
|
+
warnOnUnsupportedTypeScriptVersion: false,
|
|
185
161
|
},
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
162
|
+
},
|
|
163
|
+
settings,
|
|
164
|
+
rules: {
|
|
165
|
+
'@typescript-eslint/array-type': [ERROR, { default: 'array-simple' }],
|
|
166
|
+
'@typescript-eslint/consistent-type-definitions': OFF,
|
|
167
|
+
'@typescript-eslint/no-unused-expressions': ERROR,
|
|
168
|
+
'@typescript-eslint/no-unused-vars': [
|
|
169
|
+
ERROR,
|
|
170
|
+
{ argsIgnorePattern: '^_', ignoreRestSiblings: true },
|
|
171
|
+
],
|
|
172
|
+
'@typescript-eslint/no-use-before-define': OFF,
|
|
173
|
+
'@typescript-eslint/no-non-null-assertion': OFF,
|
|
174
|
+
'@typescript-eslint/ban-ts-comment': OFF,
|
|
175
|
+
'@typescript-eslint/no-explicit-any': OFF,
|
|
176
|
+
'@typescript-eslint/explicit-function-return-type': OFF,
|
|
177
|
+
'@typescript-eslint/naming-convention': [
|
|
178
|
+
// TODO - upgrade to ERROR in next major version
|
|
179
|
+
WARN,
|
|
180
|
+
{
|
|
181
|
+
selector: 'typeLike',
|
|
182
|
+
format: ['PascalCase'],
|
|
183
|
+
leadingUnderscore: 'allow',
|
|
192
184
|
},
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
185
|
+
// 'typeLike' includes enums
|
|
186
|
+
// This selector opts out of the rule for enums
|
|
187
|
+
{
|
|
188
|
+
selector: 'enum',
|
|
189
|
+
format: [],
|
|
190
|
+
},
|
|
191
|
+
],
|
|
192
|
+
'@typescript-eslint/no-empty-function': OFF,
|
|
193
|
+
'@typescript-eslint/no-empty-interface': OFF,
|
|
194
|
+
'@typescript-eslint/no-inferrable-types': [
|
|
195
|
+
ERROR,
|
|
196
|
+
{ ignoreParameters: true },
|
|
197
|
+
],
|
|
198
|
+
// prefer TypeScript exhaustiveness checking
|
|
199
|
+
// https://www.typescriptlang.org/docs/handbook/advanced-types.html#exhaustiveness-checking
|
|
200
|
+
'default-case': OFF,
|
|
201
|
+
'arrow-body-style': [ERROR, 'as-needed'],
|
|
202
|
+
// Use `typescript-eslint`'s no-shadow to avoid false positives with enums
|
|
203
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-shadow.md
|
|
204
|
+
'no-shadow': OFF,
|
|
205
|
+
'@typescript-eslint/no-shadow': ERROR,
|
|
206
|
+
|
|
207
|
+
// These two rules deal with autofixing type imports/exports
|
|
208
|
+
// https://typescript-eslint.io/rules/consistent-type-imports
|
|
209
|
+
'@typescript-eslint/consistent-type-imports': [
|
|
210
|
+
ERROR,
|
|
211
|
+
{ fixStyle: 'inline-type-imports' },
|
|
212
|
+
],
|
|
213
|
+
// https://typescript-eslint.io/rules/consistent-type-exports
|
|
214
|
+
'@typescript-eslint/consistent-type-exports': [
|
|
215
|
+
ERROR,
|
|
216
|
+
{ fixMixedExportsWithInlineTypeSpecifier: true },
|
|
217
|
+
],
|
|
218
|
+
// https://typescript-eslint.io/rules/no-import-type-side-effects
|
|
219
|
+
'@typescript-eslint/no-import-type-side-effects': ERROR,
|
|
220
|
+
|
|
221
|
+
// This rule deals with merging multiple imports from the same module.
|
|
222
|
+
// In this case, we want type imports to be inlined when merging with the other imports.
|
|
223
|
+
// However, there is a pending PR which improves the behaviour of this rule https://github.com/import-js/eslint-plugin-import/pull/2716
|
|
224
|
+
// https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-duplicates.md#inline-type-imports
|
|
225
|
+
'import-x/no-duplicates': [ERROR, { 'prefer-inline': true }],
|
|
226
|
+
'import-x/export': ERROR,
|
|
227
|
+
},
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
files: [`**/*.{${jsExtensions}}`],
|
|
231
|
+
languageOptions: {
|
|
232
|
+
globals: {},
|
|
204
233
|
},
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
234
|
+
settings,
|
|
235
|
+
rules: {
|
|
236
|
+
'no-undef': ERROR,
|
|
237
|
+
'no-use-before-define': [ERROR, { functions: false }],
|
|
238
|
+
'no-unused-expressions': ERROR,
|
|
239
|
+
'import-x/no-unresolved': [
|
|
240
|
+
ERROR,
|
|
241
|
+
{ commonjs: true, amd: true, ignore: ['.svg$', '^file?'] },
|
|
210
242
|
],
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
},
|
|
214
|
-
extends: ['plugin:jest/recommended'],
|
|
215
|
-
plugins: ['jest'],
|
|
243
|
+
'import-x/no-duplicates': ERROR,
|
|
244
|
+
'import-x/export': ERROR,
|
|
216
245
|
},
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
...jestPlugin.configs['flat/recommended'],
|
|
249
|
+
files: [
|
|
250
|
+
`**/__tests__/**/*.{${allExtensions}}`,
|
|
251
|
+
`**/*.@(spec|test).{${allExtensions}}`,
|
|
252
|
+
],
|
|
253
|
+
},
|
|
254
|
+
{
|
|
255
|
+
files: [
|
|
256
|
+
`**/__tests__/**/*.{${allExtensions}}`,
|
|
257
|
+
`**/*.@(spec|test).{${allExtensions}}`,
|
|
258
|
+
],
|
|
259
|
+
languageOptions: {
|
|
260
|
+
globals: {
|
|
261
|
+
...globals.jest,
|
|
230
262
|
},
|
|
231
263
|
},
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
264
|
+
},
|
|
265
|
+
{
|
|
266
|
+
...cypress.configs.recommended,
|
|
267
|
+
files: [`**/cypress/**/*.{${allExtensions}}`],
|
|
268
|
+
},
|
|
269
|
+
];
|
package/index.js
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
const react = require('eslint-plugin-react');
|
|
2
|
+
const reactHooks = require('eslint-plugin-react-hooks');
|
|
3
|
+
const base = require('./base');
|
|
4
|
+
|
|
5
|
+
const globals = require('globals');
|
|
6
|
+
|
|
1
7
|
const OFF = 0;
|
|
2
8
|
const ERROR = 2;
|
|
3
9
|
|
|
@@ -16,46 +22,41 @@ const reactRules = {
|
|
|
16
22
|
],
|
|
17
23
|
};
|
|
18
24
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
module.exports = [
|
|
26
|
+
react.configs.flat.recommended,
|
|
27
|
+
react.configs.flat['jsx-runtime'],
|
|
28
|
+
...base,
|
|
29
|
+
{
|
|
30
|
+
plugins: {
|
|
31
|
+
react,
|
|
32
|
+
'react-hooks': reactHooks,
|
|
27
33
|
},
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
'plugin:react/recommended',
|
|
32
|
-
'plugin:react/jsx-runtime',
|
|
33
|
-
'./base.js',
|
|
34
|
-
],
|
|
35
|
-
parserOptions: {
|
|
36
|
-
babelOptions: {
|
|
37
|
-
presets: [require.resolve('@babel/preset-react')],
|
|
34
|
+
|
|
35
|
+
languageOptions: {
|
|
36
|
+
globals: globals.browser,
|
|
38
37
|
},
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
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
|
-
],
|
|
38
|
+
|
|
39
|
+
settings: {
|
|
40
|
+
react: {
|
|
41
|
+
version: 'detect',
|
|
56
42
|
},
|
|
57
43
|
},
|
|
58
|
-
],
|
|
59
|
-
};
|
|
60
44
|
|
|
61
|
-
|
|
45
|
+
rules: reactRules,
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
files: ['**/*.tsx'],
|
|
49
|
+
|
|
50
|
+
rules: {
|
|
51
|
+
// temporary override until everybody removes the React import
|
|
52
|
+
'@typescript-eslint/no-unused-vars': [
|
|
53
|
+
ERROR,
|
|
54
|
+
{
|
|
55
|
+
argsIgnorePattern: '^_',
|
|
56
|
+
ignoreRestSiblings: true,
|
|
57
|
+
varsIgnorePattern: '^React$',
|
|
58
|
+
},
|
|
59
|
+
],
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
];
|
package/package.json
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-config-seek",
|
|
3
|
-
"version": "0.0.0-fix-
|
|
3
|
+
"version": "0.0.0-fix-naming-convention-rule-format-20250602054747",
|
|
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",
|
|
@@ -20,39 +19,36 @@
|
|
|
20
19
|
},
|
|
21
20
|
"homepage": "https://github.com/seek-oss/eslint-config-seek#readme",
|
|
22
21
|
"dependencies": {
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"eslint-
|
|
30
|
-
"eslint-
|
|
31
|
-
"
|
|
32
|
-
"eslint-plugin-jest": "^27.2.3",
|
|
33
|
-
"eslint-plugin-react": "^7.32.2",
|
|
34
|
-
"eslint-plugin-react-hooks": "^4.6.0",
|
|
35
|
-
"eslint-plugin-rulesdir": "^0.2.2",
|
|
36
|
-
"find-root": "^1.1.0"
|
|
22
|
+
"typescript-eslint": "^8.6.0",
|
|
23
|
+
"eslint-config-prettier": "^10.0.0",
|
|
24
|
+
"eslint-import-resolver-typescript": "^4.0.0",
|
|
25
|
+
"eslint-plugin-cypress": "^4.0.0",
|
|
26
|
+
"eslint-plugin-import-x": "^4.9.0",
|
|
27
|
+
"eslint-plugin-jest": "^28.8.0",
|
|
28
|
+
"eslint-plugin-react": "^7.35.0",
|
|
29
|
+
"eslint-plugin-react-hooks": "^5.0.0",
|
|
30
|
+
"globals": "^16.0.0"
|
|
37
31
|
},
|
|
38
32
|
"devDependencies": {
|
|
39
|
-
"@changesets/cli": "^2.
|
|
40
|
-
"@changesets/get-github-info": "^0.
|
|
41
|
-
"eslint": "^8.
|
|
42
|
-
"prettier": "^
|
|
43
|
-
"typescript": "~5.
|
|
33
|
+
"@changesets/cli": "^2.27.7",
|
|
34
|
+
"@changesets/get-github-info": "^0.6.0",
|
|
35
|
+
"eslint": "^9.8.0",
|
|
36
|
+
"prettier": "^3.3.3",
|
|
37
|
+
"typescript": "~5.8.0"
|
|
44
38
|
},
|
|
45
39
|
"peerDependencies": {
|
|
46
|
-
"eslint": ">=
|
|
47
|
-
"typescript": ">=
|
|
40
|
+
"eslint": ">=9.9.1",
|
|
41
|
+
"typescript": ">=5.5.4"
|
|
42
|
+
},
|
|
43
|
+
"engines": {
|
|
44
|
+
"node": ">=18.18.0"
|
|
48
45
|
},
|
|
49
|
-
"packageManager": "pnpm@8.6.6",
|
|
50
46
|
"volta": {
|
|
51
|
-
"node": "
|
|
47
|
+
"node": "22.15.1"
|
|
52
48
|
},
|
|
53
49
|
"scripts": {
|
|
54
50
|
"release": "changeset publish",
|
|
55
|
-
"test": "eslint . && eslint --config base.js .",
|
|
51
|
+
"test": "eslint --config index.js . && eslint --config base.js .",
|
|
56
52
|
"changeset-version": "changeset version && prettier --write ."
|
|
57
53
|
}
|
|
58
54
|
}
|
|
@@ -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
|
-
}
|