@ethang/eslint-config 24.0.1 → 24.0.2
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/build.ts +48 -0
- package/dist/config.html.js +2 -0
- package/dist/config.html.js.map +1 -0
- package/dist/eslint.config.d.ts +4 -0
- package/dist/eslint.config.js +2 -0
- package/dist/package.json +67 -0
- package/eslint.config.js +28 -2
- package/package.json +1 -1
- package/src/README.md +132 -0
- package/src/build/create-config-file.ts +70 -0
- package/src/build/create-config.ts +98 -0
- package/src/build/get-react-version.ts +19 -0
- package/src/build/list-utilities.ts +137 -0
- package/src/build/rule-list.ts +283 -0
- package/src/build/update-readme.ts +259 -0
- package/src/build/update-rules.ts +173 -0
- package/src/config.angular.js +122 -0
- package/src/config.astro.js +69 -0
- package/src/config.html.js +73 -0
- package/src/config.react.js +111 -0
- package/src/config.solid.js +34 -0
- package/src/config.storybook.js +31 -0
- package/src/config.tailwind.js +28 -0
- package/src/constants.js +16 -0
- package/src/eslint.config.js +1075 -0
- package/src/eslint.html.js +73 -0
- package/src/setup/a11y.ts +19 -0
- package/src/setup/angular.ts +36 -0
- package/src/setup/astro.ts +14 -0
- package/src/setup/compat.ts +13 -0
- package/src/setup/cspell.ts +100 -0
- package/src/setup/css.ts +15 -0
- package/src/setup/eslint.ts +250 -0
- package/src/setup/gen-rules.ts +85 -0
- package/src/setup/html.ts +17 -0
- package/src/setup/json.ts +17 -0
- package/src/setup/lodash.ts +59 -0
- package/src/setup/markdown.ts +16 -0
- package/src/setup/perfectionist.ts +49 -0
- package/src/setup/react.ts +37 -0
- package/src/setup/solid.ts +21 -0
- package/src/setup/sonar.ts +40 -0
- package/src/setup/storybook.ts +10 -0
- package/src/setup/tailwind.ts +12 -0
- package/src/setup/tanstack-query.ts +8 -0
- package/src/setup/tanstack-router.ts +8 -0
- package/src/setup/typescript-eslint.ts +114 -0
- package/src/setup/unicorn.ts +38 -0
- package/src/tsconfig.json +3 -0
- package/tsconfig.json +3 -0
- /package/{README.md → dist/README.md} +0 -0
- /package/{chunk-WK3YS7OG.js → dist/chunk-WK3YS7OG.js} +0 -0
- /package/{chunk-WK3YS7OG.js.map → dist/chunk-WK3YS7OG.js.map} +0 -0
- /package/{config.angular.d.ts → dist/config.angular.d.ts} +0 -0
- /package/{config.angular.js → dist/config.angular.js} +0 -0
- /package/{config.angular.js.map → dist/config.angular.js.map} +0 -0
- /package/{config.astro.d.ts → dist/config.astro.d.ts} +0 -0
- /package/{config.astro.js → dist/config.astro.js} +0 -0
- /package/{config.astro.js.map → dist/config.astro.js.map} +0 -0
- /package/{config.react.d.ts → dist/config.html.d.ts} +0 -0
- /package/{config.solid.d.ts → dist/config.react.d.ts} +0 -0
- /package/{config.react.js → dist/config.react.js} +0 -0
- /package/{config.react.js.map → dist/config.react.js.map} +0 -0
- /package/{config.storybook.d.ts → dist/config.solid.d.ts} +0 -0
- /package/{config.solid.js → dist/config.solid.js} +0 -0
- /package/{config.solid.js.map → dist/config.solid.js.map} +0 -0
- /package/{eslint.config.d.ts → dist/config.storybook.d.ts} +0 -0
- /package/{config.storybook.js → dist/config.storybook.js} +0 -0
- /package/{config.storybook.js.map → dist/config.storybook.js.map} +0 -0
- /package/{config.tailwind.d.ts → dist/config.tailwind.d.ts} +0 -0
- /package/{config.tailwind.js → dist/config.tailwind.js} +0 -0
- /package/{config.tailwind.js.map → dist/config.tailwind.js.map} +0 -0
- /package/{constants.js → dist/constants.js} +0 -0
- /package/{constants.js.map → dist/constants.js.map} +0 -0
- /package/{eslint.config.js.map → dist/eslint.config.js.map} +0 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import markdown from "@eslint/markdown";
|
|
2
|
+
import isNil from "lodash/isNil.js";
|
|
3
|
+
import keys from "lodash/keys.js";
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
type CustomRules,
|
|
7
|
+
genRules,
|
|
8
|
+
getNonDeprecatedRules,
|
|
9
|
+
} from "./gen-rules.ts";
|
|
10
|
+
|
|
11
|
+
const ruleNames = keys(
|
|
12
|
+
getNonDeprecatedRules(isNil(markdown.rules) ? {} : markdown.rules),
|
|
13
|
+
);
|
|
14
|
+
const customRules: CustomRules = [];
|
|
15
|
+
|
|
16
|
+
export const markdownRules = genRules(ruleNames, customRules, "markdown");
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import perfectionist from "eslint-plugin-perfectionist";
|
|
2
|
+
import keys from "lodash/keys.js";
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
type EsLintRules,
|
|
6
|
+
genRules,
|
|
7
|
+
getNonDeprecatedRules,
|
|
8
|
+
} from "./gen-rules.ts";
|
|
9
|
+
|
|
10
|
+
const ruleNames = keys(
|
|
11
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
|
|
12
|
+
getNonDeprecatedRules(perfectionist.rules as unknown as EsLintRules),
|
|
13
|
+
);
|
|
14
|
+
const customRules = [
|
|
15
|
+
{
|
|
16
|
+
name: "sort-jsx-props",
|
|
17
|
+
rule: ["error", { groups: ["shorthand", "multiline"] }],
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
name: "sort-objects",
|
|
21
|
+
rule: ["error", { partitionByComment: true }],
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
name: "sort-switch-case",
|
|
25
|
+
rule: [
|
|
26
|
+
"error",
|
|
27
|
+
{
|
|
28
|
+
order: "asc",
|
|
29
|
+
type: "alphabetical",
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
name: "sort-variable-declarations",
|
|
35
|
+
rule: [
|
|
36
|
+
"error",
|
|
37
|
+
{
|
|
38
|
+
order: "asc",
|
|
39
|
+
type: "alphabetical",
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
},
|
|
43
|
+
];
|
|
44
|
+
|
|
45
|
+
export const perfectionistRules = genRules(
|
|
46
|
+
ruleNames,
|
|
47
|
+
customRules,
|
|
48
|
+
"perfectionist",
|
|
49
|
+
);
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import react from "@eslint-react/eslint-plugin";
|
|
2
|
+
import reactHooks from "eslint-plugin-react-hooks";
|
|
3
|
+
import keys from "lodash/keys.js";
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
type EsLintRules,
|
|
7
|
+
genRules,
|
|
8
|
+
getNonDeprecatedRules,
|
|
9
|
+
} from "./gen-rules.ts";
|
|
10
|
+
|
|
11
|
+
const reactRuleNames = keys(
|
|
12
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
|
|
13
|
+
getNonDeprecatedRules(react.rules as unknown as EsLintRules),
|
|
14
|
+
);
|
|
15
|
+
const reactGen = genRules(reactRuleNames, [], "react");
|
|
16
|
+
|
|
17
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
|
|
18
|
+
const reactHookRuleNames = keys(reactHooks.rules as unknown as EsLintRules);
|
|
19
|
+
const customHookRules = [
|
|
20
|
+
{
|
|
21
|
+
name: "exhaustive-deps",
|
|
22
|
+
rule: "error",
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
name: "rules-of-hooks",
|
|
26
|
+
rule: "error",
|
|
27
|
+
},
|
|
28
|
+
];
|
|
29
|
+
const hookGen = genRules(reactHookRuleNames, customHookRules, "react-hooks");
|
|
30
|
+
|
|
31
|
+
export const reactRules = {
|
|
32
|
+
...reactGen,
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export const reactHookRules = {
|
|
36
|
+
...hookGen,
|
|
37
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import solid from "eslint-plugin-solid";
|
|
2
|
+
import keys from "lodash/keys.js";
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
type EsLintRules,
|
|
6
|
+
genRules,
|
|
7
|
+
getNonDeprecatedRules,
|
|
8
|
+
} from "./gen-rules.ts";
|
|
9
|
+
|
|
10
|
+
const ruleNames = keys(
|
|
11
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
|
|
12
|
+
getNonDeprecatedRules(solid.rules as unknown as EsLintRules),
|
|
13
|
+
);
|
|
14
|
+
const customRules = [
|
|
15
|
+
{
|
|
16
|
+
name: "no-proxy-apis",
|
|
17
|
+
rule: "off",
|
|
18
|
+
},
|
|
19
|
+
];
|
|
20
|
+
|
|
21
|
+
export const solidRules = genRules(ruleNames, customRules, "solid");
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import sonar from "eslint-plugin-sonarjs";
|
|
2
|
+
import keys from "lodash/keys.js";
|
|
3
|
+
|
|
4
|
+
import { genRules, getNonDeprecatedRules } from "./gen-rules.ts";
|
|
5
|
+
|
|
6
|
+
const ruleNames = keys(getNonDeprecatedRules(sonar.rules));
|
|
7
|
+
const customRules = [
|
|
8
|
+
{ name: "arrow-function-convention", rule: "off" },
|
|
9
|
+
{ name: "comment-regex", rule: "off" },
|
|
10
|
+
{ name: "cyclomatic-complexity", rule: "off" },
|
|
11
|
+
{ name: "file-header", rule: "off" },
|
|
12
|
+
{
|
|
13
|
+
name: "function-name",
|
|
14
|
+
rule: [
|
|
15
|
+
"error",
|
|
16
|
+
{
|
|
17
|
+
format: "^(?:[a-z][a-zA-Z0-9]*|[A-Z][A-Z0-9]*)$",
|
|
18
|
+
},
|
|
19
|
+
],
|
|
20
|
+
},
|
|
21
|
+
{ name: "function-return-type", rule: "off" },
|
|
22
|
+
{ name: "max-union-size", rule: "off" },
|
|
23
|
+
{ name: "no-implicit-dependencies", rule: "off" },
|
|
24
|
+
{ name: "no-inconsistent-returns", rule: "off" },
|
|
25
|
+
{ name: "no-undefined-assignment", rule: "off" },
|
|
26
|
+
{ name: "shorthand-property-grouping", rule: "off" }, // Conflicts with perfectionist sorting
|
|
27
|
+
{ name: "todo-tag", rule: "off" },
|
|
28
|
+
{ name: "no-reference-error", rule: "off" },
|
|
29
|
+
];
|
|
30
|
+
|
|
31
|
+
const rules = genRules(ruleNames, customRules, "sonar");
|
|
32
|
+
|
|
33
|
+
// Turn off duplicate S# rules
|
|
34
|
+
for (const key of keys(rules)) {
|
|
35
|
+
if (/^sonar\/S\d+/u.test(key)) {
|
|
36
|
+
rules[key] = "off";
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export const sonarRules = rules;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import storybook from "eslint-plugin-storybook";
|
|
2
|
+
import keys from "lodash/keys.js";
|
|
3
|
+
|
|
4
|
+
import { genRules, getNonDeprecatedRules } from "./gen-rules.js";
|
|
5
|
+
|
|
6
|
+
const ruleNames = keys(getNonDeprecatedRules(storybook.rules));
|
|
7
|
+
|
|
8
|
+
const rules = genRules(ruleNames, [], "storybook");
|
|
9
|
+
|
|
10
|
+
export const storybookRules = rules;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import tailwind from "eslint-plugin-tailwindcss";
|
|
2
|
+
import keys from "lodash/keys.js";
|
|
3
|
+
|
|
4
|
+
import { genRules, getNonDeprecatedRules } from "./gen-rules.ts";
|
|
5
|
+
|
|
6
|
+
const ruleNames = keys(getNonDeprecatedRules(tailwind.rules ?? {}));
|
|
7
|
+
const customRules = [
|
|
8
|
+
{ name: "no-custom-classname", rule: "off" },
|
|
9
|
+
{ name: "no-arbitrary-value", rule: "off" },
|
|
10
|
+
];
|
|
11
|
+
|
|
12
|
+
export const tailwindRules = genRules(ruleNames, customRules, "tailwind");
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import tanstack from "@tanstack/eslint-plugin-query";
|
|
2
|
+
import keys from "lodash/keys.js";
|
|
3
|
+
|
|
4
|
+
import { genRules, getNonDeprecatedRules } from "./gen-rules.ts";
|
|
5
|
+
|
|
6
|
+
const ruleNames = keys(getNonDeprecatedRules(tanstack.rules));
|
|
7
|
+
|
|
8
|
+
export const tanstackQueryRules = genRules(ruleNames, [], "@tanstack/query");
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import tanstack from "@tanstack/eslint-plugin-router";
|
|
2
|
+
import keys from "lodash/keys.js";
|
|
3
|
+
|
|
4
|
+
import { genRules, getNonDeprecatedRules } from "./gen-rules.js";
|
|
5
|
+
|
|
6
|
+
const ruleNames = keys(getNonDeprecatedRules(tanstack.rules));
|
|
7
|
+
|
|
8
|
+
export const tanstackRouterRules = genRules(ruleNames, [], "@tanstack/router");
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import keys from "lodash/keys.js";
|
|
2
|
+
import tseslint from "typescript-eslint";
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
type EsLintRules,
|
|
6
|
+
genRules,
|
|
7
|
+
getNonDeprecatedRules,
|
|
8
|
+
} from "./gen-rules.ts";
|
|
9
|
+
|
|
10
|
+
const ruleNames = keys(
|
|
11
|
+
getNonDeprecatedRules(
|
|
12
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
|
|
13
|
+
(tseslint.plugin.rules ?? {}) as unknown as EsLintRules,
|
|
14
|
+
),
|
|
15
|
+
);
|
|
16
|
+
const customRules = [
|
|
17
|
+
{
|
|
18
|
+
name: "adjacent-overload-signatures",
|
|
19
|
+
rule: "off",
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
name: "class-methods-use-this",
|
|
23
|
+
rule: "off",
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
name: "consistent-return",
|
|
27
|
+
rule: "off",
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
name: "consistent-type-definitions",
|
|
31
|
+
rule: ["error", "type"],
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
name: "consistent-type-imports",
|
|
35
|
+
rule: ["error", { fixStyle: "inline-type-imports" }],
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
name: "explicit-function-return-type",
|
|
39
|
+
rule: "off",
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
name: "explicit-module-boundary-types",
|
|
43
|
+
rule: "off",
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
name: "init-declarations",
|
|
47
|
+
rule: "off",
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
name: "member-ordering",
|
|
51
|
+
rule: "off",
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
name: "naming-convention",
|
|
55
|
+
rule: "off",
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
name: "no-dupe-class-members",
|
|
59
|
+
rule: "off",
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
name: "no-invalid-this",
|
|
63
|
+
rule: "off",
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
name: "no-magic-numbers",
|
|
67
|
+
rule: "off",
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
name: "no-redeclare",
|
|
71
|
+
rule: "off",
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
name: "no-unnecessary-type-parameters",
|
|
75
|
+
rule: "off",
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
name: "no-use-before-define",
|
|
79
|
+
rule: "off",
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
name: "parameter-properties",
|
|
83
|
+
rule: "off",
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
name: "prefer-readonly-parameter-types",
|
|
87
|
+
rule: "off",
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
name: "max-params",
|
|
91
|
+
rule: "off",
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
name: "no-unused-vars",
|
|
95
|
+
rule: [
|
|
96
|
+
"error",
|
|
97
|
+
{
|
|
98
|
+
args: "all",
|
|
99
|
+
argsIgnorePattern: "^_",
|
|
100
|
+
caughtErrors: "all",
|
|
101
|
+
caughtErrorsIgnorePattern: "^_",
|
|
102
|
+
destructuredArrayIgnorePattern: "^_",
|
|
103
|
+
ignoreRestSiblings: true,
|
|
104
|
+
varsIgnorePattern: "^_",
|
|
105
|
+
},
|
|
106
|
+
],
|
|
107
|
+
},
|
|
108
|
+
];
|
|
109
|
+
|
|
110
|
+
export const typescriptRules = genRules(
|
|
111
|
+
ruleNames,
|
|
112
|
+
customRules,
|
|
113
|
+
"@typescript-eslint",
|
|
114
|
+
);
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import unicorn from "eslint-plugin-unicorn";
|
|
2
|
+
import keys from "lodash/keys.js";
|
|
3
|
+
|
|
4
|
+
import { genRules, getNonDeprecatedRules } from "./gen-rules.ts";
|
|
5
|
+
|
|
6
|
+
const ruleNames = keys(getNonDeprecatedRules(unicorn.rules ?? {}));
|
|
7
|
+
const customRules = [
|
|
8
|
+
{
|
|
9
|
+
name: "empty-brace-spaces",
|
|
10
|
+
rule: "off",
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
name: "explicit-length-check",
|
|
14
|
+
rule: "off",
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
name: "no-keyword-prefix",
|
|
18
|
+
rule: "off",
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
name: "no-nested-ternary",
|
|
22
|
+
rule: "off",
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
name: "no-null",
|
|
26
|
+
rule: "off",
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: "number-literal-case",
|
|
30
|
+
rule: "off",
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
name: "template-indent",
|
|
34
|
+
rule: "off",
|
|
35
|
+
},
|
|
36
|
+
];
|
|
37
|
+
|
|
38
|
+
export const unicornRules = genRules(ruleNames, customRules, "unicorn");
|
package/tsconfig.json
ADDED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|