@ethang/eslint-config 19.4.6 → 19.5.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 +2 -1
- package/build/create-config-file.ts +51 -0
- package/build/{create-config.js → create-config.ts} +13 -3
- package/build/{get-react-version.js → get-react-version.ts} +1 -1
- package/build/{list-utils.mjs → list-utils.ts} +21 -26
- package/build/{rule-list.mjs → rule-list.ts} +97 -87
- package/build/{update-readme.js → update-readme.ts} +29 -13
- package/build/{update-rules.js → update-rules.ts} +29 -20
- package/build.mjs +2 -2
- package/config.solid.js +0 -1
- package/eslint.config.js +3 -47
- package/package.json +7 -1
- package/setup/a11y.ts +13 -0
- package/setup/astro.ts +13 -0
- package/setup/barrel.ts +13 -0
- package/setup/compat.ts +12 -0
- package/setup/cspell.ts +8 -0
- package/setup/depend.ts +13 -0
- package/setup/{deprecated.js → deprecated.ts} +2 -2
- package/setup/eslint.ts +233 -0
- package/setup/{ethang.js → ethang.ts} +2 -1
- package/setup/gen-rules.ts +60 -0
- package/setup/json.ts +15 -0
- package/setup/lodash.ts +50 -0
- package/setup/markdown.ts +12 -0
- package/setup/n.ts +85 -0
- package/setup/{perfectionist.js → perfectionist.ts} +4 -2
- package/setup/react.ts +63 -0
- package/setup/solid.ts +15 -0
- package/setup/{sonar.js → sonar.ts} +2 -20
- package/setup/{stylistic.js → stylistic.ts} +3 -3
- package/setup/{tailwind.js → tailwind.ts} +2 -2
- package/setup/tanstack-query.ts +7 -0
- package/setup/{typescript-eslint.js → typescript-eslint.ts} +6 -26
- package/setup/unicorn.ts +37 -0
- package/tsconfig.json +5 -1
- package/build/create-config-file.js +0 -45
- package/setup/a11y.js +0 -25
- package/setup/astro.js +0 -7
- package/setup/barrel.js +0 -9
- package/setup/compat.js +0 -10
- package/setup/depend.js +0 -11
- package/setup/eslint.js +0 -71
- package/setup/gen-rules.js +0 -39
- package/setup/json.js +0 -7
- package/setup/lodash.js +0 -19
- package/setup/markdown.js +0 -7
- package/setup/n.js +0 -31
- package/setup/react.js +0 -35
- package/setup/solid.js +0 -10
- package/setup/tanstack-query.js +0 -7
- package/setup/unicorn.js +0 -32
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
> [!CAUTION]
|
|
6
6
|
> Do not use this with Prettier! Styling rules are included.
|
|
7
7
|
|
|
8
|
-
-
|
|
8
|
+
- 887 errored rules.
|
|
9
9
|
- 289 rules from [eslint-plugin-sonarjs](https://github.com/SonarSource/SonarJS/blob/master/packages/jsts/src/rules/README.md)
|
|
10
10
|
- 145 rules from [@eslint/js](https://github.com/eslint/eslint/tree/main/packages/js)
|
|
11
11
|
- 113 rules from [sindresorhus/eslint-plugin-unicorn](https://github.com/sindresorhus/eslint-plugin-unicorn)
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
- 4 rules from [@tanstack/eslint-plugin-query](https://tanstack.com/query/latest/docs/eslint/eslint-plugin-query)
|
|
22
22
|
- 2 rules from [@eslint/json](https://github.com/eslint/json)
|
|
23
23
|
- 1 rule from [eslint-plugin-depend](https://github.com/es-tooling/eslint-plugin-depend/tree/main)
|
|
24
|
+
- 1 rule from [@cspell/eslint-plugin](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell-eslint-plugin)
|
|
24
25
|
- 1 rule from [eslint-plugin-compat](https://github.com/amilajack/eslint-plugin-compat)
|
|
25
26
|
- 1 rule from [@ethang/eslint-plugin](https://github.com/eglove/eslint-plugin)
|
|
26
27
|
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { writeFileSync } from "node:fs";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
|
|
4
|
+
import type { ConfigFile } from "./update-rules.ts";
|
|
5
|
+
|
|
6
|
+
import { createConfig } from "./create-config.ts";
|
|
7
|
+
import { getTypeImportStrings } from "./list-utils.ts";
|
|
8
|
+
|
|
9
|
+
export const createConfigFile = async (
|
|
10
|
+
listConfigs: ConfigFile[],
|
|
11
|
+
fileName: string,
|
|
12
|
+
) => {
|
|
13
|
+
let configFile = "";
|
|
14
|
+
|
|
15
|
+
const imports = listConfigs.flatMap((list) => {
|
|
16
|
+
const importStrings = getTypeImportStrings(list.name);
|
|
17
|
+
|
|
18
|
+
if (list.options?.extraImports && 0 < list.options.extraImports.length) {
|
|
19
|
+
importStrings.push(...list.options.extraImports);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return importStrings;
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
const importList = [
|
|
26
|
+
'import { ignores, languageOptions } from "./constants.js";',
|
|
27
|
+
...imports,
|
|
28
|
+
].toSorted((a, b) => {
|
|
29
|
+
return (a ?? "").localeCompare(b ?? "");
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
for (const item of importList) {
|
|
33
|
+
configFile += `${item}\n`;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const configs = await Promise.all(
|
|
37
|
+
listConfigs.map(async (list) => {
|
|
38
|
+
return createConfig(list.name, list.options);
|
|
39
|
+
}),
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
configFile += `\nexport default tseslint.config(
|
|
43
|
+
${configs.join("\n")}
|
|
44
|
+
);\n`;
|
|
45
|
+
|
|
46
|
+
writeFileSync(
|
|
47
|
+
join(import.meta.dirname, `../${fileName}`),
|
|
48
|
+
configFile,
|
|
49
|
+
"utf8",
|
|
50
|
+
);
|
|
51
|
+
};
|
|
@@ -1,12 +1,22 @@
|
|
|
1
|
+
import { getLatestReact } from "./get-react-version.ts";
|
|
1
2
|
import {
|
|
2
3
|
getList,
|
|
3
4
|
getListJson,
|
|
4
5
|
getListPlugins,
|
|
5
6
|
getTypeFiles,
|
|
6
|
-
} from "./list-utils.
|
|
7
|
-
import { getLatestReact } from "./get-react-version.js";
|
|
7
|
+
} from "./list-utils.ts";
|
|
8
8
|
|
|
9
|
-
export
|
|
9
|
+
export type ConfigOptions = {
|
|
10
|
+
extraImports?: string[];
|
|
11
|
+
includeIgnores?: boolean;
|
|
12
|
+
includeLanguageOptions?: boolean;
|
|
13
|
+
includeReactVersion?: boolean;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export const createConfig = async (
|
|
17
|
+
type: string,
|
|
18
|
+
options: ConfigOptions = {},
|
|
19
|
+
) => {
|
|
10
20
|
let config = "";
|
|
11
21
|
let settings;
|
|
12
22
|
|
|
@@ -1,44 +1,35 @@
|
|
|
1
|
-
import { ruleList } from "./rule-list.
|
|
1
|
+
import { ruleList } from "./rule-list.ts";
|
|
2
2
|
|
|
3
|
-
export const getList = (type) => {
|
|
3
|
+
export const getList = (type: string) => {
|
|
4
4
|
return ruleList
|
|
5
|
-
.filter((list) =>
|
|
6
|
-
|
|
5
|
+
.filter((list) => {
|
|
6
|
+
return list.type === type;
|
|
7
|
+
})
|
|
8
|
+
.sort((a, b) => {
|
|
9
|
+
return (a.order ?? 0) - (b.order ?? 0);
|
|
10
|
+
});
|
|
7
11
|
};
|
|
8
12
|
|
|
9
|
-
export const
|
|
10
|
-
return
|
|
13
|
+
export const getTypeImportStrings = (type: string) => {
|
|
14
|
+
return ruleList
|
|
15
|
+
.filter((list) => {
|
|
16
|
+
return list.type === type;
|
|
17
|
+
})
|
|
11
18
|
.map((item) => {
|
|
12
19
|
return item.importString;
|
|
13
20
|
})
|
|
14
21
|
.filter(Boolean);
|
|
15
22
|
};
|
|
16
23
|
|
|
17
|
-
export const
|
|
18
|
-
return ruleList
|
|
19
|
-
.filter((list) => list.type === type)
|
|
20
|
-
.map((item) => item.importString)
|
|
21
|
-
.filter(Boolean);
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export const getListJson = (list) => {
|
|
24
|
+
export const getListJson = (list: typeof ruleList) => {
|
|
25
25
|
return list
|
|
26
26
|
.map((list) => {
|
|
27
|
-
|
|
28
|
-
a.localeCompare(b),
|
|
29
|
-
);
|
|
30
|
-
const sortedObject = {};
|
|
31
|
-
|
|
32
|
-
for (const key of sortedKeys) {
|
|
33
|
-
sortedObject[key] = list.list[key];
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
return JSON.stringify(sortedObject).slice(1, -1);
|
|
27
|
+
return JSON.stringify(list.list).slice(1, -1);
|
|
37
28
|
})
|
|
38
29
|
.join(",");
|
|
39
30
|
};
|
|
40
31
|
|
|
41
|
-
export const getTypeFiles = (type) => {
|
|
32
|
+
export const getTypeFiles = (type: string) => {
|
|
42
33
|
switch (type) {
|
|
43
34
|
case "core": {
|
|
44
35
|
return ["**/*.{js,ts,jsx,tsx,cjs,cts,mjs,mts}"];
|
|
@@ -63,10 +54,14 @@ export const getTypeFiles = (type) => {
|
|
|
63
54
|
case "solid": {
|
|
64
55
|
return ["**/*.{jsx,tsx}"];
|
|
65
56
|
}
|
|
57
|
+
|
|
58
|
+
default: {
|
|
59
|
+
return [];
|
|
60
|
+
}
|
|
66
61
|
}
|
|
67
62
|
};
|
|
68
63
|
|
|
69
|
-
export const getListPlugins = (list) => {
|
|
64
|
+
export const getListPlugins = (list: typeof ruleList) => {
|
|
70
65
|
let pluginString = "";
|
|
71
66
|
|
|
72
67
|
for (const item of list) {
|
|
@@ -1,240 +1,250 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import { perfectionistRules } from "../setup/perfectionist.
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
1
|
+
import { a11yRules } from "../setup/a11y.ts";
|
|
2
|
+
import { astroRules } from "../setup/astro.ts";
|
|
3
|
+
import { barrelRules } from "../setup/barrel.ts";
|
|
4
|
+
import { compatRules } from "../setup/compat.ts";
|
|
5
|
+
import { dependRules } from "../setup/depend.ts";
|
|
6
|
+
import { deprecatedRules } from "../setup/deprecated.ts";
|
|
7
|
+
import { eslintRules } from "../setup/eslint.ts";
|
|
8
|
+
import { ethangRules } from "../setup/ethang.ts";
|
|
9
|
+
import { jsonRules } from "../setup/json.ts";
|
|
10
|
+
import { lodashRules } from "../setup/lodash.ts";
|
|
11
|
+
import { markdownRules } from "../setup/markdown.ts";
|
|
12
|
+
import { nRules } from "../setup/n.ts";
|
|
13
|
+
import { perfectionistRules } from "../setup/perfectionist.ts";
|
|
14
|
+
import { reactHookRules, reactRules } from "../setup/react.ts";
|
|
15
|
+
import { solidRules } from "../setup/solid.ts";
|
|
16
|
+
import { sonarRules } from "../setup/sonar.ts";
|
|
17
|
+
import { stylisticRules } from "../setup/stylistic.ts";
|
|
18
|
+
import { tailwindRules } from "../setup/tailwind.ts";
|
|
19
|
+
import { tanstackQueryRules } from "../setup/tanstack-query.ts";
|
|
20
|
+
import { typescriptRules } from "../setup/typescript-eslint.ts";
|
|
21
|
+
import { unicornRules } from "../setup/unicorn.ts";
|
|
22
|
+
import { cspellRules } from "../setup/cspell.js";
|
|
22
23
|
|
|
23
24
|
export const ruleList = [
|
|
24
25
|
{
|
|
26
|
+
importString: 'import depend from "eslint-plugin-depend";',
|
|
25
27
|
list: dependRules,
|
|
26
28
|
name: "eslint-plugin-depend",
|
|
27
|
-
url: "https://github.com/es-tooling/eslint-plugin-depend/tree/main",
|
|
28
|
-
type: "core",
|
|
29
|
-
importString: 'import depend from "eslint-plugin-depend";',
|
|
30
29
|
order: 0,
|
|
31
30
|
pluginName: "depend",
|
|
32
31
|
pluginValue: "depend",
|
|
32
|
+
type: "core",
|
|
33
|
+
url: "https://github.com/es-tooling/eslint-plugin-depend/tree/main",
|
|
33
34
|
},
|
|
34
35
|
{
|
|
36
|
+
importString: 'import barrel from "eslint-plugin-barrel-files";',
|
|
35
37
|
list: barrelRules,
|
|
36
38
|
name: "eslint-plugin-barrel-files",
|
|
37
|
-
url: "https://github.com/thepassle/eslint-plugin-barrel-files",
|
|
38
|
-
type: "core",
|
|
39
|
-
importString: 'import barrel from "eslint-plugin-barrel-files";',
|
|
40
39
|
order: 1,
|
|
41
40
|
pluginName: "barrel",
|
|
42
41
|
pluginValue: "barrel",
|
|
42
|
+
type: "core",
|
|
43
|
+
url: "https://github.com/thepassle/eslint-plugin-barrel-files",
|
|
43
44
|
},
|
|
44
45
|
{
|
|
46
|
+
importString: 'import compat from "eslint-plugin-compat";',
|
|
45
47
|
list: compatRules,
|
|
46
48
|
name: "eslint-plugin-compat",
|
|
47
|
-
url: "https://github.com/amilajack/eslint-plugin-compat",
|
|
48
|
-
type: "core",
|
|
49
|
-
importString: 'import compat from "eslint-plugin-compat";',
|
|
50
49
|
order: 2,
|
|
51
50
|
pluginName: "compat",
|
|
52
51
|
pluginValue: "compat",
|
|
52
|
+
type: "core",
|
|
53
|
+
url: "https://github.com/amilajack/eslint-plugin-compat",
|
|
53
54
|
},
|
|
54
55
|
{
|
|
56
|
+
importString: undefined,
|
|
55
57
|
list: eslintRules,
|
|
56
58
|
name: "@eslint/js",
|
|
57
|
-
url: "https://github.com/eslint/eslint/tree/main/packages/js",
|
|
58
|
-
type: "core",
|
|
59
|
-
importString: undefined,
|
|
60
59
|
order: 3,
|
|
61
60
|
pluginName: undefined,
|
|
62
61
|
pluginValue: undefined,
|
|
62
|
+
type: "core",
|
|
63
|
+
url: "https://github.com/eslint/eslint/tree/main/packages/js",
|
|
63
64
|
},
|
|
64
65
|
{
|
|
66
|
+
importString: 'import n from "eslint-plugin-n";',
|
|
65
67
|
list: nRules,
|
|
66
68
|
name: "eslint-plugin-n",
|
|
67
|
-
url: "https://github.com/eslint-community/eslint-plugin-n",
|
|
68
|
-
type: "core",
|
|
69
|
-
importString: 'import n from "eslint-plugin-n";',
|
|
70
69
|
order: 4,
|
|
71
70
|
pluginName: "n",
|
|
72
71
|
pluginValue: "n",
|
|
72
|
+
type: "core",
|
|
73
|
+
url: "https://github.com/eslint-community/eslint-plugin-n",
|
|
73
74
|
},
|
|
74
75
|
{
|
|
76
|
+
importString: 'import tseslint from "typescript-eslint";',
|
|
75
77
|
list: typescriptRules,
|
|
76
78
|
name: "@typescript/eslint",
|
|
77
|
-
url: "https://github.com/typescript-eslint/typescript-eslint",
|
|
78
|
-
type: "core",
|
|
79
|
-
importString: 'import tseslint from "typescript-eslint";',
|
|
80
79
|
order: 5,
|
|
81
80
|
pluginName: "@typescript-eslint",
|
|
82
81
|
pluginValue: "tseslint.plugin",
|
|
82
|
+
type: "core",
|
|
83
|
+
url: "https://github.com/typescript-eslint/typescript-eslint",
|
|
83
84
|
},
|
|
84
85
|
{
|
|
86
|
+
importString: 'import unicorn from "eslint-plugin-unicorn";',
|
|
85
87
|
list: unicornRules,
|
|
86
88
|
name: "sindresorhus/eslint-plugin-unicorn",
|
|
87
|
-
url: "https://github.com/sindresorhus/eslint-plugin-unicorn",
|
|
88
|
-
type: "core",
|
|
89
|
-
importString: 'import unicorn from "eslint-plugin-unicorn";',
|
|
90
89
|
order: 6,
|
|
91
90
|
pluginName: "unicorn",
|
|
92
91
|
pluginValue: "unicorn",
|
|
92
|
+
type: "core",
|
|
93
|
+
url: "https://github.com/sindresorhus/eslint-plugin-unicorn",
|
|
93
94
|
},
|
|
94
95
|
{
|
|
96
|
+
importString: 'import lodashConfig from "eslint-plugin-lodash";',
|
|
95
97
|
list: lodashRules,
|
|
96
98
|
name: "eslint-plugin-lodash",
|
|
97
|
-
url: "https://github.com/wix-incubator/eslint-plugin-lodash",
|
|
98
|
-
type: "core",
|
|
99
|
-
importString: 'import lodashConfig from "eslint-plugin-lodash";',
|
|
100
99
|
order: 7,
|
|
101
100
|
pluginName: "lodash",
|
|
102
101
|
pluginValue: "lodashConfig",
|
|
102
|
+
type: "core",
|
|
103
|
+
url: "https://github.com/wix-incubator/eslint-plugin-lodash",
|
|
103
104
|
},
|
|
104
105
|
{
|
|
106
|
+
importString: 'import sonar from "eslint-plugin-sonarjs";',
|
|
105
107
|
list: sonarRules,
|
|
106
108
|
name: "eslint-plugin-sonarjs",
|
|
107
|
-
url: "https://github.com/SonarSource/SonarJS/blob/master/packages/jsts/src/rules/README.md",
|
|
108
|
-
type: "core",
|
|
109
|
-
importString: 'import sonar from "eslint-plugin-sonarjs";',
|
|
110
109
|
order: 8,
|
|
111
110
|
pluginName: "sonar",
|
|
112
111
|
pluginValue: "fixupPluginRules(sonar)", // TODO remove with v9 compat
|
|
112
|
+
type: "core",
|
|
113
|
+
url: "https://github.com/SonarSource/SonarJS/blob/master/packages/jsts/src/rules/README.md",
|
|
113
114
|
},
|
|
114
115
|
{
|
|
116
|
+
importString: 'import ethang from "@ethang/eslint-plugin";',
|
|
115
117
|
list: ethangRules,
|
|
116
118
|
name: "@ethang/eslint-plugin",
|
|
117
|
-
url: "https://github.com/eglove/eslint-plugin",
|
|
118
|
-
type: "core",
|
|
119
|
-
importString: 'import ethang from "@ethang/eslint-plugin";',
|
|
120
119
|
order: 9,
|
|
121
120
|
pluginName: "ethang",
|
|
122
121
|
pluginValue: "ethang",
|
|
122
|
+
type: "core",
|
|
123
|
+
url: "https://github.com/eglove/eslint-plugin",
|
|
123
124
|
},
|
|
124
125
|
{
|
|
126
|
+
importString: 'import tanstack from "@tanstack/eslint-plugin-query";',
|
|
125
127
|
list: tanstackQueryRules,
|
|
126
128
|
name: "@tanstack/eslint-plugin-query",
|
|
127
|
-
url: "https://tanstack.com/query/latest/docs/eslint/eslint-plugin-query",
|
|
128
|
-
type: "core",
|
|
129
|
-
importString: 'import tanstack from "@tanstack/eslint-plugin-query";',
|
|
130
129
|
order: 10,
|
|
131
130
|
pluginName: "@tanstack/query",
|
|
132
131
|
pluginValue: "tanstack",
|
|
132
|
+
type: "core",
|
|
133
|
+
url: "https://tanstack.com/query/latest/docs/eslint/eslint-plugin-query",
|
|
133
134
|
},
|
|
134
135
|
{
|
|
136
|
+
importString: 'import tailwind from "eslint-plugin-tailwindcss";',
|
|
135
137
|
list: tailwindRules,
|
|
136
138
|
name: "eslint-plugin-tailwindcss",
|
|
137
|
-
url: "https://github.com/francoismassart/eslint-plugin-tailwindcss",
|
|
138
|
-
type: "core",
|
|
139
|
-
importString: 'import tailwind from "eslint-plugin-tailwindcss";',
|
|
140
139
|
order: 11,
|
|
141
140
|
pluginName: "tailwind",
|
|
142
141
|
pluginValue: "tailwind",
|
|
142
|
+
type: "core",
|
|
143
|
+
url: "https://github.com/francoismassart/eslint-plugin-tailwindcss",
|
|
143
144
|
},
|
|
144
145
|
{
|
|
146
|
+
importString: 'import stylistic from "@stylistic/eslint-plugin";',
|
|
145
147
|
list: stylisticRules,
|
|
146
148
|
name: "@stylistic/eslint-plugin",
|
|
147
|
-
url: "https://eslint.style/",
|
|
148
|
-
type: "core",
|
|
149
|
-
importString: 'import stylistic from "@stylistic/eslint-plugin";',
|
|
150
149
|
order: 12,
|
|
151
150
|
pluginName: "stylistic",
|
|
152
151
|
pluginValue: "stylistic",
|
|
152
|
+
type: "core",
|
|
153
|
+
url: "https://eslint.style/",
|
|
153
154
|
},
|
|
154
155
|
{
|
|
156
|
+
importString: 'import perfectionist from "eslint-plugin-perfectionist";',
|
|
155
157
|
list: perfectionistRules,
|
|
156
158
|
name: "eslint-plugin-perfectionist",
|
|
157
|
-
url: "https://github.com/azat-io/eslint-plugin-perfectionist",
|
|
158
|
-
type: "core",
|
|
159
|
-
importString: 'import perfectionist from "eslint-plugin-perfectionist";',
|
|
160
159
|
order: 13,
|
|
161
160
|
pluginName: "perfectionist",
|
|
162
161
|
pluginValue: "perfectionist",
|
|
162
|
+
type: "core",
|
|
163
|
+
url: "https://github.com/azat-io/eslint-plugin-perfectionist",
|
|
163
164
|
},
|
|
164
165
|
{
|
|
166
|
+
importString: 'import a11y from "eslint-plugin-jsx-a11y/lib/index.js";',
|
|
165
167
|
list: a11yRules,
|
|
166
168
|
name: "jsx-a11y",
|
|
167
|
-
url: "https://github.com/jsx-eslint/eslint-plugin-jsx-a11y",
|
|
168
|
-
type: "core",
|
|
169
|
-
importString: 'import a11y from "eslint-plugin-jsx-a11y/lib/index.js";',
|
|
170
169
|
order: 14,
|
|
171
170
|
pluginName: "a11y",
|
|
172
171
|
pluginValue: "a11y",
|
|
172
|
+
type: "core",
|
|
173
|
+
url: "https://github.com/jsx-eslint/eslint-plugin-jsx-a11y",
|
|
173
174
|
},
|
|
174
175
|
{
|
|
176
|
+
importString: undefined,
|
|
175
177
|
list: deprecatedRules,
|
|
176
178
|
name: "@eslint/js",
|
|
177
|
-
url: "https://github.com/eslint/eslint/tree/main/packages/js",
|
|
178
|
-
type: "core",
|
|
179
|
-
importString: undefined,
|
|
180
179
|
order: 15,
|
|
181
180
|
pluginName: undefined,
|
|
182
181
|
pluginValue: undefined,
|
|
182
|
+
type: "core",
|
|
183
|
+
url: "https://github.com/eslint/eslint/tree/main/packages/js",
|
|
183
184
|
},
|
|
184
185
|
{
|
|
186
|
+
importString: 'import markdown from "@eslint/markdown";',
|
|
185
187
|
list: markdownRules,
|
|
186
188
|
name: "@eslint/markdown",
|
|
187
|
-
url: "https://github.com/eslint/markdown",
|
|
188
|
-
type: "markdown",
|
|
189
|
-
importString: 'import markdown from "@eslint/markdown";',
|
|
190
189
|
order: 0,
|
|
191
190
|
pluginName: "markdown",
|
|
192
191
|
pluginValue: "markdown",
|
|
192
|
+
type: "markdown",
|
|
193
|
+
url: "https://github.com/eslint/markdown",
|
|
193
194
|
},
|
|
194
195
|
{
|
|
196
|
+
importString: 'import json from "@eslint/json";',
|
|
195
197
|
list: jsonRules,
|
|
196
198
|
name: "@eslint/json",
|
|
197
|
-
url: "https://github.com/eslint/json",
|
|
198
|
-
type: "json",
|
|
199
|
-
importString: 'import json from "@eslint/json";',
|
|
200
199
|
order: 0,
|
|
201
200
|
pluginName: "json",
|
|
202
201
|
pluginValue: "json",
|
|
202
|
+
type: "json",
|
|
203
|
+
url: "https://github.com/eslint/json",
|
|
203
204
|
},
|
|
204
205
|
{
|
|
206
|
+
importString: 'import astro from "eslint-plugin-astro";',
|
|
205
207
|
list: astroRules,
|
|
206
208
|
name: "eslint-plugin-astro",
|
|
207
|
-
url: "https://github.com/ota-meshi/eslint-plugin-astro",
|
|
208
|
-
type: "astro",
|
|
209
|
-
importString: 'import astro from "eslint-plugin-astro";',
|
|
210
209
|
pluginName: "astro",
|
|
211
210
|
pluginValue: "astro",
|
|
211
|
+
type: "astro",
|
|
212
|
+
url: "https://github.com/ota-meshi/eslint-plugin-astro",
|
|
212
213
|
},
|
|
213
214
|
{
|
|
215
|
+
importString: 'import react from "@eslint-react/eslint-plugin";',
|
|
214
216
|
list: reactRules,
|
|
215
217
|
name: "@eslint-react/eslint-plugin",
|
|
216
|
-
url: "https://eslint-react.xyz/",
|
|
217
|
-
type: "react",
|
|
218
|
-
importString: 'import react from "@eslint-react/eslint-plugin";',
|
|
219
218
|
pluginName: "react",
|
|
220
219
|
pluginValue: "react",
|
|
220
|
+
type: "react",
|
|
221
|
+
url: "https://eslint-react.xyz/",
|
|
221
222
|
},
|
|
222
223
|
{
|
|
224
|
+
importString: 'import reactHooks from "eslint-plugin-react-hooks";',
|
|
223
225
|
list: reactHookRules,
|
|
224
226
|
name: "eslint-plugin-react-hooks",
|
|
225
|
-
url: "https://github.com/facebook/react/tree/main/packages/eslint-plugin-react-hooks",
|
|
226
|
-
type: "react",
|
|
227
|
-
importString: 'import reactHooks from "eslint-plugin-react-hooks";',
|
|
228
227
|
pluginName: "react-hooks",
|
|
229
228
|
pluginValue: "fixupPluginRules(reactHooks)", // TODO remove with v9 compat
|
|
229
|
+
type: "react",
|
|
230
|
+
url: "https://github.com/facebook/react/tree/main/packages/eslint-plugin-react-hooks",
|
|
230
231
|
},
|
|
231
232
|
{
|
|
233
|
+
importString: 'import solid from "eslint-plugin-solid";',
|
|
232
234
|
list: solidRules,
|
|
233
235
|
name: "eslint-plugin-solid",
|
|
234
|
-
url: "https://github.com/solidjs-community/eslint-plugin-solid",
|
|
235
|
-
type: "solid",
|
|
236
|
-
importString: 'import solid from "eslint-plugin-solid";',
|
|
237
236
|
pluginName: "solid",
|
|
238
237
|
pluginValue: "solid",
|
|
238
|
+
type: "solid",
|
|
239
|
+
url: "https://github.com/solidjs-community/eslint-plugin-solid",
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
importString: 'import cspell from "@cspell/eslint-plugin";',
|
|
243
|
+
list: cspellRules,
|
|
244
|
+
name: "@cspell/eslint-plugin",
|
|
245
|
+
pluginName: "cspell",
|
|
246
|
+
pluginValue: "cspell",
|
|
247
|
+
type: "core",
|
|
248
|
+
url: "https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell-eslint-plugin",
|
|
239
249
|
},
|
|
240
250
|
];
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
import { MarkdownGenerator } from "@ethang/markdown-generator/markdown-generator.js";
|
|
1
2
|
import { writeFileSync } from "node:fs";
|
|
2
3
|
import { join } from "node:path";
|
|
3
|
-
|
|
4
|
-
import {
|
|
4
|
+
|
|
5
|
+
import type { genRules } from "../setup/gen-rules.ts";
|
|
6
|
+
|
|
7
|
+
import { getList } from "./list-utils.ts";
|
|
5
8
|
|
|
6
9
|
export const updateReadme = () => {
|
|
7
10
|
const md = new MarkdownGenerator();
|
|
@@ -13,13 +16,13 @@ export const updateReadme = () => {
|
|
|
13
16
|
2,
|
|
14
17
|
);
|
|
15
18
|
|
|
16
|
-
const getRuleCount = (rules) => {
|
|
19
|
+
const getRuleCount = (rules: ReturnType<typeof genRules>) => {
|
|
17
20
|
let count = 0;
|
|
18
|
-
Object.values(rules)
|
|
19
|
-
if (
|
|
21
|
+
for (const value of Object.values(rules)) {
|
|
22
|
+
if ("error" === value || (Array.isArray(value) && "error" === value[0])) {
|
|
20
23
|
count += 1;
|
|
21
24
|
}
|
|
22
|
-
}
|
|
25
|
+
}
|
|
23
26
|
|
|
24
27
|
return count;
|
|
25
28
|
};
|
|
@@ -28,13 +31,18 @@ export const updateReadme = () => {
|
|
|
28
31
|
...getList("core"),
|
|
29
32
|
...getList("json"),
|
|
30
33
|
...getList("markdown"),
|
|
31
|
-
]
|
|
34
|
+
].map((rules) => {
|
|
35
|
+
return {
|
|
36
|
+
...rules,
|
|
37
|
+
count: 0,
|
|
38
|
+
};
|
|
39
|
+
});
|
|
32
40
|
|
|
33
41
|
let total = 0;
|
|
34
42
|
for (const list of coreRules) {
|
|
35
43
|
const count = getRuleCount(list.list);
|
|
36
44
|
total += count;
|
|
37
|
-
list
|
|
45
|
+
list.count = count;
|
|
38
46
|
}
|
|
39
47
|
coreRules.sort((a, b) => {
|
|
40
48
|
return b.count - a.count;
|
|
@@ -42,12 +50,14 @@ export const updateReadme = () => {
|
|
|
42
50
|
|
|
43
51
|
const ruleDocs = [`${total} errored rules.`];
|
|
44
52
|
for (const list of coreRules) {
|
|
45
|
-
if (list.count
|
|
53
|
+
if (1 > list.count) {
|
|
46
54
|
continue;
|
|
47
55
|
}
|
|
48
56
|
|
|
49
57
|
ruleDocs.push(
|
|
50
|
-
`${list.count} ${
|
|
58
|
+
`${list.count} ${
|
|
59
|
+
1 >= list.count ? "rule" : "rules"
|
|
60
|
+
} from [${list.name}](${list.url})`,
|
|
51
61
|
);
|
|
52
62
|
}
|
|
53
63
|
|
|
@@ -78,7 +88,9 @@ export const updateReadme = () => {
|
|
|
78
88
|
[
|
|
79
89
|
'`import astroConfig from "@ethang/eslint-config/config.astro.js";`',
|
|
80
90
|
...astroRules
|
|
81
|
-
.filter((rule) =>
|
|
91
|
+
.filter((rule) => {
|
|
92
|
+
return 0 < getRuleCount(rule.list);
|
|
93
|
+
})
|
|
82
94
|
.map((rule) => {
|
|
83
95
|
return `${getRuleCount(rule.list)} rules from [${rule.name}](${rule.url})`;
|
|
84
96
|
}),
|
|
@@ -87,7 +99,9 @@ export const updateReadme = () => {
|
|
|
87
99
|
[
|
|
88
100
|
'`import reactConfig from "@ethang/eslint-config/config.react.js";`',
|
|
89
101
|
...reactRules
|
|
90
|
-
.filter((rule) =>
|
|
102
|
+
.filter((rule) => {
|
|
103
|
+
return 0 < getRuleCount(rule.list);
|
|
104
|
+
})
|
|
91
105
|
.map((rule) => {
|
|
92
106
|
return `${getRuleCount(rule.list)} rules from [${rule.name}](${rule.url})`;
|
|
93
107
|
}),
|
|
@@ -96,7 +110,9 @@ export const updateReadme = () => {
|
|
|
96
110
|
[
|
|
97
111
|
'`import solidConfig from "@ethang/eslint-config/config.solid.js";`',
|
|
98
112
|
...solidRules
|
|
99
|
-
.filter((rule) =>
|
|
113
|
+
.filter((rule) => {
|
|
114
|
+
return 0 < getRuleCount(rule.list);
|
|
115
|
+
})
|
|
100
116
|
.map((rule) => {
|
|
101
117
|
return `${getRuleCount(rule.list)} rules from [${rule.name}](${rule.url})`;
|
|
102
118
|
}),
|