@qlik/eslint-config 1.0.4 → 1.1.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 +171 -10
- package/package.json +3 -2
- package/src/configs/cjs.js +31 -24
- package/src/configs/esm.js +32 -22
- package/src/configs/jest.js +14 -11
- package/src/configs/playwright.js +12 -7
- package/src/configs/react.js +36 -20
- package/src/configs/recommended.js +19 -13
- package/src/configs/svelte.js +37 -31
- package/src/configs/vitest.js +13 -23
- package/src/index.d.ts +12 -10
- package/src/index.js +6 -4
- package/src/types/index.ts +2 -2
- package/src/utils/compose.js +13 -12
- package/src/utils/merge.js +4 -1
- package/src/configs/rules/index.js +0 -19
- package/src/configs/rules/testing-library.js +0 -74
package/README.md
CHANGED
|
@@ -37,13 +37,17 @@ export default qlik.compose(
|
|
|
37
37
|
|
|
38
38
|
### v1 notable changes
|
|
39
39
|
|
|
40
|
-
- Updates [`@typescript-eslint/typescript-eslint`](https://github.com/typescript-eslint/typescript-eslint) to v8, this brings
|
|
41
|
-
|
|
40
|
+
- Updates [`@typescript-eslint/typescript-eslint`](https://github.com/typescript-eslint/typescript-eslint) to v8, this brings
|
|
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/`.
|
|
42
44
|
- Some stylistic rules have been disabled (for example `function` vs arrow functions)
|
|
43
45
|
|
|
44
46
|
## Usage
|
|
45
47
|
|
|
46
|
-
|
|
48
|
+
The default exports configs works on both TypeScript and JavaSript out of the box. (as long as the file endings are any of `.js, .jsx, .mjs, .cjs, .ts, .tsx, .cts, .mts`).
|
|
49
|
+
The configs are eslint flat config arrays populated with configs that has appropriate file endings attached to them. Designed
|
|
50
|
+
to diminish the amount of configuration needed in an `eslint.config.js` file.
|
|
47
51
|
|
|
48
52
|
To get started, create `eslint.config.js` (if your package json has `"type": "module"`), otherwise create `eslint.config.mjs`.
|
|
49
53
|
If you are not building your project with TypeScript (using Webpack or Vite for example), then tell TypeScript to include
|
|
@@ -59,7 +63,7 @@ export default qlik.compose(
|
|
|
59
63
|
...qlik.configs.recommended, // adds linting on .js, .jsx, .mjs, .cjs, .ts, .tsx, .cts, .mts files. use for pure browser environment
|
|
60
64
|
{
|
|
61
65
|
ignores: ["dist", "npm", "node_modules"],
|
|
62
|
-
}
|
|
66
|
+
},
|
|
63
67
|
);
|
|
64
68
|
```
|
|
65
69
|
|
|
@@ -87,7 +91,7 @@ export default qlik.compose(
|
|
|
87
91
|
...qlik.configs.svelte, // based on the recommended config and adds svelte linting on .svelte files
|
|
88
92
|
{
|
|
89
93
|
ignores: ["dist", "node_modules"],
|
|
90
|
-
}
|
|
94
|
+
},
|
|
91
95
|
);
|
|
92
96
|
```
|
|
93
97
|
|
|
@@ -102,7 +106,7 @@ export default qlik.compose(
|
|
|
102
106
|
...qlik.configs.svelte,
|
|
103
107
|
{
|
|
104
108
|
ignores: ["dist", "node_modules"],
|
|
105
|
-
}
|
|
109
|
+
},
|
|
106
110
|
);
|
|
107
111
|
```
|
|
108
112
|
|
|
@@ -137,7 +141,141 @@ export default qlik.compose(
|
|
|
137
141
|
);
|
|
138
142
|
```
|
|
139
143
|
|
|
140
|
-
|
|
144
|
+
## Using the named exports configs
|
|
145
|
+
|
|
146
|
+
The different configs are also accessible through named imports. These configs can be used in specific scenarios where more
|
|
147
|
+
control of the configs are needed. The `extend` property can be used to apply a config on certain file patterns.
|
|
148
|
+
|
|
149
|
+
Example only use javascript rules with react
|
|
150
|
+
|
|
151
|
+
```js
|
|
152
|
+
import qlik, { recommendedJS, reactJS } from "@qlik/eslint-config";
|
|
153
|
+
|
|
154
|
+
export default qlik.compose(
|
|
155
|
+
reactJS,
|
|
156
|
+
)
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
with typescript support
|
|
160
|
+
|
|
161
|
+
```js
|
|
162
|
+
import qlik, { recommendedJS, reactJS } from "@qlik/eslint-config";
|
|
163
|
+
|
|
164
|
+
export default qlik.compose(
|
|
165
|
+
reactJS,
|
|
166
|
+
reactTS,
|
|
167
|
+
)
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
This is equal to:
|
|
171
|
+
|
|
172
|
+
```js
|
|
173
|
+
import qlik from "@qlik/eslint-config";
|
|
174
|
+
|
|
175
|
+
export default qlik.compose(
|
|
176
|
+
...qlik.configs.react,
|
|
177
|
+
)
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
The single configs can be useful together with the `extend` property. Below shows an example of a config
|
|
181
|
+
that wants to use lint rules for node environment on a part of the code base.
|
|
182
|
+
|
|
183
|
+
```js
|
|
184
|
+
import qlik, { esmJS } from "@qlik/eslint-config";
|
|
185
|
+
|
|
186
|
+
export default qlik.compose(
|
|
187
|
+
// apply recommended config to all files
|
|
188
|
+
...qlik.configs.recommended,
|
|
189
|
+
// set node esm config on .js files inside the tools folder
|
|
190
|
+
{
|
|
191
|
+
files: ["tools/**/*.js"],
|
|
192
|
+
extend: [esmJS],
|
|
193
|
+
},
|
|
194
|
+
)
|
|
195
|
+
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
This will take the configs in the `extend` array and perform a deep merge of whatever is defined in the object containing
|
|
199
|
+
the `extend` property with the configs in the `extend` array and return them as separate configs. The deep merge has three
|
|
200
|
+
exceptions. `files`, `ignores` and `globals` are always overwritten by the later config.
|
|
201
|
+
|
|
202
|
+
```js
|
|
203
|
+
import qlik, { esmJS } from "@qlik/eslint-config";
|
|
204
|
+
|
|
205
|
+
export default qlik.compose(
|
|
206
|
+
{
|
|
207
|
+
extend: [...qlik.configs.recommended], // contains two configs (recommendedJS and recommendedTS)
|
|
208
|
+
files: ["only_want_lint_here/**/*.js"],
|
|
209
|
+
},
|
|
210
|
+
)
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
This will result in two configs, each with the given file pattern like this:
|
|
214
|
+
|
|
215
|
+
```js
|
|
216
|
+
export default [
|
|
217
|
+
{
|
|
218
|
+
...recommendedJS config
|
|
219
|
+
files: ["only_want_lint_here/**/*.js"],
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
...recommendedTS config
|
|
223
|
+
files: ["only_want_lint_here/**/*.js"],
|
|
224
|
+
}
|
|
225
|
+
]
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
### More examples with export
|
|
229
|
+
|
|
230
|
+
One GOTCHA about the flat configs. If there's no `files` property in one of the configs in the config array it is applied
|
|
231
|
+
to every file. So in the case of turning off a rule that belongs to specific config e.g. jest or vitest. The following
|
|
232
|
+
approach does NOT work.
|
|
233
|
+
|
|
234
|
+
```js
|
|
235
|
+
// @ts-check
|
|
236
|
+
import qlik from "@qlik/eslint-config";
|
|
237
|
+
|
|
238
|
+
export default qlik.compose(
|
|
239
|
+
...qlik.configs.recommended,
|
|
240
|
+
qlik.configs.vitest, // <-- this is applied to files inside __test(s)__ folders by default for our convenience
|
|
241
|
+
{
|
|
242
|
+
rules: {
|
|
243
|
+
// I want to change this rule, but it doesn't work because it is applied to all files
|
|
244
|
+
"vitest/max-nested-describe": [
|
|
245
|
+
"error",
|
|
246
|
+
{
|
|
247
|
+
"max": 3
|
|
248
|
+
},
|
|
249
|
+
],
|
|
250
|
+
},
|
|
251
|
+
},
|
|
252
|
+
);
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
Here the `extend` feature becomes helpful
|
|
256
|
+
|
|
257
|
+
```js
|
|
258
|
+
// @ts-check
|
|
259
|
+
import qlik from "@qlik/eslint-config";
|
|
260
|
+
|
|
261
|
+
export default qlik.compose(
|
|
262
|
+
...qlik.configs.recommended,
|
|
263
|
+
{
|
|
264
|
+
extend: [qlik.configs.vitest],
|
|
265
|
+
rules: {
|
|
266
|
+
// This will add or overwrite the rule in the default config
|
|
267
|
+
"vitest/max-nested-describe": [
|
|
268
|
+
"error",
|
|
269
|
+
{
|
|
270
|
+
"max": 3
|
|
271
|
+
},
|
|
272
|
+
],
|
|
273
|
+
},
|
|
274
|
+
},
|
|
275
|
+
);
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
Example of changing the default file patterns on the vitest config.
|
|
141
279
|
|
|
142
280
|
```js
|
|
143
281
|
// @ts-check
|
|
@@ -148,7 +286,7 @@ export default qlik.compose(
|
|
|
148
286
|
{
|
|
149
287
|
// adds vitest lint rules on the specified files with an altered rule
|
|
150
288
|
files: ['**/my_tests_are_here/*.spec.ts']
|
|
151
|
-
|
|
289
|
+
extend: [qlik.configs.vitest],
|
|
152
290
|
rules: {
|
|
153
291
|
"vitest/max-nested-describe": [
|
|
154
292
|
"error",
|
|
@@ -158,10 +296,33 @@ export default qlik.compose(
|
|
|
158
296
|
]
|
|
159
297
|
}
|
|
160
298
|
},
|
|
299
|
+
);
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
This will result in a final config looking like this:
|
|
303
|
+
|
|
304
|
+
```js
|
|
305
|
+
export default [
|
|
161
306
|
{
|
|
162
|
-
|
|
307
|
+
...recommendedJS config
|
|
163
308
|
},
|
|
164
|
-
|
|
309
|
+
{
|
|
310
|
+
...recommendedTS config
|
|
311
|
+
},
|
|
312
|
+
{
|
|
313
|
+
files: ['**/my_tests_are_here/*.spec.ts'],
|
|
314
|
+
...vitest config
|
|
315
|
+
rules: {
|
|
316
|
+
... vitest config rules,
|
|
317
|
+
"vitest/max-nested-describe": [
|
|
318
|
+
"error",
|
|
319
|
+
{
|
|
320
|
+
"max": 3
|
|
321
|
+
}
|
|
322
|
+
]
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
]
|
|
165
326
|
```
|
|
166
327
|
|
|
167
328
|
<!-- prettier-ignore-end -->
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qlik/eslint-config",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "Qlik's ESLint configs",
|
|
5
5
|
"repository": "git@github.com:qlik-oss/dev-tools-js.git",
|
|
6
6
|
"license": "ISC",
|
|
@@ -58,6 +58,7 @@
|
|
|
58
58
|
"check-types": "tsc --noEmit",
|
|
59
59
|
"format:check": "prettier --check '**' --ignore-unknown",
|
|
60
60
|
"format:write": "prettier --write '**' --ignore-unknown",
|
|
61
|
-
"lint": "eslint ."
|
|
61
|
+
"lint": "eslint .",
|
|
62
|
+
"test": "vitest run && ./test/verify-configs.sh"
|
|
62
63
|
}
|
|
63
64
|
}
|
package/src/configs/cjs.js
CHANGED
|
@@ -2,47 +2,54 @@
|
|
|
2
2
|
import globals from "globals";
|
|
3
3
|
import { mergeConfigs } from "../utils/config.js";
|
|
4
4
|
import { recommendedJS, recommendedTS } from "./recommended.js";
|
|
5
|
-
import
|
|
5
|
+
import nodeRules from "./rules/node.js";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* @satisfies {import("../types/index.js").ESLintFlatConfig['rules']}
|
|
9
9
|
*/
|
|
10
10
|
const cjsRules = {
|
|
11
|
+
...nodeRules,
|
|
11
12
|
// modify rules for node commonjs here
|
|
12
13
|
};
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
16
|
* @type {import("../types/index.js").ESLintFlatConfig}
|
|
16
17
|
*/
|
|
17
|
-
const cjsJS = mergeConfigs(
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
const cjsJS = mergeConfigs(
|
|
19
|
+
// base it on the recommended javascript config
|
|
20
|
+
recommendedJS,
|
|
21
|
+
// add qlik's recommended node commonjs config for javascript
|
|
22
|
+
{
|
|
23
|
+
name: "node-cjs-js",
|
|
24
|
+
files: ["**/*.{js,cjs}"],
|
|
25
|
+
languageOptions: {
|
|
26
|
+
globals: globals.node,
|
|
27
|
+
sourceType: "commonjs",
|
|
28
|
+
},
|
|
29
|
+
rules: cjsRules,
|
|
23
30
|
},
|
|
24
|
-
|
|
25
|
-
...rules.nodeRules,
|
|
26
|
-
...cjsRules,
|
|
27
|
-
},
|
|
28
|
-
});
|
|
31
|
+
);
|
|
29
32
|
|
|
30
33
|
/**
|
|
31
34
|
* @type {import("../types/index.js").ESLintFlatConfig}
|
|
32
35
|
*/
|
|
33
|
-
const cjsTS = mergeConfigs(
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
36
|
+
const cjsTS = mergeConfigs(
|
|
37
|
+
// base it on the recommended typescript config
|
|
38
|
+
recommendedTS,
|
|
39
|
+
// add qlik's recommended node commonjs config for typescript
|
|
40
|
+
{
|
|
41
|
+
name: "node-cjs-ts",
|
|
42
|
+
files: ["**/*.{ts,cts}"],
|
|
43
|
+
languageOptions: {
|
|
44
|
+
globals: globals.node,
|
|
45
|
+
sourceType: "commonjs",
|
|
46
|
+
},
|
|
47
|
+
rules: {
|
|
48
|
+
...cjsRules,
|
|
49
|
+
// modify ts specific rules for node here
|
|
50
|
+
},
|
|
44
51
|
},
|
|
45
|
-
|
|
52
|
+
);
|
|
46
53
|
|
|
47
54
|
export default [cjsJS, cjsTS];
|
|
48
55
|
export { cjsJS, cjsTS };
|
package/src/configs/esm.js
CHANGED
|
@@ -2,45 +2,55 @@
|
|
|
2
2
|
import globals from "globals";
|
|
3
3
|
import { mergeConfigs } from "../utils/config.js";
|
|
4
4
|
import { recommendedJS, recommendedTS } from "./recommended.js";
|
|
5
|
+
import nodeRules from "./rules/node.js";
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* @satisfies {import("../types/index.js").ESLintFlatConfig["rules"]}
|
|
8
9
|
*/
|
|
9
10
|
const nodeEsmRules = {
|
|
10
|
-
|
|
11
|
+
...nodeRules,
|
|
11
12
|
"import-x/extensions": ["error", "ignorePackages"],
|
|
13
|
+
// modify rules for node esm here
|
|
12
14
|
};
|
|
13
15
|
|
|
14
16
|
/**
|
|
15
17
|
* @type {import("../types/index.js").ESLintFlatConfig}
|
|
16
18
|
*/
|
|
17
|
-
const esmJS = mergeConfigs(
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
const esmJS = mergeConfigs(
|
|
20
|
+
// base it on the recommended javascript config
|
|
21
|
+
recommendedJS,
|
|
22
|
+
// add qlik's recommended node esm config for javascript
|
|
23
|
+
{
|
|
24
|
+
name: "node-esm-js",
|
|
25
|
+
files: ["**/*.{js,mjs}"],
|
|
26
|
+
languageOptions: {
|
|
27
|
+
globals: globals.node,
|
|
28
|
+
sourceType: "module",
|
|
29
|
+
},
|
|
30
|
+
rules: nodeEsmRules,
|
|
23
31
|
},
|
|
24
|
-
|
|
25
|
-
...nodeEsmRules,
|
|
26
|
-
},
|
|
27
|
-
});
|
|
32
|
+
);
|
|
28
33
|
|
|
29
34
|
/**
|
|
30
35
|
* @type {import("../types/index.js").ESLintFlatConfig}
|
|
31
36
|
*/
|
|
32
|
-
const esmTS = mergeConfigs(
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
37
|
+
const esmTS = mergeConfigs(
|
|
38
|
+
// base it on the recommended typescript config
|
|
39
|
+
recommendedTS,
|
|
40
|
+
// add qlik's recommended node esm config for typescript
|
|
41
|
+
{
|
|
42
|
+
name: "node-esm-ts",
|
|
43
|
+
files: ["**/*.{ts,mts}"],
|
|
44
|
+
languageOptions: {
|
|
45
|
+
globals: globals.node,
|
|
46
|
+
sourceType: "module",
|
|
47
|
+
},
|
|
48
|
+
rules: {
|
|
49
|
+
...nodeEsmRules,
|
|
50
|
+
// modify typescript specific rules for node esm here if needed
|
|
51
|
+
},
|
|
42
52
|
},
|
|
43
|
-
|
|
53
|
+
);
|
|
44
54
|
|
|
45
55
|
export default [esmJS, esmTS];
|
|
46
56
|
export { esmJS, esmTS };
|
package/src/configs/jest.js
CHANGED
|
@@ -2,23 +2,26 @@
|
|
|
2
2
|
import jestPlugin from "eslint-plugin-jest";
|
|
3
3
|
import testingLibraryPlugin from "eslint-plugin-testing-library";
|
|
4
4
|
import { mergeConfigs } from "../utils/config.js";
|
|
5
|
-
import rules from "./rules/index.js";
|
|
6
5
|
|
|
7
6
|
/**
|
|
8
7
|
* @type {import("../types/index.js").ESLintFlatConfig}
|
|
9
8
|
* config for jest https://github.com/jest-community/eslint-plugin-jest
|
|
10
9
|
*/
|
|
11
|
-
const jest = mergeConfigs(
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
const jest = mergeConfigs(
|
|
11
|
+
// base it on the recommended jest config
|
|
12
|
+
jestPlugin.configs["flat/recommended"],
|
|
13
|
+
// add testing-library plugin recommended config for react
|
|
14
|
+
testingLibraryPlugin.configs["flat/react"],
|
|
15
|
+
// add qlik's recommended jest config
|
|
16
|
+
{
|
|
17
|
+
name: "jest",
|
|
18
|
+
files: ["**/__test__/**/*.{js,jsx,ts,tsx}", "**/__tests__/**/*.{js,jsx,ts,tsx}"],
|
|
19
|
+
rules: {
|
|
20
|
+
// ...testingLibraryRules,
|
|
21
|
+
// modify rules from eslint-plugin-jest here
|
|
22
|
+
},
|
|
16
23
|
},
|
|
17
|
-
|
|
18
|
-
...rules.testingLibraryRules,
|
|
19
|
-
// modify rules from eslint-plugin-jest here
|
|
20
|
-
},
|
|
21
|
-
});
|
|
24
|
+
);
|
|
22
25
|
|
|
23
26
|
export default [jest];
|
|
24
27
|
export { jest };
|
|
@@ -6,14 +6,19 @@ import { mergeConfigs } from "../utils/config.js";
|
|
|
6
6
|
* @type {import("../types/index.js").ESLintFlatConfig}
|
|
7
7
|
* config for Playwright https://github.com/playwright-community/eslint-plugin-playwright
|
|
8
8
|
*/
|
|
9
|
-
const playwright = mergeConfigs(
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
const playwright = mergeConfigs(
|
|
10
|
+
// base it on the recommended config
|
|
11
|
+
playwrightEslint.configs["flat/recommended"],
|
|
12
|
+
// add qlik's recommended playwright config
|
|
13
|
+
{
|
|
14
|
+
name: "playwright",
|
|
15
|
+
files: ["tests/**", "test/**"],
|
|
16
|
+
rules: {
|
|
17
|
+
...playwrightEslint.configs["flat/recommended"].rules,
|
|
18
|
+
// modify rules from eslint-plugin-playwright here
|
|
19
|
+
},
|
|
15
20
|
},
|
|
16
|
-
|
|
21
|
+
);
|
|
17
22
|
|
|
18
23
|
export default [playwright];
|
|
19
24
|
export { playwright };
|
package/src/configs/react.js
CHANGED
|
@@ -6,7 +6,9 @@ import eslintPluginReact from "eslint-plugin-react";
|
|
|
6
6
|
import reactHooks from "eslint-plugin-react-hooks";
|
|
7
7
|
import { mergeConfigs } from "../utils/config.js";
|
|
8
8
|
import { recommendedJS, recommendedTS } from "./recommended.js";
|
|
9
|
-
import
|
|
9
|
+
import reactA11yRules from "./rules/react-a11y.js";
|
|
10
|
+
import reactHooksRules from "./rules/react-hooks.js";
|
|
11
|
+
import reactRules from "./rules/react.js";
|
|
10
12
|
|
|
11
13
|
/** @type {any} */
|
|
12
14
|
const reactPlugin = eslintPluginReact;
|
|
@@ -14,7 +16,7 @@ const reactPlugin = eslintPluginReact;
|
|
|
14
16
|
/**
|
|
15
17
|
* @type {import("../types/index.js").ESLintFlatConfig}
|
|
16
18
|
*/
|
|
17
|
-
const
|
|
19
|
+
const reactBaseConfig = {
|
|
18
20
|
languageOptions: {
|
|
19
21
|
parserOptions: {
|
|
20
22
|
ecmaFeatures: {
|
|
@@ -36,40 +38,54 @@ const reactConfig = {
|
|
|
36
38
|
rules: {
|
|
37
39
|
// react plugin
|
|
38
40
|
...reactPlugin.configs.flat.recommended.rules,
|
|
39
|
-
...
|
|
41
|
+
...reactRules,
|
|
40
42
|
// jsx-a11y plugin
|
|
41
43
|
...jsxA11y.flatConfigs.recommended.rules,
|
|
42
|
-
...
|
|
44
|
+
...reactA11yRules,
|
|
43
45
|
...react.configs.recommended.rules,
|
|
44
46
|
// react-hooks plugin
|
|
45
47
|
...reactHooks.configs.recommended.rules,
|
|
46
|
-
...
|
|
48
|
+
...reactHooksRules,
|
|
47
49
|
},
|
|
48
50
|
};
|
|
49
51
|
|
|
50
52
|
/**
|
|
51
53
|
* @type {import("../types/index.js").ESLintFlatConfig}
|
|
52
54
|
*/
|
|
53
|
-
const reactJS = mergeConfigs(
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
55
|
+
const reactJS = mergeConfigs(
|
|
56
|
+
// base it on the recommended javascript config
|
|
57
|
+
recommendedJS,
|
|
58
|
+
// add the base react config
|
|
59
|
+
reactBaseConfig,
|
|
60
|
+
// add qlik's recommended react config for javascript
|
|
61
|
+
{
|
|
62
|
+
name: "react-js",
|
|
63
|
+
files: ["**/*.js", "**/*.jsx"],
|
|
64
|
+
rules: {
|
|
65
|
+
// turn on/off or modify js rules necessary for react
|
|
66
|
+
"react/jsx-filename-extension": [2, { extensions: [".js", ".jsx"] }],
|
|
67
|
+
},
|
|
59
68
|
},
|
|
60
|
-
|
|
69
|
+
);
|
|
61
70
|
|
|
62
71
|
/**
|
|
63
72
|
* @type {import("../types/index.js").ESLintFlatConfig}
|
|
64
73
|
*/
|
|
65
|
-
const reactTS = mergeConfigs(
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
74
|
+
const reactTS = mergeConfigs(
|
|
75
|
+
// base it on the recommended typescript config
|
|
76
|
+
recommendedTS,
|
|
77
|
+
// add the base react config
|
|
78
|
+
reactBaseConfig,
|
|
79
|
+
// add qlik's recommended react config for typescript
|
|
80
|
+
{
|
|
81
|
+
name: "react-ts",
|
|
82
|
+
files: ["**/*.ts", "**/*.tsx"],
|
|
83
|
+
rules: {
|
|
84
|
+
// turn on/off or modify js/ts rules necessary for react
|
|
85
|
+
"react/jsx-filename-extension": [2, { extensions: [".js", ".jsx", ".ts", ".tsx"] }],
|
|
86
|
+
},
|
|
71
87
|
},
|
|
72
|
-
|
|
88
|
+
);
|
|
73
89
|
|
|
74
|
-
export default [
|
|
90
|
+
export default [reactJS, reactTS];
|
|
75
91
|
export { reactJS, reactTS };
|
|
@@ -5,9 +5,15 @@ import eslintPluginImportX from "eslint-plugin-import-x";
|
|
|
5
5
|
import globals from "globals";
|
|
6
6
|
import tsconfig from "typescript-eslint";
|
|
7
7
|
import { mergeConfigs } from "../utils/config.js";
|
|
8
|
-
import
|
|
8
|
+
import eslintCoreRules from "./rules/eslint-core.js";
|
|
9
|
+
import importXRules from "./rules/import-x.js";
|
|
10
|
+
import typescriptRules from "./rules/typescript.js";
|
|
9
11
|
|
|
10
12
|
const baseConfig = mergeConfigs(
|
|
13
|
+
// basic js config
|
|
14
|
+
js.configs.recommended,
|
|
15
|
+
// import-x plugin config
|
|
16
|
+
eslintPluginImportX.flatConfigs.recommended,
|
|
11
17
|
{
|
|
12
18
|
languageOptions: {
|
|
13
19
|
globals: globals.browser,
|
|
@@ -17,13 +23,10 @@ const baseConfig = mergeConfigs(
|
|
|
17
23
|
ecmaVersion: "latest",
|
|
18
24
|
sourceType: "module",
|
|
19
25
|
},
|
|
20
|
-
},
|
|
21
|
-
js.configs.recommended,
|
|
22
|
-
eslintPluginImportX.flatConfigs.recommended,
|
|
23
|
-
{
|
|
24
26
|
rules: {
|
|
25
|
-
|
|
26
|
-
...
|
|
27
|
+
// add our recommended rules
|
|
28
|
+
...eslintCoreRules,
|
|
29
|
+
...importXRules,
|
|
27
30
|
},
|
|
28
31
|
},
|
|
29
32
|
);
|
|
@@ -35,6 +38,7 @@ const recommendedJS = mergeConfigs(
|
|
|
35
38
|
baseConfig,
|
|
36
39
|
// tsconfig.configs.base sets eslint parser to use the typescript parser to parse .js files - handles all modern syntax
|
|
37
40
|
tsconfig.configs.base,
|
|
41
|
+
// add qlik's recommended javascript config
|
|
38
42
|
{
|
|
39
43
|
name: "recommended-js",
|
|
40
44
|
files: ["**/*.js", "**/*.mjs", "**/*.cjs"],
|
|
@@ -45,8 +49,15 @@ const recommendedJS = mergeConfigs(
|
|
|
45
49
|
* @type {import("../types/index.js").ESLintFlatConfig}
|
|
46
50
|
*/
|
|
47
51
|
const recommendedTS = mergeConfigs(
|
|
52
|
+
// base it on base config
|
|
48
53
|
baseConfig,
|
|
54
|
+
// add recommended typescript config
|
|
55
|
+
...tsconfig.configs.recommended,
|
|
56
|
+
// add import-x recommended typescript config
|
|
57
|
+
eslintPluginImportX.flatConfigs.typescript,
|
|
58
|
+
// add qlik's recommended typescript config
|
|
49
59
|
{
|
|
60
|
+
name: "recommended-ts",
|
|
50
61
|
files: ["**/*.ts", "**/*.tsx", "**/*.mts", "**/*.cts", "**/*.d.ts"],
|
|
51
62
|
languageOptions: {
|
|
52
63
|
parserOptions: {
|
|
@@ -54,12 +65,7 @@ const recommendedTS = mergeConfigs(
|
|
|
54
65
|
projectService: true,
|
|
55
66
|
},
|
|
56
67
|
},
|
|
57
|
-
|
|
58
|
-
...tsconfig.configs.recommended,
|
|
59
|
-
eslintPluginImportX.flatConfigs.typescript,
|
|
60
|
-
{
|
|
61
|
-
name: "recommended-ts",
|
|
62
|
-
rules: rules.typescriptRules,
|
|
68
|
+
rules: typescriptRules,
|
|
63
69
|
},
|
|
64
70
|
);
|
|
65
71
|
|
package/src/configs/svelte.js
CHANGED
|
@@ -4,45 +4,51 @@ import svelteParser from "svelte-eslint-parser";
|
|
|
4
4
|
import tsEslint from "typescript-eslint";
|
|
5
5
|
import { mergeConfigs } from "../utils/config.js";
|
|
6
6
|
import { recommendedJS, recommendedTS } from "./recommended.js";
|
|
7
|
-
import
|
|
7
|
+
import svelteRules from "./rules/svelte.js";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* @type {import("../types/index.js").ESLintFlatConfig}
|
|
11
11
|
* config for Svelte https://github.com/sveltejs/eslint-plugin-svelte
|
|
12
12
|
*/
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
13
|
+
const svelteSvelte = mergeConfigs(
|
|
14
|
+
// base it on svelte plugin recommended config
|
|
15
|
+
...eslintPluginSvelte.configs["flat/recommended"],
|
|
16
|
+
// add qlik's recommended svelte config
|
|
17
|
+
{
|
|
18
|
+
name: "svelte",
|
|
19
|
+
files: ["**/*.svelte"],
|
|
20
|
+
languageOptions: {
|
|
21
|
+
parser: svelteParser,
|
|
22
|
+
parserOptions: {
|
|
23
|
+
parser: tsEslint.parser,
|
|
24
|
+
extraFileExtensions: [".svelte"],
|
|
25
|
+
},
|
|
21
26
|
},
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
// modify rules from eslint-plugin-svelte here
|
|
27
|
+
rules: {
|
|
28
|
+
...svelteRules,
|
|
29
|
+
// modify rules from eslint-plugin-svelte here
|
|
26
30
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
// Conflicting rules
|
|
32
|
+
// https://github.com/sveltejs/eslint-plugin-svelte3/blob/master/OTHER_PLUGINS.md
|
|
33
|
+
"import-x/first": "off",
|
|
34
|
+
"import-x/no-duplicates": "off",
|
|
35
|
+
"import-x/no-mutable-exports": "off",
|
|
36
|
+
"import-x/no-unresolved": "off",
|
|
37
|
+
"import-x/prefer-default-export": "off",
|
|
38
|
+
"import-x/extensions": "off",
|
|
35
39
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
40
|
+
// Issues with TypeScript rules
|
|
41
|
+
"@typescript-eslint/no-unsafe-call": "off",
|
|
42
|
+
"@typescript-eslint/no-unsafe-return": "off",
|
|
43
|
+
"@typescript-eslint/no-unsafe-argument": "off",
|
|
44
|
+
"@typescript-eslint/no-unsafe-assignment": "off",
|
|
45
|
+
"@typescript-eslint/no-unsafe-member-access": "off",
|
|
41
46
|
|
|
42
|
-
|
|
43
|
-
|
|
47
|
+
// Issues with function types that define parameters
|
|
48
|
+
"no-unused-vars": "off",
|
|
49
|
+
},
|
|
44
50
|
},
|
|
45
|
-
|
|
51
|
+
);
|
|
46
52
|
|
|
47
|
-
export default [recommendedJS, recommendedTS,
|
|
48
|
-
export { svelte };
|
|
53
|
+
export default [recommendedJS, recommendedTS, svelteSvelte];
|
|
54
|
+
export { svelteSvelte as svelte };
|
package/src/configs/vitest.js
CHANGED
|
@@ -1,36 +1,26 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
import vitestPlugin from "@vitest/eslint-plugin";
|
|
3
|
-
// @ts-expect-error no types yet
|
|
4
3
|
import testingLibraryPlugin from "eslint-plugin-testing-library";
|
|
5
4
|
import { mergeConfigs } from "../utils/config.js";
|
|
6
|
-
import rules from "./rules/index.js";
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* @satisfies {import("../types/index.js").ESLintFlatConfig["rules"]}
|
|
10
|
-
*/
|
|
11
|
-
const vitestCommon = {};
|
|
12
5
|
|
|
13
6
|
/**
|
|
14
7
|
* @type {import("../types/index.js").ESLintFlatConfig}
|
|
15
8
|
* config for jest https://github.com/jest-community/eslint-plugin-jest
|
|
16
9
|
*/
|
|
17
|
-
const vitest = mergeConfigs(
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
...rules.testingLibraryRules,
|
|
30
|
-
"no-magic-numbers": "off",
|
|
31
|
-
"@typescript-eslint/no-magic-numbers": "off",
|
|
10
|
+
const vitest = mergeConfigs(
|
|
11
|
+
// base it on the recommended vitest config
|
|
12
|
+
vitestPlugin.configs.recommended,
|
|
13
|
+
// add testing-library plugin recommended config for react
|
|
14
|
+
testingLibraryPlugin.configs["flat/react"],
|
|
15
|
+
// add qlik's recommended vitest config
|
|
16
|
+
{
|
|
17
|
+
name: "vitest",
|
|
18
|
+
files: ["**/__test__/**/*.{js,jsx,ts,tsx}", "**/__tests__/**/*.{js,jsx,ts,tsx}"],
|
|
19
|
+
rules: {
|
|
20
|
+
// modify rules from eslint-plugin-vitest here
|
|
21
|
+
},
|
|
32
22
|
},
|
|
33
|
-
|
|
23
|
+
);
|
|
34
24
|
|
|
35
25
|
export default [vitest];
|
|
36
26
|
export { vitest };
|
package/src/index.d.ts
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
import cjs, { cjsJS, cjsTS } from "./configs/cjs.js";
|
|
2
|
+
import esm, { esmJS, esmTS } from "./configs/esm.js";
|
|
3
|
+
import jest from "./configs/jest.js";
|
|
4
|
+
import playwright from "./configs/playwright.js";
|
|
5
|
+
import react, { reactJS, reactTS } from "./configs/react.js";
|
|
6
|
+
import recommended, { recommendedJS, recommendedTS } from "./configs/recommended.js";
|
|
7
|
+
import svelte from "./configs/svelte.js";
|
|
8
|
+
import vitest from "./configs/vitest.js";
|
|
9
|
+
import compose from "./utils/compose.js";
|
|
2
10
|
|
|
3
11
|
declare namespace qlikEslintConfig {
|
|
4
12
|
export namespace configs {
|
|
@@ -13,12 +21,6 @@ declare namespace qlikEslintConfig {
|
|
|
13
21
|
}
|
|
14
22
|
export { compose };
|
|
15
23
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
import playwright from "./configs/playwright.js";
|
|
20
|
-
import react from "./configs/react.js";
|
|
21
|
-
import recommended from "./configs/recommended.js";
|
|
22
|
-
import svelte from "./configs/svelte.js";
|
|
23
|
-
import vitest from "./configs/vitest.js";
|
|
24
|
-
import compose from "./utils/compose.js";
|
|
24
|
+
|
|
25
|
+
export default qlikEslintConfig;
|
|
26
|
+
export { cjsJS, cjsTS, esmJS, esmTS, reactJS, reactTS, recommendedJS, recommendedTS };
|
package/src/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// Import ESLint configuration modules
|
|
2
|
-
import cjs from "./configs/cjs.js";
|
|
3
|
-
import esm from "./configs/esm.js";
|
|
2
|
+
import cjs, { cjsJS, cjsTS } from "./configs/cjs.js";
|
|
3
|
+
import esm, { esmJS, esmTS } from "./configs/esm.js";
|
|
4
4
|
import jest from "./configs/jest.js";
|
|
5
5
|
import playwright from "./configs/playwright.js";
|
|
6
|
-
import react from "./configs/react.js";
|
|
7
|
-
import recommended from "./configs/recommended.js";
|
|
6
|
+
import react, { reactJS, reactTS } from "./configs/react.js";
|
|
7
|
+
import recommended, { recommendedJS, recommendedTS } from "./configs/recommended.js";
|
|
8
8
|
import svelte from "./configs/svelte.js";
|
|
9
9
|
import vitest from "./configs/vitest.js";
|
|
10
10
|
import compose from "./utils/compose.js";
|
|
@@ -27,3 +27,5 @@ const qlikEslintConfig = {
|
|
|
27
27
|
};
|
|
28
28
|
|
|
29
29
|
export default qlikEslintConfig;
|
|
30
|
+
|
|
31
|
+
export { cjsJS, cjsTS, esmJS, esmTS, reactJS, reactTS, recommendedJS, recommendedTS };
|
package/src/types/index.ts
CHANGED
|
@@ -44,9 +44,9 @@ interface ESLintFlatConfigWithExtend extends ESLintFlatConfig {
|
|
|
44
44
|
extend?: ESLintFlatConfig[];
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
type QlikEslintConfig = {
|
|
48
48
|
configs: Record<string, ESLintFlatConfig[]>;
|
|
49
49
|
compose: (...configs: ESLintFlatConfigWithExtend[]) => ESLintFlatConfig[];
|
|
50
50
|
};
|
|
51
51
|
|
|
52
|
-
export type { ESLintFlatConfig, ESLintFlatConfigWithExtend, ESLintLanguageOptions, ESLintPlugin };
|
|
52
|
+
export type { ESLintFlatConfig, ESLintFlatConfigWithExtend, ESLintLanguageOptions, ESLintPlugin, QlikEslintConfig };
|
package/src/utils/compose.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
// @ts-check
|
|
2
|
+
|
|
3
|
+
import { mergeConfigs } from "./config.js";
|
|
4
|
+
|
|
2
5
|
/**
|
|
3
6
|
* Utility function to make it easy to strictly type your "Flat" config file
|
|
4
7
|
*
|
|
@@ -7,17 +10,20 @@
|
|
|
7
10
|
*
|
|
8
11
|
* @example
|
|
9
12
|
* ```js
|
|
10
|
-
* import
|
|
11
|
-
* import tseslint from 'typescript-eslint';
|
|
13
|
+
* import qlik from "@qlik/eslint-config";
|
|
12
14
|
*
|
|
13
15
|
* export default qlik.compose(
|
|
14
|
-
*
|
|
15
|
-
* ...
|
|
16
|
+
* ...qlik.configs.react,
|
|
17
|
+
* ...qlik.configs.vitest,
|
|
16
18
|
* {
|
|
17
19
|
* rules: {
|
|
18
|
-
*
|
|
20
|
+
* // Override rules if needed
|
|
19
21
|
* },
|
|
20
22
|
* },
|
|
23
|
+
* // In its own object so it's global
|
|
24
|
+
* {
|
|
25
|
+
* ignores: ["dist", "node_modules", "script"],
|
|
26
|
+
* },
|
|
21
27
|
* );
|
|
22
28
|
* ```
|
|
23
29
|
*/
|
|
@@ -30,6 +36,7 @@ export default function compose(...configs) {
|
|
|
30
36
|
if (extendArr == null || extendArr.length === 0) {
|
|
31
37
|
return config;
|
|
32
38
|
}
|
|
39
|
+
|
|
33
40
|
const undefinedExtensions = extendArr.reduce((acc, extension, extensionIndex) => {
|
|
34
41
|
const maybeExtension = extension;
|
|
35
42
|
if (maybeExtension == null) {
|
|
@@ -49,14 +56,8 @@ export default function compose(...configs) {
|
|
|
49
56
|
return [
|
|
50
57
|
...extendArr.map((extension) => {
|
|
51
58
|
const name = [config.name, extension.name].filter(Boolean).join("__");
|
|
52
|
-
return {
|
|
53
|
-
...extension,
|
|
54
|
-
...(config.files && { files: config.files }),
|
|
55
|
-
...(config.ignores && { ignores: config.ignores }),
|
|
56
|
-
...(name && { name }),
|
|
57
|
-
};
|
|
59
|
+
return mergeConfigs(extension, config, name ? { name } : {});
|
|
58
60
|
}),
|
|
59
|
-
config,
|
|
60
61
|
];
|
|
61
62
|
});
|
|
62
63
|
}
|
package/src/utils/merge.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// these ones will only do shallow merge, but the merge function will do deep merge
|
|
2
2
|
const noNeedToDeepMerge = ["plugins", "rules", "parser"];
|
|
3
|
+
const overWrite = ["files", "globals", "ignores"];
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
*
|
|
@@ -14,7 +15,9 @@ export const merge = (obj1, obj2) => {
|
|
|
14
15
|
}
|
|
15
16
|
const merged = { ...obj1 };
|
|
16
17
|
Object.keys(obj2).forEach((key) => {
|
|
17
|
-
if (
|
|
18
|
+
if (overWrite.includes(key)) {
|
|
19
|
+
merged[key] = obj2[key];
|
|
20
|
+
} else if (Array.isArray(obj1[key]) && Array.isArray(obj2[key])) {
|
|
18
21
|
merged[key] = [...new Set([...obj1[key], ...obj2[key]])];
|
|
19
22
|
} else if (noNeedToDeepMerge.includes(key)) {
|
|
20
23
|
merged[key] = { ...obj1[key], ...obj2[key] };
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import eslintCoreRules from "./eslint-core.js";
|
|
2
|
-
import importXRules from "./import-x.js";
|
|
3
|
-
import nodeRules from "./node.js";
|
|
4
|
-
import reactA11yRules from "./react-a11y.js";
|
|
5
|
-
import reactHooksRules from "./react-hooks.js";
|
|
6
|
-
import reactRules from "./react.js";
|
|
7
|
-
import testingLibraryRules from "./testing-library.js";
|
|
8
|
-
import typescriptRules from "./typescript.js";
|
|
9
|
-
|
|
10
|
-
export default {
|
|
11
|
-
eslintCoreRules,
|
|
12
|
-
importXRules,
|
|
13
|
-
nodeRules,
|
|
14
|
-
reactRules,
|
|
15
|
-
reactA11yRules,
|
|
16
|
-
reactHooksRules,
|
|
17
|
-
testingLibraryRules,
|
|
18
|
-
typescriptRules,
|
|
19
|
-
};
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
// @ts-check
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @satisfies {import("../../types/index.js").ESLintFlatConfig["rules"]}
|
|
5
|
-
*/
|
|
6
|
-
const rules = {
|
|
7
|
-
// https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/await-async-events.md
|
|
8
|
-
"testing-library/await-async-events": ["error", { eventModule: "userEvent" }],
|
|
9
|
-
|
|
10
|
-
// https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/await-async-queries.md
|
|
11
|
-
"testing-library/await-async-queries": "error",
|
|
12
|
-
|
|
13
|
-
// https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/await-async-utils.md
|
|
14
|
-
"testing-library/await-async-utils": "error",
|
|
15
|
-
|
|
16
|
-
// https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/no-await-sync-events.md
|
|
17
|
-
"testing-library/no-await-sync-events": ["error", { eventModules: ["fire-event"] }],
|
|
18
|
-
|
|
19
|
-
// https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/no-await-sync-queries.md
|
|
20
|
-
"testing-library/no-await-sync-queries": "error",
|
|
21
|
-
|
|
22
|
-
// https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/no-container.md
|
|
23
|
-
"testing-library/no-container": "error",
|
|
24
|
-
|
|
25
|
-
// https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/no-debugging-utils.md
|
|
26
|
-
"testing-library/no-debugging-utils": "warn",
|
|
27
|
-
|
|
28
|
-
// https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/no-dom-import.md
|
|
29
|
-
"testing-library/no-dom-import": ["error", "react"],
|
|
30
|
-
|
|
31
|
-
// https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/no-global-regexp-flag-in-query.md
|
|
32
|
-
"testing-library/no-global-regexp-flag-in-query": "error",
|
|
33
|
-
|
|
34
|
-
// https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/no-manual-cleanup.md
|
|
35
|
-
"testing-library/no-manual-cleanup": "error",
|
|
36
|
-
|
|
37
|
-
// https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/no-node-access.md
|
|
38
|
-
"testing-library/no-node-access": "error",
|
|
39
|
-
|
|
40
|
-
// https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/no-promise-in-fire-event.md
|
|
41
|
-
"testing-library/no-promise-in-fire-event": "error",
|
|
42
|
-
|
|
43
|
-
// https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/no-render-in-lifecycle.md
|
|
44
|
-
"testing-library/no-render-in-lifecycle": "error",
|
|
45
|
-
|
|
46
|
-
// https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/no-unnecessary-act.md
|
|
47
|
-
"testing-library/no-unnecessary-act": "error",
|
|
48
|
-
|
|
49
|
-
// https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/no-wait-for-multiple-assertions.md
|
|
50
|
-
"testing-library/no-wait-for-multiple-assertions": "error",
|
|
51
|
-
|
|
52
|
-
// https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/no-wait-for-side-effects.md
|
|
53
|
-
"testing-library/no-wait-for-side-effects": "error",
|
|
54
|
-
|
|
55
|
-
// https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/no-wait-for-snapshot.md
|
|
56
|
-
"testing-library/no-wait-for-snapshot": "error",
|
|
57
|
-
|
|
58
|
-
// https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/prefer-find-by.md
|
|
59
|
-
"testing-library/prefer-find-by": "error",
|
|
60
|
-
|
|
61
|
-
// https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/prefer-presence-queries.md
|
|
62
|
-
"testing-library/prefer-presence-queries": "error",
|
|
63
|
-
|
|
64
|
-
// https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/prefer-query-by-disappearance.md
|
|
65
|
-
"testing-library/prefer-query-by-disappearance": "error",
|
|
66
|
-
|
|
67
|
-
// https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/prefer-screen-queries.md
|
|
68
|
-
"testing-library/prefer-screen-queries": "error",
|
|
69
|
-
|
|
70
|
-
// https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/render-result-naming-convention.md
|
|
71
|
-
"testing-library/render-result-naming-convention": "error",
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
export default rules;
|