@ethang/eslint-config 19.15.1 → 19.15.3
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/chunk-NR4FIKOF.js +8 -0
- package/chunk-NR4FIKOF.js.map +1 -0
- package/config.astro.js +10 -11
- package/config.astro.js.map +1 -0
- package/config.react.js +13 -18
- package/config.react.js.map +1 -0
- package/config.solid.js +9 -10
- package/config.solid.js.map +1 -0
- package/constants.js +3 -11
- package/constants.js.map +1 -0
- package/eslint.config.js +79 -70
- package/eslint.config.js.map +1 -0
- package/package.json +22 -55
- package/.gitattributes +0 -1
- package/.github/dependabot.yml +0 -13
- package/.idea/codeStyles/Project.xml +0 -57
- package/.idea/codeStyles/codeStyleConfig.xml +0 -5
- package/README.md +0 -98
- package/build/create-config-file.ts +0 -51
- package/build/create-config.ts +0 -63
- package/build/get-react-version.ts +0 -4
- package/build/list-utils.ts +0 -102
- package/build/rule-list.ts +0 -293
- package/build/update-readme.ts +0 -180
- package/build/update-rules.ts +0 -101
- package/build.mjs +0 -16
- package/setup/a11y.ts +0 -18
- package/setup/astro.ts +0 -13
- package/setup/barrel.ts +0 -13
- package/setup/compat.ts +0 -12
- package/setup/cspell.ts +0 -55
- package/setup/depend.ts +0 -13
- package/setup/deprecated.ts +0 -18
- package/setup/eslint.ts +0 -237
- package/setup/gen-rules.ts +0 -60
- package/setup/json.ts +0 -15
- package/setup/lodash.ts +0 -50
- package/setup/markdown.ts +0 -12
- package/setup/n.ts +0 -85
- package/setup/perfectionist.ts +0 -62
- package/setup/react.ts +0 -77
- package/setup/solid.ts +0 -15
- package/setup/sonar.ts +0 -43
- package/setup/stylistic-ts.ts +0 -51
- package/setup/stylistic.ts +0 -68
- package/setup/tailwind.ts +0 -8
- package/setup/tanstack-query.ts +0 -8
- package/setup/tanstack-router.ts +0 -7
- package/setup/typescript-eslint.ts +0 -112
- package/setup/unicorn.ts +0 -37
- package/tsconfig.json +0 -10
package/build/list-utils.ts
DELETED
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import { ruleList } from "./rule-list.ts";
|
|
2
|
-
|
|
3
|
-
export const getList = (type: string) => {
|
|
4
|
-
return ruleList
|
|
5
|
-
.filter((list) => {
|
|
6
|
-
return list.type === type;
|
|
7
|
-
})
|
|
8
|
-
.sort((a, b) => {
|
|
9
|
-
return (a.order ?? 0) - (b.order ?? 0);
|
|
10
|
-
});
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export const getTypeImportStrings = (type: string) => {
|
|
14
|
-
return ruleList
|
|
15
|
-
.filter((list) => {
|
|
16
|
-
return list.type === type;
|
|
17
|
-
})
|
|
18
|
-
.map((item) => {
|
|
19
|
-
return item.importString;
|
|
20
|
-
})
|
|
21
|
-
.filter(Boolean);
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export const getListJson = (list: typeof ruleList) => {
|
|
25
|
-
return list
|
|
26
|
-
.map((list) => {
|
|
27
|
-
return JSON.stringify(list.list).slice(1, -1);
|
|
28
|
-
})
|
|
29
|
-
.join(",");
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
export const getTypeLanguage = (type: string) => {
|
|
33
|
-
switch (type) {
|
|
34
|
-
case "json": {
|
|
35
|
-
return "json/json";
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
case "jsonc": {
|
|
39
|
-
return "json/jsonc";
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
case "json5": {
|
|
43
|
-
return "json/json5";
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
default: {
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
export const getTypeFiles = (type: string) => {
|
|
53
|
-
switch (type) {
|
|
54
|
-
case "core": {
|
|
55
|
-
return ["**/*.{js,ts,jsx,tsx,cjs,cts,mjs,mts}"];
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
case "markdown": {
|
|
59
|
-
return ["**/*.md"];
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
case "json": {
|
|
63
|
-
return ["**/*.json"];
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
case "jsonc": {
|
|
67
|
-
return ["**/*.jsonc"];
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
case "json5": {
|
|
71
|
-
return ["**/*.json5"];
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
case "react": {
|
|
75
|
-
return ["**/*.{jsx,tsx}"];
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
case "astro": {
|
|
79
|
-
return ["**/*.{astro}"];
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
case "solid": {
|
|
83
|
-
return ["**/*.{jsx,tsx}"];
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
default: {
|
|
87
|
-
return [];
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
export const getListPlugins = (list: typeof ruleList) => {
|
|
93
|
-
let pluginString = "";
|
|
94
|
-
|
|
95
|
-
for (const item of list) {
|
|
96
|
-
if (item.pluginName && item.pluginValue) {
|
|
97
|
-
pluginString += `"${item.pluginName}": ${item.pluginValue},`;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
return pluginString;
|
|
102
|
-
};
|
package/build/rule-list.ts
DELETED
|
@@ -1,293 +0,0 @@
|
|
|
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 { jsonRules } from "../setup/json.ts";
|
|
9
|
-
import { lodashRules } from "../setup/lodash.ts";
|
|
10
|
-
import { markdownRules } from "../setup/markdown.ts";
|
|
11
|
-
import { nRules } from "../setup/n.ts";
|
|
12
|
-
import { perfectionistRules } from "../setup/perfectionist.ts";
|
|
13
|
-
import {
|
|
14
|
-
reactCompilerRules,
|
|
15
|
-
reactHookRules,
|
|
16
|
-
reactRules,
|
|
17
|
-
} from "../setup/react.ts";
|
|
18
|
-
import { solidRules } from "../setup/solid.ts";
|
|
19
|
-
import { sonarRules } from "../setup/sonar.ts";
|
|
20
|
-
import { stylisticRules } from "../setup/stylistic.ts";
|
|
21
|
-
import { tailwindRules } from "../setup/tailwind.ts";
|
|
22
|
-
import { tanstackQueryRules } from "../setup/tanstack-query.ts";
|
|
23
|
-
import { typescriptRules } from "../setup/typescript-eslint.ts";
|
|
24
|
-
import { unicornRules } from "../setup/unicorn.ts";
|
|
25
|
-
import { cspellRules } from "../setup/cspell.js";
|
|
26
|
-
import { tanstackRouterRules } from "../setup/tanstack-router.js";
|
|
27
|
-
import { stylisticTsRules } from "../setup/stylistic-ts.js";
|
|
28
|
-
|
|
29
|
-
export const ruleList = [
|
|
30
|
-
{
|
|
31
|
-
importString: 'import depend from "eslint-plugin-depend";',
|
|
32
|
-
list: dependRules,
|
|
33
|
-
name: "eslint-plugin-depend",
|
|
34
|
-
order: 0,
|
|
35
|
-
pluginName: "depend",
|
|
36
|
-
pluginValue: "depend",
|
|
37
|
-
type: "core",
|
|
38
|
-
url: "https://github.com/es-tooling/eslint-plugin-depend/tree/main",
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
importString: 'import barrel from "eslint-plugin-barrel-files";',
|
|
42
|
-
list: barrelRules,
|
|
43
|
-
name: "eslint-plugin-barrel-files",
|
|
44
|
-
order: 1,
|
|
45
|
-
pluginName: "barrel",
|
|
46
|
-
pluginValue: "barrel",
|
|
47
|
-
type: "core",
|
|
48
|
-
url: "https://github.com/thepassle/eslint-plugin-barrel-files",
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
importString: 'import compat from "eslint-plugin-compat";',
|
|
52
|
-
list: compatRules,
|
|
53
|
-
name: "eslint-plugin-compat",
|
|
54
|
-
order: 2,
|
|
55
|
-
pluginName: "compat",
|
|
56
|
-
pluginValue: "compat",
|
|
57
|
-
type: "core",
|
|
58
|
-
url: "https://github.com/amilajack/eslint-plugin-compat",
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
importString: undefined,
|
|
62
|
-
list: eslintRules,
|
|
63
|
-
name: "@eslint/js",
|
|
64
|
-
order: 3,
|
|
65
|
-
pluginName: undefined,
|
|
66
|
-
pluginValue: undefined,
|
|
67
|
-
type: "core",
|
|
68
|
-
url: "https://github.com/eslint/eslint/tree/main/packages/js",
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
importString: 'import n from "eslint-plugin-n";',
|
|
72
|
-
list: nRules,
|
|
73
|
-
name: "eslint-plugin-n",
|
|
74
|
-
order: 4,
|
|
75
|
-
pluginName: "n",
|
|
76
|
-
pluginValue: "n",
|
|
77
|
-
type: "core",
|
|
78
|
-
url: "https://github.com/eslint-community/eslint-plugin-n",
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
importString: 'import tseslint from "typescript-eslint";',
|
|
82
|
-
list: typescriptRules,
|
|
83
|
-
name: "@typescript/eslint",
|
|
84
|
-
order: 5,
|
|
85
|
-
pluginName: "@typescript-eslint",
|
|
86
|
-
pluginValue: "tseslint.plugin",
|
|
87
|
-
type: "core",
|
|
88
|
-
url: "https://github.com/typescript-eslint/typescript-eslint",
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
importString: 'import unicorn from "eslint-plugin-unicorn";',
|
|
92
|
-
list: unicornRules,
|
|
93
|
-
name: "sindresorhus/eslint-plugin-unicorn",
|
|
94
|
-
order: 6,
|
|
95
|
-
pluginName: "unicorn",
|
|
96
|
-
pluginValue: "unicorn",
|
|
97
|
-
type: "core",
|
|
98
|
-
url: "https://github.com/sindresorhus/eslint-plugin-unicorn",
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
importString: 'import lodashConfig from "eslint-plugin-lodash";',
|
|
102
|
-
list: lodashRules,
|
|
103
|
-
name: "eslint-plugin-lodash",
|
|
104
|
-
order: 7,
|
|
105
|
-
pluginName: "lodash",
|
|
106
|
-
pluginValue: "lodashConfig",
|
|
107
|
-
type: "core",
|
|
108
|
-
url: "https://github.com/wix-incubator/eslint-plugin-lodash",
|
|
109
|
-
},
|
|
110
|
-
{
|
|
111
|
-
importString: 'import sonar from "eslint-plugin-sonarjs";',
|
|
112
|
-
list: sonarRules,
|
|
113
|
-
name: "eslint-plugin-sonarjs",
|
|
114
|
-
order: 8,
|
|
115
|
-
pluginName: "sonar",
|
|
116
|
-
pluginValue: "fixupPluginRules(sonar)", // TODO remove with v9 compat
|
|
117
|
-
type: "core",
|
|
118
|
-
url: "https://github.com/SonarSource/SonarJS/blob/master/packages/jsts/src/rules/README.md",
|
|
119
|
-
},
|
|
120
|
-
{
|
|
121
|
-
importString: 'import tailwind from "eslint-plugin-tailwindcss";',
|
|
122
|
-
list: tailwindRules,
|
|
123
|
-
name: "eslint-plugin-tailwindcss",
|
|
124
|
-
order: 9,
|
|
125
|
-
pluginName: "tailwind",
|
|
126
|
-
pluginValue: "tailwind",
|
|
127
|
-
type: "core",
|
|
128
|
-
url: "https://github.com/francoismassart/eslint-plugin-tailwindcss",
|
|
129
|
-
},
|
|
130
|
-
{
|
|
131
|
-
importString: 'import stylistic from "@stylistic/eslint-plugin";',
|
|
132
|
-
list: stylisticRules,
|
|
133
|
-
name: "@stylistic/eslint-plugin",
|
|
134
|
-
order: 10,
|
|
135
|
-
pluginName: "stylistic",
|
|
136
|
-
pluginValue: "stylistic",
|
|
137
|
-
type: "core",
|
|
138
|
-
url: "https://eslint.style/",
|
|
139
|
-
},
|
|
140
|
-
{
|
|
141
|
-
importString: 'import stylisticTs from "@stylistic/eslint-plugin-ts";',
|
|
142
|
-
list: stylisticTsRules,
|
|
143
|
-
name: "@stylistic/eslint-plugin-ts",
|
|
144
|
-
order: 11,
|
|
145
|
-
pluginName: "stylistic-ts",
|
|
146
|
-
pluginValue: "stylisticTs",
|
|
147
|
-
type: "core",
|
|
148
|
-
url: "https://eslint.style/",
|
|
149
|
-
},
|
|
150
|
-
{
|
|
151
|
-
importString: 'import perfectionist from "eslint-plugin-perfectionist";',
|
|
152
|
-
list: perfectionistRules,
|
|
153
|
-
name: "eslint-plugin-perfectionist",
|
|
154
|
-
order: 12,
|
|
155
|
-
pluginName: "perfectionist",
|
|
156
|
-
pluginValue: "perfectionist",
|
|
157
|
-
type: "core",
|
|
158
|
-
url: "https://github.com/azat-io/eslint-plugin-perfectionist",
|
|
159
|
-
},
|
|
160
|
-
{
|
|
161
|
-
importString: 'import tanstackQuery from "@tanstack/eslint-plugin-query";',
|
|
162
|
-
list: tanstackQueryRules,
|
|
163
|
-
name: "@tanstack/eslint-plugin-query",
|
|
164
|
-
order: 13,
|
|
165
|
-
pluginName: "@tanstack/query",
|
|
166
|
-
pluginValue: "tanstackQuery",
|
|
167
|
-
type: "core",
|
|
168
|
-
url: "https://tanstack.com/query/latest/docs/eslint/eslint-plugin-query",
|
|
169
|
-
},
|
|
170
|
-
{
|
|
171
|
-
importString:
|
|
172
|
-
'import tanstackRouter from "@tanstack/eslint-plugin-router";',
|
|
173
|
-
list: tanstackRouterRules,
|
|
174
|
-
name: "@tanstack/eslint-plugin-router",
|
|
175
|
-
order: 14,
|
|
176
|
-
pluginName: "@tanstack/router",
|
|
177
|
-
pluginValue: "tanstackRouter",
|
|
178
|
-
type: "core",
|
|
179
|
-
url: "https://tanstack.com/router/latest/docs/eslint/eslint-plugin-router",
|
|
180
|
-
},
|
|
181
|
-
{
|
|
182
|
-
importString: 'import a11y from "eslint-plugin-jsx-a11y";',
|
|
183
|
-
list: a11yRules,
|
|
184
|
-
name: "jsx-a11y",
|
|
185
|
-
order: 15,
|
|
186
|
-
pluginName: "a11y",
|
|
187
|
-
pluginValue: "a11y",
|
|
188
|
-
type: "core",
|
|
189
|
-
url: "https://github.com/jsx-eslint/eslint-plugin-jsx-a11y",
|
|
190
|
-
},
|
|
191
|
-
{
|
|
192
|
-
importString: undefined,
|
|
193
|
-
list: deprecatedRules,
|
|
194
|
-
name: "@eslint/js",
|
|
195
|
-
order: 16,
|
|
196
|
-
pluginName: undefined,
|
|
197
|
-
pluginValue: undefined,
|
|
198
|
-
type: "core",
|
|
199
|
-
url: "https://github.com/eslint/eslint/tree/main/packages/js",
|
|
200
|
-
},
|
|
201
|
-
{
|
|
202
|
-
importString: 'import markdown from "@eslint/markdown";',
|
|
203
|
-
list: markdownRules,
|
|
204
|
-
name: "@eslint/markdown",
|
|
205
|
-
order: 0,
|
|
206
|
-
pluginName: "markdown",
|
|
207
|
-
pluginValue: "markdown",
|
|
208
|
-
type: "markdown",
|
|
209
|
-
url: "https://github.com/eslint/markdown",
|
|
210
|
-
},
|
|
211
|
-
{
|
|
212
|
-
importString: 'import json from "@eslint/json";',
|
|
213
|
-
list: jsonRules,
|
|
214
|
-
name: "@eslint/json",
|
|
215
|
-
order: 0,
|
|
216
|
-
pluginName: "json",
|
|
217
|
-
pluginValue: "json",
|
|
218
|
-
type: "json",
|
|
219
|
-
url: "https://github.com/eslint/json",
|
|
220
|
-
},
|
|
221
|
-
{
|
|
222
|
-
list: jsonRules,
|
|
223
|
-
name: "@eslint/json",
|
|
224
|
-
order: 0,
|
|
225
|
-
pluginName: "json",
|
|
226
|
-
pluginValue: "json",
|
|
227
|
-
type: "jsonc",
|
|
228
|
-
url: "https://github.com/eslint/json",
|
|
229
|
-
},
|
|
230
|
-
{
|
|
231
|
-
list: jsonRules,
|
|
232
|
-
name: "@eslint/json",
|
|
233
|
-
order: 0,
|
|
234
|
-
pluginName: "json",
|
|
235
|
-
pluginValue: "json",
|
|
236
|
-
type: "json5",
|
|
237
|
-
url: "https://github.com/eslint/json",
|
|
238
|
-
},
|
|
239
|
-
{
|
|
240
|
-
importString: 'import astro from "eslint-plugin-astro";',
|
|
241
|
-
list: astroRules,
|
|
242
|
-
name: "eslint-plugin-astro",
|
|
243
|
-
pluginName: "astro",
|
|
244
|
-
pluginValue: "astro",
|
|
245
|
-
type: "astro",
|
|
246
|
-
url: "https://github.com/ota-meshi/eslint-plugin-astro",
|
|
247
|
-
},
|
|
248
|
-
{
|
|
249
|
-
importString: 'import react from "@eslint-react/eslint-plugin";',
|
|
250
|
-
list: reactRules,
|
|
251
|
-
name: "@eslint-react/eslint-plugin",
|
|
252
|
-
pluginName: "react",
|
|
253
|
-
pluginValue: "react",
|
|
254
|
-
type: "react",
|
|
255
|
-
url: "https://eslint-react.xyz/",
|
|
256
|
-
},
|
|
257
|
-
{
|
|
258
|
-
importString: 'import reactHooks from "eslint-plugin-react-hooks";',
|
|
259
|
-
list: reactHookRules,
|
|
260
|
-
name: "eslint-plugin-react-hooks",
|
|
261
|
-
pluginName: "react-hooks",
|
|
262
|
-
pluginValue: "reactHooks",
|
|
263
|
-
type: "react",
|
|
264
|
-
url: "https://github.com/facebook/react/tree/main/packages/eslint-plugin-react-hooks",
|
|
265
|
-
},
|
|
266
|
-
{
|
|
267
|
-
importString: 'import reactCompiler from "eslint-plugin-react-compiler";',
|
|
268
|
-
list: reactCompilerRules,
|
|
269
|
-
name: "eslint-plugin-react-compiler",
|
|
270
|
-
pluginName: "react-compiler",
|
|
271
|
-
pluginValue: "reactCompiler",
|
|
272
|
-
type: "react",
|
|
273
|
-
url: "https://github.com/facebook/react/tree/main/compiler/packages/eslint-plugin-react-compiler",
|
|
274
|
-
},
|
|
275
|
-
{
|
|
276
|
-
importString: 'import solid from "eslint-plugin-solid";',
|
|
277
|
-
list: solidRules,
|
|
278
|
-
name: "eslint-plugin-solid",
|
|
279
|
-
pluginName: "solid",
|
|
280
|
-
pluginValue: "solid",
|
|
281
|
-
type: "solid",
|
|
282
|
-
url: "https://github.com/solidjs-community/eslint-plugin-solid",
|
|
283
|
-
},
|
|
284
|
-
{
|
|
285
|
-
importString: 'import cspell from "@cspell/eslint-plugin";',
|
|
286
|
-
list: cspellRules,
|
|
287
|
-
name: "@cspell/eslint-plugin",
|
|
288
|
-
pluginName: "cspell",
|
|
289
|
-
pluginValue: "cspell",
|
|
290
|
-
type: "core",
|
|
291
|
-
url: "https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell-eslint-plugin",
|
|
292
|
-
},
|
|
293
|
-
];
|
package/build/update-readme.ts
DELETED
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
import { MarkdownGenerator } from "@ethang/markdown-generator/markdown-generator.js";
|
|
2
|
-
import { writeFileSync } from "node:fs";
|
|
3
|
-
import { join } from "node:path";
|
|
4
|
-
|
|
5
|
-
import type { genRules } from "../setup/gen-rules.ts";
|
|
6
|
-
|
|
7
|
-
import { getList } from "./list-utils.ts";
|
|
8
|
-
|
|
9
|
-
export const updateReadme = () => {
|
|
10
|
-
const md = new MarkdownGenerator();
|
|
11
|
-
md.header(1, "Relentless. Unapologetic.", 2);
|
|
12
|
-
md.link("View Config", "https://eslint-config-ethang.pages.dev/rules", 2);
|
|
13
|
-
md.alert(
|
|
14
|
-
"CAUTION",
|
|
15
|
-
"Do not use this with Prettier! Styling rules are included.",
|
|
16
|
-
2,
|
|
17
|
-
);
|
|
18
|
-
|
|
19
|
-
const getRuleCount = (rules: ReturnType<typeof genRules>) => {
|
|
20
|
-
let count = 0;
|
|
21
|
-
for (const value of Object.values(rules)) {
|
|
22
|
-
if ("error" === value || (Array.isArray(value) && "error" === value[0])) {
|
|
23
|
-
count += 1;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
return count;
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
const coreRules = [
|
|
31
|
-
...getList("core"),
|
|
32
|
-
...getList("json"),
|
|
33
|
-
...getList("markdown"),
|
|
34
|
-
].map((rules) => {
|
|
35
|
-
return {
|
|
36
|
-
...rules,
|
|
37
|
-
count: 0,
|
|
38
|
-
};
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
let total = 0;
|
|
42
|
-
for (const list of coreRules) {
|
|
43
|
-
const count = getRuleCount(list.list);
|
|
44
|
-
total += count;
|
|
45
|
-
list.count = count;
|
|
46
|
-
}
|
|
47
|
-
coreRules.sort((a, b) => {
|
|
48
|
-
return b.count - a.count;
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
const ruleDocs = [`${total} errored rules.`];
|
|
52
|
-
for (const list of coreRules) {
|
|
53
|
-
if (1 > list.count) {
|
|
54
|
-
continue;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
ruleDocs.push(
|
|
58
|
-
`${list.count} ${
|
|
59
|
-
1 >= list.count ? "rule" : "rules"
|
|
60
|
-
} from [${list.name}](${list.url})`,
|
|
61
|
-
);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
const astroRules = getList("astro");
|
|
65
|
-
const reactRules = getList("react");
|
|
66
|
-
const solidRules = getList("solid");
|
|
67
|
-
|
|
68
|
-
let astroCount = 0;
|
|
69
|
-
for (const astroRule of astroRules) {
|
|
70
|
-
astroCount += getRuleCount(astroRule.list);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
let reactCount = 0;
|
|
74
|
-
for (const reactRule of reactRules) {
|
|
75
|
-
reactCount += getRuleCount(reactRule.list);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
let solidCount = 0;
|
|
79
|
-
for (const solidRule of solidRules) {
|
|
80
|
-
solidCount += getRuleCount(solidRule.list);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
md.unorderedList(ruleDocs);
|
|
84
|
-
md.newLine();
|
|
85
|
-
md.header(1, "Add Even More!", 2);
|
|
86
|
-
md.unorderedList([
|
|
87
|
-
`${astroCount} rules for **Astro**`,
|
|
88
|
-
[
|
|
89
|
-
'`import astroConfig from "@ethang/eslint-config/config.astro.js";`',
|
|
90
|
-
...astroRules
|
|
91
|
-
.filter((rule) => {
|
|
92
|
-
return 0 < getRuleCount(rule.list);
|
|
93
|
-
})
|
|
94
|
-
.map((rule) => {
|
|
95
|
-
return `${getRuleCount(rule.list)} rules from [${rule.name}](${rule.url})`;
|
|
96
|
-
}),
|
|
97
|
-
],
|
|
98
|
-
`${reactCount} rules for **React**`,
|
|
99
|
-
[
|
|
100
|
-
'`import reactConfig from "@ethang/eslint-config/config.react.js";`',
|
|
101
|
-
...reactRules
|
|
102
|
-
.filter((rule) => {
|
|
103
|
-
return 0 < getRuleCount(rule.list);
|
|
104
|
-
})
|
|
105
|
-
.map((rule) => {
|
|
106
|
-
return `${getRuleCount(rule.list)} rules from [${rule.name}](${rule.url})`;
|
|
107
|
-
}),
|
|
108
|
-
],
|
|
109
|
-
`${solidCount} rules for **Solid**`,
|
|
110
|
-
[
|
|
111
|
-
'`import solidConfig from "@ethang/eslint-config/config.solid.js";`',
|
|
112
|
-
...solidRules
|
|
113
|
-
.filter((rule) => {
|
|
114
|
-
return 0 < getRuleCount(rule.list);
|
|
115
|
-
})
|
|
116
|
-
.map((rule) => {
|
|
117
|
-
return `${getRuleCount(rule.list)} rules from [${rule.name}](${rule.url})`;
|
|
118
|
-
}),
|
|
119
|
-
],
|
|
120
|
-
]);
|
|
121
|
-
md.newLine();
|
|
122
|
-
md.header(1, "Install", 2);
|
|
123
|
-
md.inlineCode("pnpm i -D eslint typescript-eslint @ethang/eslint-config", 2);
|
|
124
|
-
md.bold("Requires TypesScript and tsconfig.json at root directory.", 2);
|
|
125
|
-
md.header(1, "Config", 2);
|
|
126
|
-
md.text("In **eslint.config.js**", 2);
|
|
127
|
-
md.codeBlock(
|
|
128
|
-
`import config from "@ethang/eslint-config/eslint.config.js";
|
|
129
|
-
import tseslint from "typescript-eslint";
|
|
130
|
-
import astroConfig from "@ethang/eslint-config/config.astro.js"; // OPTIONAL
|
|
131
|
-
import reactConfig from "@ethang/eslint-config/config.react.js"; // OPTIONAL
|
|
132
|
-
|
|
133
|
-
export default tseslint.config(
|
|
134
|
-
{
|
|
135
|
-
ignores: [], // Ignored files apply to all following configs
|
|
136
|
-
},
|
|
137
|
-
...config,
|
|
138
|
-
...astroConfig,
|
|
139
|
-
...reactConfig,
|
|
140
|
-
{
|
|
141
|
-
languageOptions: {
|
|
142
|
-
parserOptions: {
|
|
143
|
-
project: true,
|
|
144
|
-
tsconfigRootDir: import.meta.dirname,
|
|
145
|
-
},
|
|
146
|
-
},
|
|
147
|
-
rules: {
|
|
148
|
-
// Override rules from above configs
|
|
149
|
-
},
|
|
150
|
-
}
|
|
151
|
-
);`,
|
|
152
|
-
"js",
|
|
153
|
-
2,
|
|
154
|
-
);
|
|
155
|
-
md.bold("Scripts", 2);
|
|
156
|
-
md.codeBlock(
|
|
157
|
-
`"scripts": {
|
|
158
|
-
"lint": "eslint",
|
|
159
|
-
"lint:fix": "eslint . --fix",
|
|
160
|
-
}`,
|
|
161
|
-
"json",
|
|
162
|
-
2,
|
|
163
|
-
);
|
|
164
|
-
md.bold("Browserslist", 2);
|
|
165
|
-
md.text(
|
|
166
|
-
"This config will also lint for browserslist features. Make sure to set this in package.json. [More info.](https://github.com/browserslist/browserslist)",
|
|
167
|
-
2,
|
|
168
|
-
);
|
|
169
|
-
md.codeBlock(
|
|
170
|
-
`"browserslist": [
|
|
171
|
-
"defaults and fully supports es6-module",
|
|
172
|
-
"maintained node versions"
|
|
173
|
-
]`,
|
|
174
|
-
"json",
|
|
175
|
-
);
|
|
176
|
-
|
|
177
|
-
writeFileSync(join(import.meta.dirname, "../README.md"), md.render(), "utf8");
|
|
178
|
-
};
|
|
179
|
-
|
|
180
|
-
updateReadme();
|
package/build/update-rules.ts
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import type { ConfigOptions } from "./create-config.ts";
|
|
2
|
-
|
|
3
|
-
import { createConfigFile } from "./create-config-file.ts";
|
|
4
|
-
|
|
5
|
-
export type ConfigFile = {
|
|
6
|
-
importString?: string;
|
|
7
|
-
label?: string;
|
|
8
|
-
name: string;
|
|
9
|
-
options?: ConfigOptions;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export const coreFile = [
|
|
13
|
-
{
|
|
14
|
-
importString: 'import config from "@ethang/eslint-config/eslint.config.js',
|
|
15
|
-
label: "Core",
|
|
16
|
-
name: "core",
|
|
17
|
-
options: {
|
|
18
|
-
extraImports: ['import { fixupPluginRules } from "@eslint/compat";'], // TODO remove with v9 compat
|
|
19
|
-
includeIgnores: true,
|
|
20
|
-
includeLanguageOptions: true,
|
|
21
|
-
includeReactVersion: true,
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
name: "markdown",
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
name: "json",
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
name: "jsonc",
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
name: "json5",
|
|
35
|
-
},
|
|
36
|
-
];
|
|
37
|
-
|
|
38
|
-
const astroFile = [
|
|
39
|
-
{
|
|
40
|
-
importString:
|
|
41
|
-
'import astroConfig from "@ethang/eslint-config/config.astro.ts',
|
|
42
|
-
label: "Astro",
|
|
43
|
-
name: "astro",
|
|
44
|
-
options: {
|
|
45
|
-
extraImports: ['import tseslint from "typescript-eslint";'],
|
|
46
|
-
includeIgnores: true,
|
|
47
|
-
includeLanguageOptions: true,
|
|
48
|
-
},
|
|
49
|
-
},
|
|
50
|
-
];
|
|
51
|
-
|
|
52
|
-
const reactFile = [
|
|
53
|
-
{
|
|
54
|
-
importString:
|
|
55
|
-
'import reactConfig from "@ethang/eslint-config/config.react.ts',
|
|
56
|
-
label: "React",
|
|
57
|
-
name: "react",
|
|
58
|
-
options: {
|
|
59
|
-
extraImports: ['import tseslint from "typescript-eslint";'],
|
|
60
|
-
includeIgnores: true,
|
|
61
|
-
includeLanguageOptions: true,
|
|
62
|
-
includeReactVersion: true,
|
|
63
|
-
},
|
|
64
|
-
},
|
|
65
|
-
];
|
|
66
|
-
|
|
67
|
-
const solidFile = [
|
|
68
|
-
{
|
|
69
|
-
importString:
|
|
70
|
-
'import reactConfig from "@ethang/eslint-config/config.solid.ts',
|
|
71
|
-
label: "Solid",
|
|
72
|
-
name: "solid",
|
|
73
|
-
options: {
|
|
74
|
-
extraImports: ['import tseslint from "typescript-eslint";'],
|
|
75
|
-
includeIgnores: true,
|
|
76
|
-
includeLanguageOptions: true,
|
|
77
|
-
},
|
|
78
|
-
},
|
|
79
|
-
];
|
|
80
|
-
|
|
81
|
-
export const secondaryRules = {
|
|
82
|
-
astro: astroFile,
|
|
83
|
-
react: reactFile,
|
|
84
|
-
solid: solidFile,
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
export const allRules = {
|
|
88
|
-
core: coreFile,
|
|
89
|
-
...secondaryRules,
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
export const updateRules = async () => {
|
|
93
|
-
await Promise.all([
|
|
94
|
-
createConfigFile(coreFile, "eslint.config.js"),
|
|
95
|
-
createConfigFile(astroFile, "config.astro.js"),
|
|
96
|
-
createConfigFile(reactFile, "config.react.js"),
|
|
97
|
-
createConfigFile(solidFile, "config.solid.js"),
|
|
98
|
-
]);
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
await updateRules();
|
package/build.mjs
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
// @ts-check
|
|
2
|
-
import { projectBuilder } from "@ethang/project-builder/project-builder.js";
|
|
3
|
-
|
|
4
|
-
await projectBuilder("eslint-config-ethang", "master", {
|
|
5
|
-
isLibrary: true,
|
|
6
|
-
scripts: [
|
|
7
|
-
"pnpm up -i --latest",
|
|
8
|
-
"pnpm dedupe",
|
|
9
|
-
"bun ./build/update-rules.ts",
|
|
10
|
-
"bun ./build/update-readme.ts",
|
|
11
|
-
"pnpm lint",
|
|
12
|
-
],
|
|
13
|
-
tsupOptions: {
|
|
14
|
-
bundle: true,
|
|
15
|
-
},
|
|
16
|
-
});
|
package/setup/a11y.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import a11y from "eslint-plugin-jsx-a11y";
|
|
2
|
-
|
|
3
|
-
import { genRules, getNonDeprecatedRules } from "./gen-rules.ts";
|
|
4
|
-
|
|
5
|
-
const ruleNames = Object.keys(getNonDeprecatedRules(a11y.rules ?? {}));
|
|
6
|
-
const customRules = [
|
|
7
|
-
{
|
|
8
|
-
// throws false positives
|
|
9
|
-
name: "control-has-associated-label",
|
|
10
|
-
rule: "off",
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
name: "media-has-caption",
|
|
14
|
-
rule: "off",
|
|
15
|
-
},
|
|
16
|
-
];
|
|
17
|
-
|
|
18
|
-
export const a11yRules = genRules(ruleNames, customRules, "a11y");
|