@qlik/eslint-config 1.4.28 → 2.0.0-next.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/README.md +108 -245
- package/package.json +10 -28
- package/src/configs/esbrowser.js +0 -21
- package/src/configs/esm.js +6 -27
- package/src/configs/react.js +9 -77
- package/src/configs/shared/base.js +26 -14
- package/src/configs/shared/default-rules/eslint-core.js +441 -0
- package/src/configs/{rules → shared/default-rules}/import-x.js +5 -31
- package/src/configs/{rules → shared/default-rules}/node.js +1 -1
- package/src/configs/shared/default-rules/react.js +22 -0
- package/src/configs/shared/default-rules/typescript.js +45 -0
- package/src/configs/shared/node.js +32 -28
- package/src/configs/vitest.js +1 -2
- package/src/index.d.ts +1 -21
- package/src/index.js +1 -21
- package/src/types/index.ts +5 -46
- package/src/utils/config.js +0 -3
- package/src/utils/merge.js +2 -2
- package/src/configs/jest.js +0 -27
- package/src/configs/playwright.js +0 -24
- package/src/configs/rules/eslint-core.js +0 -960
- package/src/configs/rules/react-a11y.js +0 -232
- package/src/configs/rules/react-hooks.js +0 -12
- package/src/configs/rules/react.js +0 -424
- package/src/configs/rules/svelte.js +0 -11
- package/src/configs/rules/typescript.js +0 -228
- package/src/configs/svelte.js +0 -56
- package/src/utils/compose.js +0 -63
package/README.md
CHANGED
|
@@ -2,46 +2,60 @@
|
|
|
2
2
|
# @qlik/eslint-config
|
|
3
3
|
|
|
4
4
|
Qlik's ESlint config for JavaScript/TypeScript environments with optional framework support.
|
|
5
|
+
Built for ease of use and low config. It is built on standard configs from `@eslint/js` and `typescript-eslint`
|
|
6
|
+
and their recommended configs. And it adds some extra support for `vitest` that will add lint rules for unit test
|
|
7
|
+
based on standard settings. It is built for basically zero config and will "just work" for standard projects.
|
|
5
8
|
|
|
6
|
-
## Migrating from
|
|
9
|
+
## Migrating from v1->v2 ?
|
|
7
10
|
|
|
8
|
-
|
|
9
|
-
2. Update to ESLint 9
|
|
10
|
-
3. Rename your config to `eslint.config.js` (if you have `"type": "module"` in your package json) / `eslint.config.mjs` (if otherwise)
|
|
11
|
+
Go to the [migration section](#migrating)
|
|
11
12
|
|
|
12
|
-
|
|
13
|
+
## Quick Start
|
|
14
|
+
|
|
15
|
+
Example `eslint.config.js` that uses typescript, react, vitest. Suitable for a bundler environment for react
|
|
16
|
+
development and vitest unit testing.
|
|
13
17
|
|
|
14
18
|
```js
|
|
15
19
|
// @ts-check
|
|
16
20
|
import qlik from "@qlik/eslint-config";
|
|
17
|
-
import
|
|
21
|
+
import { defineConfig } from "eslint/config";
|
|
18
22
|
|
|
19
|
-
export default
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
...pluginQuery.configs["flat/recommended"],
|
|
23
|
+
export default defineConfig(
|
|
24
|
+
qlik.configs.react,
|
|
25
|
+
qlik.configs.vitest,
|
|
23
26
|
{
|
|
24
27
|
rules: {
|
|
25
28
|
// Override rules if needed
|
|
26
29
|
},
|
|
27
30
|
},
|
|
28
|
-
//
|
|
31
|
+
// Put ignores in its own object so it's global
|
|
29
32
|
{
|
|
30
|
-
ignores: ["dist", "
|
|
33
|
+
ignores: ["dist", "script"],
|
|
31
34
|
},
|
|
32
35
|
);
|
|
33
36
|
```
|
|
34
37
|
|
|
35
|
-
|
|
36
|
-
|
|
38
|
+
Add another eslint plugin just like you would normally do.
|
|
39
|
+
|
|
40
|
+
```js
|
|
41
|
+
// @ts-check
|
|
42
|
+
import qlik from "@qlik/eslint-config";
|
|
43
|
+
import pluginQuery from "@tanstack/eslint-plugin-query";
|
|
44
|
+
import { defineConfig } from "eslint/config";
|
|
45
|
+
|
|
46
|
+
export default defineConfig([
|
|
47
|
+
qlik.configs.react,
|
|
48
|
+
qlik.configs.vitest,
|
|
49
|
+
pluginQuery.configs["flat/recommended"],
|
|
50
|
+
{
|
|
51
|
+
ignores: ["dist", "script", "my-special-no-linting.ts"],
|
|
52
|
+
},
|
|
53
|
+
]);
|
|
54
|
+
```
|
|
37
55
|
|
|
38
|
-
|
|
56
|
+
## typescript
|
|
39
57
|
|
|
40
|
-
|
|
41
|
-
a few new rules. See article for v8 <https://typescript-eslint.io/blog/announcing-typescript-eslint-v8>
|
|
42
|
-
- Moves from [`eslint-plugin-import`](https://github.com/import-js/eslint-plugin-import) to [`eslint-plugin-import-x`](https://github.com/un-ts/eslint-plugin-import-x).
|
|
43
|
-
If you reference any of the `import/` rules you'll need to replace `import/` with `import-x/`.
|
|
44
|
-
- Some stylistic rules have been disabled (for example `function` vs arrow functions)
|
|
58
|
+
When using typescript with `@qlik/eslint-config`, include all files that should be linted (e.g. `"include": [".*", "**/*"]`) in the project's `tsconfig.json` so that the files are picked up by the project service when linting.
|
|
45
59
|
|
|
46
60
|
## Usage
|
|
47
61
|
|
|
@@ -58,11 +72,12 @@ For a pure browser environment with a bundler and no specific framework use:
|
|
|
58
72
|
```js
|
|
59
73
|
// @ts-check
|
|
60
74
|
import qlik from "@qlik/eslint-config";
|
|
75
|
+
import { defineConfig } from "eslint/config";
|
|
61
76
|
|
|
62
|
-
export default
|
|
63
|
-
|
|
77
|
+
export default defineConfig(
|
|
78
|
+
qlik.configs.recommended, // adds linting on .js, .jsx, .mjs, .cjs, .ts, .tsx, .cts, .mts files. use for pure browser environment
|
|
64
79
|
{
|
|
65
|
-
ignores: ["dist"
|
|
80
|
+
ignores: ["dist"],
|
|
66
81
|
},
|
|
67
82
|
);
|
|
68
83
|
```
|
|
@@ -72,11 +87,12 @@ Using React:
|
|
|
72
87
|
```js
|
|
73
88
|
// @ts-check
|
|
74
89
|
import qlik from "@qlik/eslint-config";
|
|
90
|
+
import { defineConfig } from "eslint/config";
|
|
75
91
|
|
|
76
|
-
export default
|
|
77
|
-
|
|
92
|
+
export default defineConfig(
|
|
93
|
+
qlik.configs.react, // based on the recommended config and adds react linting on .jsx and .tsx files
|
|
78
94
|
{
|
|
79
|
-
ignores: ["dist"
|
|
95
|
+
ignores: ["dist"],
|
|
80
96
|
},
|
|
81
97
|
);
|
|
82
98
|
```
|
|
@@ -86,73 +102,67 @@ Using Pure ES modules in browser:
|
|
|
86
102
|
```js
|
|
87
103
|
// @ts-check
|
|
88
104
|
import qlik from "@qlik/eslint-config";
|
|
105
|
+
import { defineConfig } from "eslint/config";
|
|
89
106
|
|
|
90
|
-
export default
|
|
91
|
-
|
|
107
|
+
export default defineConfig(
|
|
108
|
+
qlik.configs.esbrowser, // based on the recommended config and adds specific es module rules (file endings)
|
|
92
109
|
{
|
|
93
|
-
ignores: ["dist"
|
|
110
|
+
ignores: ["dist"],
|
|
94
111
|
},
|
|
95
112
|
);
|
|
96
113
|
```
|
|
97
114
|
|
|
98
|
-
|
|
115
|
+
Node environment:
|
|
99
116
|
|
|
100
117
|
```js
|
|
101
118
|
// @ts-check
|
|
102
119
|
import qlik from "@qlik/eslint-config";
|
|
120
|
+
import { defineConfig } from "eslint/config";
|
|
103
121
|
|
|
104
|
-
export default
|
|
105
|
-
|
|
122
|
+
export default defineConfig(
|
|
123
|
+
qlik.configs.esm, // or qlik.configs.cjs for commonjs, recommended config with node environment enabled
|
|
106
124
|
{
|
|
107
|
-
ignores: ["dist"
|
|
125
|
+
ignores: ["dist"],
|
|
108
126
|
},
|
|
109
127
|
);
|
|
110
128
|
```
|
|
111
129
|
|
|
112
|
-
|
|
130
|
+
Additional configs that can be used in conjunction with the ones above:
|
|
113
131
|
|
|
114
132
|
```js
|
|
115
133
|
// @ts-check
|
|
116
134
|
import qlik from "@qlik/eslint-config";
|
|
135
|
+
import { defineConfig } from "eslint/config";
|
|
117
136
|
|
|
118
|
-
export default
|
|
119
|
-
|
|
120
|
-
|
|
137
|
+
export default defineConfig(
|
|
138
|
+
qlik.configs.recommended, // pure browser environment
|
|
139
|
+
qlik.configs.vitest, // enable vitest linting on files inside __test(s)__ folder
|
|
140
|
+
qlik.configs.playwright, // enable playwright linting on files inside ./test(s) folder.
|
|
121
141
|
{
|
|
122
|
-
ignores: ["dist"
|
|
142
|
+
ignores: ["dist"],
|
|
123
143
|
},
|
|
124
144
|
);
|
|
125
145
|
```
|
|
126
146
|
|
|
127
|
-
|
|
147
|
+
What if the playwright test files are not in the default `./test` folder?
|
|
128
148
|
|
|
129
149
|
```js
|
|
130
150
|
// @ts-check
|
|
131
151
|
import qlik from "@qlik/eslint-config";
|
|
152
|
+
import { defineConfig } from "eslint/config";
|
|
132
153
|
|
|
133
|
-
export default
|
|
134
|
-
|
|
154
|
+
export default defineConfig(
|
|
155
|
+
qlik.configs.recommended, // pure browser environment
|
|
156
|
+
qlik.configs.vitest, // enable vitest linting on files inside __test(s)__ folder
|
|
135
157
|
{
|
|
136
|
-
|
|
158
|
+
files: ["playwright/**/*.{js,jsx,ts,tsx}"], // will lint the files inside ./playwright folder with the playwright plugin
|
|
159
|
+
extends: [...qlik.configs.playwright],
|
|
137
160
|
},
|
|
138
|
-
);
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
Additional configs that can be used in conjunction with the ones above:
|
|
142
|
-
|
|
143
|
-
```js
|
|
144
|
-
// @ts-check
|
|
145
|
-
import qlik from "@qlik/eslint-config";
|
|
146
|
-
|
|
147
|
-
export default qlik.compose(
|
|
148
|
-
...qlik.configs.recommended, // pure browser environment
|
|
149
|
-
...qlik.configs.vitest, // enable vitest linting on files inside __test(s)__ folder
|
|
150
|
-
...qlik.configs.jest, // enable jest linting on files inside __test(s)__ folder, DON'T use together with vitest
|
|
151
|
-
...qlik.configs.playwright, // enable playwright linting on files inside ./test(s) folder.
|
|
152
161
|
{
|
|
153
|
-
ignores: ["dist"
|
|
162
|
+
ignores: ["dist"],
|
|
154
163
|
},
|
|
155
164
|
);
|
|
165
|
+
|
|
156
166
|
```
|
|
157
167
|
|
|
158
168
|
Example: Using React with vitest:
|
|
@@ -160,12 +170,13 @@ Example: Using React with vitest:
|
|
|
160
170
|
```js
|
|
161
171
|
// @ts-check
|
|
162
172
|
import qlik from "@qlik/eslint-config";
|
|
173
|
+
import { defineConfig } from "eslint/config";
|
|
163
174
|
|
|
164
|
-
export default
|
|
165
|
-
|
|
166
|
-
|
|
175
|
+
export default defineConfig(
|
|
176
|
+
qlik.configs.react, // based on the recommended config and adds react linting on .jsx and .tsx files
|
|
177
|
+
qlik.configs.vitest, // enable vitest linting on files inside __test(s)__ folder
|
|
167
178
|
{
|
|
168
|
-
ignores: ["dist"
|
|
179
|
+
ignores: ["dist"],
|
|
169
180
|
},
|
|
170
181
|
);
|
|
171
182
|
```
|
|
@@ -173,14 +184,15 @@ export default qlik.compose(
|
|
|
173
184
|
## Using the named exports configs
|
|
174
185
|
|
|
175
186
|
The different configs are also accessible through named imports. These configs can be used in specific scenarios where more
|
|
176
|
-
control of the configs are needed. The `
|
|
187
|
+
control of the configs are needed. The `extends` property can be used to apply a config on certain file patterns.
|
|
177
188
|
|
|
178
189
|
Example only use javascript rules with react
|
|
179
190
|
|
|
180
191
|
```js
|
|
181
|
-
import
|
|
192
|
+
import { reactJS } from "@qlik/eslint-config";
|
|
193
|
+
import { defineConfig } from "eslint/config";
|
|
182
194
|
|
|
183
|
-
export default
|
|
195
|
+
export default defineConfig(
|
|
184
196
|
reactJS,
|
|
185
197
|
)
|
|
186
198
|
```
|
|
@@ -188,222 +200,73 @@ export default qlik.compose(
|
|
|
188
200
|
with typescript support
|
|
189
201
|
|
|
190
202
|
```js
|
|
191
|
-
import
|
|
203
|
+
import { reactJS, reactTS } from "@qlik/eslint-config";
|
|
204
|
+
import { defineConfig } from "eslint/config";
|
|
192
205
|
|
|
193
|
-
export default
|
|
206
|
+
export default defineConfig([
|
|
194
207
|
reactJS,
|
|
195
208
|
reactTS,
|
|
196
|
-
)
|
|
209
|
+
])
|
|
197
210
|
```
|
|
198
211
|
|
|
199
212
|
This is equal to:
|
|
200
213
|
|
|
201
214
|
```js
|
|
202
215
|
import qlik from "@qlik/eslint-config";
|
|
216
|
+
import { defineConfig } from "eslint/config";
|
|
203
217
|
|
|
204
|
-
export default
|
|
205
|
-
|
|
206
|
-
)
|
|
207
|
-
```
|
|
208
|
-
|
|
209
|
-
Using only javascript and svelte
|
|
210
|
-
|
|
211
|
-
```js
|
|
212
|
-
import qlik, { recommendedJS, svelteJS } from "@qlik/eslint-config";
|
|
213
|
-
|
|
214
|
-
export default qlik.compose(
|
|
215
|
-
recommendedJS,
|
|
216
|
-
svelteJS,
|
|
218
|
+
export default defineConfig(
|
|
219
|
+
qlik.configs.react,
|
|
217
220
|
)
|
|
218
221
|
```
|
|
219
222
|
|
|
220
|
-
The single configs can be useful together with the `
|
|
223
|
+
The single configs can be useful together with the `extends` property. Below shows an example of a config
|
|
221
224
|
that wants to use lint rules for node environment on a part of the code base.
|
|
222
225
|
|
|
223
226
|
```js
|
|
224
|
-
import qlik, { esmJS } from "@qlik/eslint-config";
|
|
227
|
+
import qlik, { esmJS, cjsJS } from "@qlik/eslint-config";
|
|
228
|
+
import { defineConfig } from "eslint/config";
|
|
225
229
|
|
|
226
|
-
export default
|
|
230
|
+
export default defineConfig(
|
|
227
231
|
// apply recommended config to all files
|
|
228
|
-
|
|
229
|
-
// set node esm config on .js files inside the tools folder
|
|
232
|
+
qlik.configs.recommended,
|
|
230
233
|
{
|
|
231
|
-
files
|
|
232
|
-
|
|
234
|
+
// set node esm config on .mjs files inside the tools folder
|
|
235
|
+
files: ["tools/**/*.mjs"],
|
|
236
|
+
extends: [esmJS],
|
|
233
237
|
},
|
|
234
|
-
)
|
|
235
|
-
|
|
236
|
-
```
|
|
237
|
-
|
|
238
|
-
This will take the configs in the `extend` array and perform a deep merge of whatever is defined in the object containing
|
|
239
|
-
the `extend` property with the configs in the `extend` array and return them as separate configs. The deep merge has three
|
|
240
|
-
exceptions. `files`, `ignores` and `globals` are always overwritten by the later config.
|
|
241
|
-
|
|
242
|
-
```js
|
|
243
|
-
import qlik, { esmJS } from "@qlik/eslint-config";
|
|
244
|
-
|
|
245
|
-
export default qlik.compose(
|
|
246
238
|
{
|
|
247
|
-
|
|
248
|
-
files: ["
|
|
239
|
+
// set node commonJS config on .cjs files inside the tools folder
|
|
240
|
+
files: ["tools/**/*.cjs"],
|
|
241
|
+
extends: [cjsJS],
|
|
249
242
|
},
|
|
250
243
|
)
|
|
251
|
-
```
|
|
252
|
-
|
|
253
|
-
This will result in two configs, each with the given file pattern like this:
|
|
254
244
|
|
|
255
|
-
```js
|
|
256
|
-
export default [
|
|
257
|
-
{
|
|
258
|
-
...recommendedJS config
|
|
259
|
-
files: ["only_want_lint_here/**/*.js"],
|
|
260
|
-
},
|
|
261
|
-
{
|
|
262
|
-
...recommendedTS config
|
|
263
|
-
files: ["only_want_lint_here/**/*.js"],
|
|
264
|
-
}
|
|
265
|
-
]
|
|
266
245
|
```
|
|
267
246
|
|
|
268
|
-
|
|
247
|
+
## Migrating
|
|
269
248
|
|
|
270
|
-
|
|
271
|
-
approach can be problematic.
|
|
249
|
+
The biggest changes between v1 and v2 is the plugins used. Since a lot of plugins does not yet [support ESLint 10](https://github.com/eslint-config/airbnb-extended/issues/65) Some of the plugins was removed or replaced from v1.
|
|
272
250
|
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
251
|
+
- `eslint-plugin-jsx-a11y` - Removed
|
|
252
|
+
- `eslint-plugin-jest` - Removed
|
|
253
|
+
- `eslint-plugin-playwright` - Removed
|
|
254
|
+
- `eslint-plugin-svelte` - Removed
|
|
255
|
+
- `eslint-plugin-react` - Replaced with [@eslint-react/eslint-plugin](https://github.com/Rel1cx/eslint-react)
|
|
256
|
+
- `eslint-plugin-react-hooks` - Replacd with [@eslint-react/eslint-plugin](https://github.com/Rel1cx/eslint-react)
|
|
276
257
|
|
|
277
|
-
|
|
278
|
-
...qlik.configs.recommended, // <-- typescript-eslint is applied to .ts files only
|
|
279
|
-
{
|
|
280
|
-
rules: {
|
|
281
|
-
// I want to change this rule, but it is applied to all files so if I have a .js file somewhere getting linted I will get an ERROR about missing plugin.
|
|
282
|
-
"@typescript-eslint/method-signature-style": "off",
|
|
283
|
-
},
|
|
284
|
-
},
|
|
285
|
-
);
|
|
286
|
-
```
|
|
258
|
+
When migrating from v1 -> v2 do the following:
|
|
287
259
|
|
|
288
|
-
|
|
260
|
+
1. Remove the `qlik.compose` function and replace it with `defineConfig`
|
|
261
|
+
2. If you were using any of the removed plugins (e.g. eslint-plugin-jest) you will have to add it to the eslint config.
|
|
262
|
+
3. Some rules might have changed, been added or removed so you will likely get new errors/warnings that needs to be addressed
|
|
289
263
|
|
|
290
|
-
|
|
291
|
-
// @ts-check
|
|
292
|
-
import qlik from "@qlik/eslint-config";
|
|
293
|
-
|
|
294
|
-
export default qlik.compose(
|
|
295
|
-
...qlik.configs.recommended, // <-- typescript-eslint is applied to .ts files only
|
|
296
|
-
{
|
|
297
|
-
files: ["**/*.ts"]
|
|
298
|
-
rules: {
|
|
299
|
-
// typescript specific rules here
|
|
300
|
-
"@typescript-eslint/method-signature-style": "off",
|
|
301
|
-
},
|
|
302
|
-
},
|
|
303
|
-
{
|
|
304
|
-
rules: {
|
|
305
|
-
// these are fine, since they are applied to all files
|
|
306
|
-
"no-var": "off",
|
|
307
|
-
"import-x/no-unresolved": "off"
|
|
308
|
-
},
|
|
309
|
-
},
|
|
310
|
-
);
|
|
311
|
-
```
|
|
264
|
+
Example of migration:
|
|
312
265
|
|
|
313
|
-
|
|
266
|
+
old config:
|
|
314
267
|
|
|
315
268
|
```js
|
|
316
|
-
// @ts-check
|
|
317
|
-
import qlik from "@qlik/eslint-config";
|
|
318
|
-
|
|
319
|
-
export default qlik.compose(
|
|
320
|
-
...qlik.configs.recommended,
|
|
321
|
-
qlik.configs.vitest, // <-- this is applied to files inside __test(s)__ folders by default for our convenience
|
|
322
|
-
{
|
|
323
|
-
rules: {
|
|
324
|
-
// I want to change this rule, but it doesn't work because it is applied to all files
|
|
325
|
-
"vitest/max-nested-describe": [
|
|
326
|
-
"error",
|
|
327
|
-
{
|
|
328
|
-
"max": 3
|
|
329
|
-
},
|
|
330
|
-
],
|
|
331
|
-
},
|
|
332
|
-
},
|
|
333
|
-
);
|
|
334
|
-
```
|
|
335
|
-
|
|
336
|
-
Here the `extend` feature becomes helpful
|
|
337
|
-
|
|
338
|
-
```js
|
|
339
|
-
// @ts-check
|
|
340
|
-
import qlik from "@qlik/eslint-config";
|
|
341
269
|
|
|
342
|
-
export default qlik.compose(
|
|
343
|
-
...qlik.configs.recommended,
|
|
344
|
-
{
|
|
345
|
-
extend: [qlik.configs.vitest],
|
|
346
|
-
rules: {
|
|
347
|
-
// This will add or overwrite the rule in the default config
|
|
348
|
-
"vitest/max-nested-describe": [
|
|
349
|
-
"error",
|
|
350
|
-
{
|
|
351
|
-
"max": 3
|
|
352
|
-
},
|
|
353
|
-
],
|
|
354
|
-
},
|
|
355
|
-
},
|
|
356
|
-
);
|
|
357
|
-
```
|
|
358
|
-
|
|
359
|
-
Example of changing the default file patterns on the vitest config.
|
|
360
|
-
|
|
361
|
-
```js
|
|
362
|
-
// @ts-check
|
|
363
|
-
import qlik from "@qlik/eslint-config";
|
|
364
|
-
|
|
365
|
-
export default qlik.compose(
|
|
366
|
-
...qlik.configs.recommended, // pure browser environment, no framework config added
|
|
367
|
-
{
|
|
368
|
-
// adds vitest lint rules on the specified files with an altered rule
|
|
369
|
-
files: ['**/my_tests_are_here/*.spec.ts']
|
|
370
|
-
extend: [qlik.configs.vitest],
|
|
371
|
-
rules: {
|
|
372
|
-
"vitest/max-nested-describe": [
|
|
373
|
-
"error",
|
|
374
|
-
{
|
|
375
|
-
"max": 3
|
|
376
|
-
}
|
|
377
|
-
]
|
|
378
|
-
}
|
|
379
|
-
},
|
|
380
|
-
);
|
|
381
|
-
```
|
|
382
|
-
|
|
383
|
-
This will result in a final config looking like this:
|
|
384
|
-
|
|
385
|
-
```js
|
|
386
|
-
export default [
|
|
387
|
-
{
|
|
388
|
-
...recommendedJS config
|
|
389
|
-
},
|
|
390
|
-
{
|
|
391
|
-
...recommendedTS config
|
|
392
|
-
},
|
|
393
|
-
{
|
|
394
|
-
files: ['**/my_tests_are_here/*.spec.ts'],
|
|
395
|
-
...vitest config
|
|
396
|
-
rules: {
|
|
397
|
-
... vitest config rules,
|
|
398
|
-
"vitest/max-nested-describe": [
|
|
399
|
-
"error",
|
|
400
|
-
{
|
|
401
|
-
"max": 3
|
|
402
|
-
}
|
|
403
|
-
]
|
|
404
|
-
}
|
|
405
|
-
}
|
|
406
|
-
]
|
|
407
270
|
```
|
|
408
271
|
|
|
409
272
|
<!-- prettier-ignore-end -->
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qlik/eslint-config",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-next.0",
|
|
4
4
|
"description": "Qlik's ESLint configs",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"repository": "git@github.com:qlik-oss/dev-tools-js.git",
|
|
@@ -19,49 +19,31 @@
|
|
|
19
19
|
"registry": "https://registry.npmjs.org/"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@eslint/
|
|
23
|
-
"@
|
|
24
|
-
"@typescript-eslint/utils": "^8.
|
|
25
|
-
"@vitest/eslint-plugin": "^1.6.
|
|
22
|
+
"@eslint-react/eslint-plugin": "^4.2.1",
|
|
23
|
+
"@eslint/js": "^10.0.1",
|
|
24
|
+
"@typescript-eslint/utils": "^8.58.0",
|
|
25
|
+
"@vitest/eslint-plugin": "^1.6.14",
|
|
26
26
|
"confusing-browser-globals": "^1.0.11",
|
|
27
27
|
"eslint-config-prettier": "^10.1.8",
|
|
28
|
-
"eslint-import-resolver-node": "^0.3.
|
|
28
|
+
"eslint-import-resolver-node": "^0.3.10",
|
|
29
29
|
"eslint-import-resolver-typescript": "^4.4.4",
|
|
30
30
|
"eslint-plugin-import-x": "^4.16.2",
|
|
31
|
-
"eslint-plugin-jest": "^29.15.1",
|
|
32
|
-
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
33
|
-
"eslint-plugin-playwright": "^2.10.1",
|
|
34
|
-
"eslint-plugin-react": "^7.37.5",
|
|
35
|
-
"eslint-plugin-react-hooks": "^7.0.1",
|
|
36
|
-
"eslint-plugin-svelte": "^3.16.0",
|
|
37
31
|
"eslint-plugin-testing-library": "^7.16.2",
|
|
38
32
|
"globals": "^17.4.0",
|
|
39
|
-
"
|
|
40
|
-
"typescript-eslint": "^8.57.2"
|
|
33
|
+
"typescript-eslint": "^8.58.0"
|
|
41
34
|
},
|
|
42
35
|
"devDependencies": {
|
|
43
36
|
"@types/confusing-browser-globals": "^1.0.3",
|
|
44
|
-
"@types/eslint-config-prettier": "^6.11.3"
|
|
45
|
-
"@types/eslint-plugin-jsx-a11y": "^6.10.1",
|
|
46
|
-
"@types/node": "^25.5.0",
|
|
47
|
-
"eslint": "^9.39.3",
|
|
48
|
-
"prettier": "^3.8.1",
|
|
49
|
-
"typescript": "^5.9.3",
|
|
50
|
-
"vitest": "^4.1.2",
|
|
51
|
-
"@qlik/tsconfig": "^0.3.1"
|
|
37
|
+
"@types/eslint-config-prettier": "^6.11.3"
|
|
52
38
|
},
|
|
53
39
|
"peerDependencies": {
|
|
54
|
-
"eslint": "
|
|
55
|
-
"svelte": "^3.37.0 || ^4.0.0 || ^5.0.0"
|
|
40
|
+
"eslint": "9.x || 10.x"
|
|
56
41
|
},
|
|
57
42
|
"engines": {
|
|
58
|
-
"node": ">=
|
|
43
|
+
"node": ">=20"
|
|
59
44
|
},
|
|
60
45
|
"scripts": {
|
|
61
46
|
"check-types": "tsc --noEmit",
|
|
62
|
-
"format:check": "cd ../.. && oxfmt --check 'packages/eslint-config'",
|
|
63
|
-
"format:write": "cd ../.. && oxfmt 'packages/eslint-config'",
|
|
64
|
-
"lint": "eslint .",
|
|
65
47
|
"test": "vitest run && ./test/verify-configs.sh"
|
|
66
48
|
}
|
|
67
49
|
}
|
package/src/configs/esbrowser.js
CHANGED
|
@@ -5,25 +5,6 @@ import { mergeConfigs } from "../utils/config.js";
|
|
|
5
5
|
import { baseConfigJS, baseConfigTS } from "./shared/base.js";
|
|
6
6
|
import { baseCjsJS, baseCjsTS } from "./shared/node.js";
|
|
7
7
|
|
|
8
|
-
/**
|
|
9
|
-
* @satisfies {import("../types/index.js").ESLintFlatConfig["rules"]}
|
|
10
|
-
*/
|
|
11
|
-
const browserEsmRules = {
|
|
12
|
-
// modify rules for browser esm here
|
|
13
|
-
|
|
14
|
-
// Ensure consistent use of file extension within the import path
|
|
15
|
-
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/extensions.md
|
|
16
|
-
"import-x/extensions": [
|
|
17
|
-
"error",
|
|
18
|
-
"ignorePackages",
|
|
19
|
-
{
|
|
20
|
-
ts: "never",
|
|
21
|
-
mts: "never",
|
|
22
|
-
tsx: "never",
|
|
23
|
-
},
|
|
24
|
-
],
|
|
25
|
-
};
|
|
26
|
-
|
|
27
8
|
/**
|
|
28
9
|
* ESM config for javascript in browsers
|
|
29
10
|
* @type {import("../types/index.js").ESLintFlatConfig}
|
|
@@ -40,7 +21,6 @@ const esbrowserJS = mergeConfigs(
|
|
|
40
21
|
sourceType: "module",
|
|
41
22
|
},
|
|
42
23
|
rules: {
|
|
43
|
-
...browserEsmRules,
|
|
44
24
|
// modify javascript specific rules for node esm here if needed
|
|
45
25
|
},
|
|
46
26
|
},
|
|
@@ -63,7 +43,6 @@ const esbrowserTS = mergeConfigs(
|
|
|
63
43
|
sourceType: "module",
|
|
64
44
|
},
|
|
65
45
|
rules: {
|
|
66
|
-
...browserEsmRules,
|
|
67
46
|
// modify typescript specific rules for node esm here if needed
|
|
68
47
|
},
|
|
69
48
|
},
|
package/src/configs/esm.js
CHANGED
|
@@ -2,29 +2,7 @@
|
|
|
2
2
|
import prettier from "eslint-config-prettier";
|
|
3
3
|
import globals from "globals";
|
|
4
4
|
import { mergeConfigs } from "../utils/config.js";
|
|
5
|
-
import
|
|
6
|
-
import { baseConfigJS, baseConfigTS } from "./shared/base.js";
|
|
7
|
-
import { baseCjsJS, baseCjsTS } from "./shared/node.js";
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* @satisfies {import("../types/index.js").ESLintFlatConfig["rules"]}
|
|
11
|
-
*/
|
|
12
|
-
const nodeEsmRules = {
|
|
13
|
-
...nodeRules,
|
|
14
|
-
// modify rules for node esm here
|
|
15
|
-
|
|
16
|
-
// Ensure consistent use of file extension within the import path
|
|
17
|
-
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/extensions.md
|
|
18
|
-
"import-x/extensions": [
|
|
19
|
-
"error",
|
|
20
|
-
"ignorePackages",
|
|
21
|
-
{
|
|
22
|
-
ts: "never",
|
|
23
|
-
mts: "never",
|
|
24
|
-
tsx: "never",
|
|
25
|
-
},
|
|
26
|
-
],
|
|
27
|
-
};
|
|
5
|
+
import { baseCjsJS, baseCjsTS, baseEsmJS, baseEsmTS } from "./shared/node.js";
|
|
28
6
|
|
|
29
7
|
/**
|
|
30
8
|
* ESM config for javascript in node
|
|
@@ -32,7 +10,7 @@ const nodeEsmRules = {
|
|
|
32
10
|
*/
|
|
33
11
|
const esmJS = mergeConfigs(
|
|
34
12
|
// base it on the recommended javascript config
|
|
35
|
-
|
|
13
|
+
baseEsmJS,
|
|
36
14
|
// add qlik's recommended node esm config for javascript
|
|
37
15
|
{
|
|
38
16
|
name: "node-esm-js",
|
|
@@ -41,7 +19,9 @@ const esmJS = mergeConfigs(
|
|
|
41
19
|
globals: globals.node,
|
|
42
20
|
sourceType: "module",
|
|
43
21
|
},
|
|
44
|
-
rules:
|
|
22
|
+
rules: {
|
|
23
|
+
// modify javascript specific rules for node esm here if needed
|
|
24
|
+
},
|
|
45
25
|
},
|
|
46
26
|
prettier,
|
|
47
27
|
);
|
|
@@ -52,7 +32,7 @@ const esmJS = mergeConfigs(
|
|
|
52
32
|
*/
|
|
53
33
|
const esmTS = mergeConfigs(
|
|
54
34
|
// base it on the recommended typescript config
|
|
55
|
-
|
|
35
|
+
baseEsmTS,
|
|
56
36
|
// add qlik's recommended node esm config for typescript
|
|
57
37
|
{
|
|
58
38
|
name: "node-esm-ts",
|
|
@@ -62,7 +42,6 @@ const esmTS = mergeConfigs(
|
|
|
62
42
|
sourceType: "module",
|
|
63
43
|
},
|
|
64
44
|
rules: {
|
|
65
|
-
...nodeEsmRules,
|
|
66
45
|
// modify typescript specific rules for node esm here if needed
|
|
67
46
|
},
|
|
68
47
|
},
|