@qlik/eslint-config 1.4.29 → 2.0.0-next.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 +122 -213
- package/package.json +6 -24
- 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 +455 -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/{rules → shared/default-rules}/typescript.js +13 -57
- 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/svelte.js +0 -56
- package/src/utils/compose.js +0 -63
package/src/configs/svelte.js
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
// @ts-check
|
|
2
|
-
import prettier from "eslint-config-prettier";
|
|
3
|
-
import eslintPluginSvelte from "eslint-plugin-svelte";
|
|
4
|
-
import svelteParser from "svelte-eslint-parser";
|
|
5
|
-
import tsEslint from "typescript-eslint";
|
|
6
|
-
import { mergeConfigs } from "../utils/config.js";
|
|
7
|
-
import { recommendedJS, recommendedTS } from "./recommended.js";
|
|
8
|
-
import svelteRules from "./rules/svelte.js";
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* @type {import("../types/index.js").ESLintFlatConfig}
|
|
12
|
-
* config for Svelte https://github.com/sveltejs/eslint-plugin-svelte
|
|
13
|
-
*/
|
|
14
|
-
const svelteJS = mergeConfigs(
|
|
15
|
-
// base it on svelte plugin recommended config
|
|
16
|
-
...eslintPluginSvelte.configs["flat/recommended"],
|
|
17
|
-
// add qlik's recommended svelte config
|
|
18
|
-
{
|
|
19
|
-
name: "svelte",
|
|
20
|
-
files: ["**/*.svelte"],
|
|
21
|
-
languageOptions: {
|
|
22
|
-
parser: svelteParser,
|
|
23
|
-
parserOptions: {
|
|
24
|
-
parser: tsEslint.parser,
|
|
25
|
-
extraFileExtensions: [".svelte"],
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
rules: {
|
|
29
|
-
...svelteRules,
|
|
30
|
-
// modify rules from eslint-plugin-svelte here
|
|
31
|
-
|
|
32
|
-
// Conflicting rules
|
|
33
|
-
// https://github.com/sveltejs/eslint-plugin-svelte3/blob/master/OTHER_PLUGINS.md
|
|
34
|
-
"import-x/first": "off",
|
|
35
|
-
"import-x/no-duplicates": "off",
|
|
36
|
-
"import-x/no-mutable-exports": "off",
|
|
37
|
-
"import-x/no-unresolved": "off",
|
|
38
|
-
"import-x/prefer-default-export": "off",
|
|
39
|
-
"import-x/extensions": "off",
|
|
40
|
-
|
|
41
|
-
// Issues with TypeScript rules
|
|
42
|
-
"@typescript-eslint/no-unsafe-call": "off",
|
|
43
|
-
"@typescript-eslint/no-unsafe-return": "off",
|
|
44
|
-
"@typescript-eslint/no-unsafe-argument": "off",
|
|
45
|
-
"@typescript-eslint/no-unsafe-assignment": "off",
|
|
46
|
-
"@typescript-eslint/no-unsafe-member-access": "off",
|
|
47
|
-
|
|
48
|
-
// Issues with function types that define parameters
|
|
49
|
-
"no-unused-vars": "off",
|
|
50
|
-
},
|
|
51
|
-
},
|
|
52
|
-
prettier,
|
|
53
|
-
);
|
|
54
|
-
|
|
55
|
-
export default [recommendedJS, recommendedTS, svelteJS];
|
|
56
|
-
export { svelteJS };
|
package/src/utils/compose.js
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
// @ts-check
|
|
2
|
-
|
|
3
|
-
import { mergeConfigs } from "./config.js";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Utility function to make it easy to strictly type your "Flat" config file
|
|
7
|
-
*
|
|
8
|
-
* @param {...(import("../types/index.js").ESLintFlatConfigWithExtend)} configs
|
|
9
|
-
* @returns {import("../types/index.js").ESLintFlatConfig[]}
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* ```js
|
|
13
|
-
* import qlik from "@qlik/eslint-config";
|
|
14
|
-
*
|
|
15
|
-
* export default qlik.compose(
|
|
16
|
-
* ...qlik.configs.react,
|
|
17
|
-
* ...qlik.configs.vitest,
|
|
18
|
-
* {
|
|
19
|
-
* rules: {
|
|
20
|
-
* // Override rules if needed
|
|
21
|
-
* },
|
|
22
|
-
* },
|
|
23
|
-
* // In its own object so it's global
|
|
24
|
-
* {
|
|
25
|
-
* ignores: ["dist", "node_modules", "script"],
|
|
26
|
-
* },
|
|
27
|
-
* );
|
|
28
|
-
* ```
|
|
29
|
-
*/
|
|
30
|
-
export default function compose(...configs) {
|
|
31
|
-
return configs.flatMap((configWithExtends, configIndex) => {
|
|
32
|
-
const { extend: extendArr, ...config } = configWithExtends;
|
|
33
|
-
if (extendArr && !Array.isArray(extendArr)) {
|
|
34
|
-
throw new Error("extend property must be an array");
|
|
35
|
-
}
|
|
36
|
-
if (extendArr == null || extendArr.length === 0) {
|
|
37
|
-
return config;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
const undefinedExtensions = extendArr.reduce((acc, extension, extensionIndex) => {
|
|
41
|
-
const maybeExtension = extension;
|
|
42
|
-
if (maybeExtension == null) {
|
|
43
|
-
acc.push(extensionIndex);
|
|
44
|
-
}
|
|
45
|
-
return acc;
|
|
46
|
-
}, /** @type {number[]} */ ([]));
|
|
47
|
-
if (undefinedExtensions.length) {
|
|
48
|
-
const configName = configWithExtends.name != null ? `, named "${configWithExtends.name}",` : " (anonymous)";
|
|
49
|
-
const extensionIndices = undefinedExtensions.join(", ");
|
|
50
|
-
throw new Error(
|
|
51
|
-
`Your config at index ${configIndex}${configName} contains undefined` +
|
|
52
|
-
` extensions at the following indices: ${extensionIndices}.`,
|
|
53
|
-
);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
return [
|
|
57
|
-
...extendArr.map((extension) => {
|
|
58
|
-
const name = [config.name, extension.name].filter(Boolean).join("__");
|
|
59
|
-
return mergeConfigs(extension, config, name ? { name } : {});
|
|
60
|
-
}),
|
|
61
|
-
];
|
|
62
|
-
});
|
|
63
|
-
}
|