eslint-config-seek 13.1.1 → 14.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/README.md +12 -16
- package/base.js +145 -130
- package/index.js +40 -38
- package/package.json +19 -23
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,4 +1,9 @@
|
|
|
1
|
-
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');
|
|
5
|
+
const eslintConfigPrettier = require('eslint-config-prettier');
|
|
6
|
+
const tseslint = require('typescript-eslint');
|
|
2
7
|
|
|
3
8
|
const OFF = 0;
|
|
4
9
|
const ERROR = 2;
|
|
@@ -79,149 +84,159 @@ const baseRules = {
|
|
|
79
84
|
const { js: jsExtensions, ts: tsExtensions } = require('./extensions');
|
|
80
85
|
const allExtensions = [...jsExtensions, ...tsExtensions];
|
|
81
86
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
parserOptions: {
|
|
86
|
-
requireConfigFile: false,
|
|
87
|
-
sourceType: 'module',
|
|
88
|
-
},
|
|
89
|
-
root: true,
|
|
90
|
-
env: {
|
|
87
|
+
const settings = {
|
|
88
|
+
'import-x/resolver': {
|
|
89
|
+
typescript: true,
|
|
91
90
|
node: true,
|
|
92
91
|
},
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
module.exports = [
|
|
95
|
+
eslintConfigPrettier,
|
|
96
|
+
{
|
|
97
|
+
plugins: {
|
|
98
|
+
'import-x': importX,
|
|
99
|
+
jest: jestPlugin,
|
|
100
|
+
cypress,
|
|
101
|
+
'@typescript-eslint': tseslint.plugin,
|
|
102
|
+
},
|
|
103
103
|
},
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
104
|
+
importX.flatConfigs.typescript,
|
|
105
|
+
{
|
|
106
|
+
rules: importX.flatConfigs.errors.rules,
|
|
107
|
+
files: [`**/*.{${jsExtensions}}`],
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
rules: importX.flatConfigs.warnings.rules,
|
|
111
|
+
files: [`**/*.{${jsExtensions}}`],
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
languageOptions: {
|
|
115
|
+
globals: {
|
|
116
|
+
...globals.node,
|
|
117
|
+
},
|
|
118
|
+
|
|
109
119
|
parserOptions: {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
ecmaVersion: 2022,
|
|
113
|
-
project: true,
|
|
120
|
+
requireConfigFile: false,
|
|
121
|
+
ecmaVersion: 'latest',
|
|
114
122
|
sourceType: 'module',
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
settings,
|
|
126
|
+
rules: baseRules,
|
|
127
|
+
},
|
|
128
|
+
...[...tseslint.configs.recommended, ...tseslint.configs.stylistic].map(
|
|
129
|
+
({ plugins, ...config }) => ({
|
|
130
|
+
...config,
|
|
131
|
+
files: [`**/*.{${tsExtensions}}`],
|
|
132
|
+
}),
|
|
133
|
+
),
|
|
134
|
+
{
|
|
135
|
+
files: [`**/*.{${tsExtensions}}`],
|
|
136
|
+
|
|
137
|
+
languageOptions: {
|
|
138
|
+
parser: tseslint.parser,
|
|
139
|
+
|
|
140
|
+
parserOptions: {
|
|
141
|
+
projectService: true,
|
|
115
142
|
warnOnUnsupportedTypeScriptVersion: false,
|
|
116
143
|
},
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
144
|
+
},
|
|
145
|
+
settings,
|
|
146
|
+
rules: {
|
|
147
|
+
'@typescript-eslint/array-type': [ERROR, { default: 'array-simple' }],
|
|
148
|
+
'@typescript-eslint/consistent-type-definitions': OFF,
|
|
149
|
+
'@typescript-eslint/no-unused-expressions': ERROR,
|
|
150
|
+
'@typescript-eslint/no-unused-vars': [
|
|
151
|
+
ERROR,
|
|
152
|
+
{ argsIgnorePattern: '^_', ignoreRestSiblings: true },
|
|
121
153
|
],
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
'@typescript-eslint/explicit-function-return-type': OFF,
|
|
142
|
-
'@typescript-eslint/no-empty-function': OFF,
|
|
143
|
-
'@typescript-eslint/no-empty-interface': OFF,
|
|
144
|
-
'@typescript-eslint/no-inferrable-types': [
|
|
145
|
-
ERROR,
|
|
146
|
-
{ ignoreParameters: true },
|
|
147
|
-
],
|
|
148
|
-
// prefer TypeScript exhaustiveness checking
|
|
149
|
-
// https://www.typescriptlang.org/docs/handbook/advanced-types.html#exhaustiveness-checking
|
|
150
|
-
'default-case': OFF,
|
|
151
|
-
'arrow-body-style': [ERROR, 'as-needed'],
|
|
152
|
-
// Use `typescript-eslint`'s no-shadow to avoid false positives with enums
|
|
153
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-shadow.md
|
|
154
|
-
'no-shadow': OFF,
|
|
155
|
-
'@typescript-eslint/no-shadow': ERROR,
|
|
154
|
+
'@typescript-eslint/no-use-before-define': OFF,
|
|
155
|
+
'@typescript-eslint/no-non-null-assertion': OFF,
|
|
156
|
+
'@typescript-eslint/ban-ts-comment': OFF,
|
|
157
|
+
'@typescript-eslint/no-explicit-any': OFF,
|
|
158
|
+
'@typescript-eslint/explicit-function-return-type': OFF,
|
|
159
|
+
'@typescript-eslint/no-empty-function': OFF,
|
|
160
|
+
'@typescript-eslint/no-empty-interface': OFF,
|
|
161
|
+
'@typescript-eslint/no-inferrable-types': [
|
|
162
|
+
ERROR,
|
|
163
|
+
{ ignoreParameters: true },
|
|
164
|
+
],
|
|
165
|
+
// prefer TypeScript exhaustiveness checking
|
|
166
|
+
// https://www.typescriptlang.org/docs/handbook/advanced-types.html#exhaustiveness-checking
|
|
167
|
+
'default-case': OFF,
|
|
168
|
+
'arrow-body-style': [ERROR, 'as-needed'],
|
|
169
|
+
// Use `typescript-eslint`'s no-shadow to avoid false positives with enums
|
|
170
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-shadow.md
|
|
171
|
+
'no-shadow': OFF,
|
|
172
|
+
'@typescript-eslint/no-shadow': ERROR,
|
|
156
173
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
174
|
+
// These two rules deal with autofixing type imports/exports
|
|
175
|
+
// https://typescript-eslint.io/rules/consistent-type-imports
|
|
176
|
+
'@typescript-eslint/consistent-type-imports': [
|
|
177
|
+
ERROR,
|
|
178
|
+
{ fixStyle: 'inline-type-imports' },
|
|
179
|
+
],
|
|
180
|
+
// https://typescript-eslint.io/rules/consistent-type-exports
|
|
181
|
+
'@typescript-eslint/consistent-type-exports': [
|
|
182
|
+
ERROR,
|
|
183
|
+
{ fixMixedExportsWithInlineTypeSpecifier: true },
|
|
184
|
+
],
|
|
185
|
+
// https://typescript-eslint.io/rules/no-import-type-side-effects
|
|
186
|
+
'@typescript-eslint/no-import-type-side-effects': ERROR,
|
|
170
187
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
},
|
|
188
|
+
// This rule deals with merging multiple imports from the same module.
|
|
189
|
+
// In this case, we want type imports to be inlined when merging with the other imports.
|
|
190
|
+
// However, there is a pending PR which improves the behaviour of this rule https://github.com/import-js/eslint-plugin-import/pull/2716
|
|
191
|
+
// https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-duplicates.md#inline-type-imports
|
|
192
|
+
'import-x/no-duplicates': [ERROR, { 'prefer-inline': true }],
|
|
177
193
|
},
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
},
|
|
184
|
-
extends: ['plugin:import/errors', 'plugin:import/warnings'],
|
|
185
|
-
settings: {
|
|
186
|
-
'import/resolver': {
|
|
187
|
-
node: {
|
|
188
|
-
moduleDirectory: [root, 'node_modules'],
|
|
189
|
-
},
|
|
190
|
-
},
|
|
191
|
-
},
|
|
192
|
-
rules: {
|
|
193
|
-
'no-undef': ERROR,
|
|
194
|
-
'no-use-before-define': [ERROR, { functions: false }],
|
|
195
|
-
'no-unused-expressions': ERROR,
|
|
196
|
-
'import/no-unresolved': [
|
|
197
|
-
ERROR,
|
|
198
|
-
{ commonjs: true, amd: true, ignore: ['.svg$', '^file?'] },
|
|
199
|
-
],
|
|
200
|
-
'import/no-duplicates': ERROR,
|
|
201
|
-
},
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
files: [`**/*.{${jsExtensions}}`],
|
|
197
|
+
languageOptions: {
|
|
198
|
+
globals: {},
|
|
202
199
|
},
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
200
|
+
settings,
|
|
201
|
+
rules: {
|
|
202
|
+
'no-undef': ERROR,
|
|
203
|
+
'no-use-before-define': [ERROR, { functions: false }],
|
|
204
|
+
'no-unused-expressions': ERROR,
|
|
205
|
+
'import-x/no-unresolved': [
|
|
206
|
+
ERROR,
|
|
207
|
+
{ commonjs: true, amd: true, ignore: ['.svg$', '^file?'] },
|
|
208
208
|
],
|
|
209
|
-
|
|
210
|
-
|
|
209
|
+
'import-x/no-duplicates': ERROR,
|
|
210
|
+
},
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
...jestPlugin.configs['flat/recommended'],
|
|
214
|
+
files: [
|
|
215
|
+
`**/__tests__/**/*.{${allExtensions}}`,
|
|
216
|
+
`**/*.@(spec|test).{${allExtensions}}`,
|
|
217
|
+
],
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
files: [
|
|
221
|
+
`**/__tests__/**/*.{${allExtensions}}`,
|
|
222
|
+
`**/*.@(spec|test).{${allExtensions}}`,
|
|
223
|
+
],
|
|
224
|
+
languageOptions: {
|
|
225
|
+
globals: {
|
|
226
|
+
...globals.jest,
|
|
211
227
|
},
|
|
212
|
-
extends: ['plugin:jest/recommended'],
|
|
213
|
-
plugins: ['jest'],
|
|
214
228
|
},
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
...cypress.configs.recommended,
|
|
232
|
+
files: [`**/cypress/**/*.{${allExtensions}}`],
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
files: [`**/cypress/**/*.{${allExtensions}}`],
|
|
236
|
+
languageOptions: {
|
|
237
|
+
globals: {
|
|
238
|
+
...cypress.environments.globals.globals,
|
|
221
239
|
},
|
|
222
|
-
plugins: ['cypress'],
|
|
223
240
|
},
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
module.exports = baseConfig;
|
|
241
|
+
},
|
|
242
|
+
];
|
package/index.js
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
const react = require('eslint-plugin-react');
|
|
2
|
+
const reactHooks = require('eslint-plugin-react-hooks');
|
|
3
|
+
const base = require('./base');
|
|
4
|
+
const { fixupPluginRules } = require('@eslint/compat');
|
|
5
|
+
|
|
6
|
+
const globals = require('globals');
|
|
7
|
+
|
|
1
8
|
const OFF = 0;
|
|
2
9
|
const ERROR = 2;
|
|
3
10
|
|
|
@@ -16,46 +23,41 @@ const reactRules = {
|
|
|
16
23
|
],
|
|
17
24
|
};
|
|
18
25
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
26
|
+
module.exports = [
|
|
27
|
+
react.configs.flat.recommended,
|
|
28
|
+
react.configs.flat['jsx-runtime'],
|
|
29
|
+
...base,
|
|
30
|
+
{
|
|
31
|
+
plugins: {
|
|
32
|
+
react,
|
|
33
|
+
'react-hooks': fixupPluginRules(reactHooks),
|
|
27
34
|
},
|
|
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')],
|
|
35
|
+
|
|
36
|
+
languageOptions: {
|
|
37
|
+
globals: globals.browser,
|
|
38
38
|
},
|
|
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
|
-
],
|
|
39
|
+
|
|
40
|
+
settings: {
|
|
41
|
+
react: {
|
|
42
|
+
version: 'detect',
|
|
56
43
|
},
|
|
57
44
|
},
|
|
58
|
-
],
|
|
59
|
-
};
|
|
60
45
|
|
|
61
|
-
|
|
46
|
+
rules: reactRules,
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
files: ['**/*.tsx'],
|
|
50
|
+
|
|
51
|
+
rules: {
|
|
52
|
+
// temporary override until everybody removes the React import
|
|
53
|
+
'@typescript-eslint/no-unused-vars': [
|
|
54
|
+
ERROR,
|
|
55
|
+
{
|
|
56
|
+
argsIgnorePattern: '^_',
|
|
57
|
+
ignoreRestSiblings: true,
|
|
58
|
+
varsIgnorePattern: '^React$',
|
|
59
|
+
},
|
|
60
|
+
],
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-config-seek",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "14.0.1",
|
|
4
4
|
"description": "ESLint configuration used by SEEK",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"files": [
|
|
@@ -19,41 +19,37 @@
|
|
|
19
19
|
},
|
|
20
20
|
"homepage": "https://github.com/seek-oss/eslint-config-seek#readme",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"eslint-
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"eslint-
|
|
29
|
-
"eslint-
|
|
30
|
-
"eslint-plugin-
|
|
31
|
-
"
|
|
32
|
-
"eslint-plugin-react": "^7.32.2",
|
|
33
|
-
"eslint-plugin-react-hooks": "^4.6.0",
|
|
34
|
-
"find-root": "^1.1.0"
|
|
22
|
+
"@eslint/compat": "^1.1.1",
|
|
23
|
+
"typescript-eslint": "^8.6.0",
|
|
24
|
+
"eslint-config-prettier": "^9.1.0",
|
|
25
|
+
"eslint-import-resolver-typescript": "^3.6.3",
|
|
26
|
+
"eslint-plugin-cypress": "^3.5.0",
|
|
27
|
+
"eslint-plugin-import-x": "^4.2.1",
|
|
28
|
+
"eslint-plugin-jest": "^28.8.0",
|
|
29
|
+
"eslint-plugin-react": "^7.35.0",
|
|
30
|
+
"eslint-plugin-react-hooks": "^4.6.2",
|
|
31
|
+
"globals": "^15.9.0"
|
|
35
32
|
},
|
|
36
33
|
"devDependencies": {
|
|
37
|
-
"@changesets/cli": "^2.
|
|
38
|
-
"@changesets/get-github-info": "^0.
|
|
39
|
-
"eslint": "^8.
|
|
40
|
-
"prettier": "^
|
|
41
|
-
"typescript": "~5.4
|
|
34
|
+
"@changesets/cli": "^2.27.7",
|
|
35
|
+
"@changesets/get-github-info": "^0.6.0",
|
|
36
|
+
"eslint": "^9.8.0",
|
|
37
|
+
"prettier": "^3.3.3",
|
|
38
|
+
"typescript": "~5.5.4"
|
|
42
39
|
},
|
|
43
40
|
"peerDependencies": {
|
|
44
|
-
"eslint": ">=
|
|
45
|
-
"typescript": ">=
|
|
41
|
+
"eslint": ">=9.9.1",
|
|
42
|
+
"typescript": ">=5.5.4"
|
|
46
43
|
},
|
|
47
44
|
"engines": {
|
|
48
45
|
"node": ">=18.18.0"
|
|
49
46
|
},
|
|
50
|
-
"packageManager": "pnpm@8.6.6",
|
|
51
47
|
"volta": {
|
|
52
48
|
"node": "18.18.0"
|
|
53
49
|
},
|
|
54
50
|
"scripts": {
|
|
55
51
|
"release": "changeset publish",
|
|
56
|
-
"test": "eslint . && eslint --config base.js .",
|
|
52
|
+
"test": "eslint --config index.js . && eslint --config base.js .",
|
|
57
53
|
"changeset-version": "changeset version && prettier --write ."
|
|
58
54
|
}
|
|
59
55
|
}
|