@ethang/eslint-config 19.7.0 → 19.7.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/README.md +1 -2
- package/build/create-config.ts +4 -1
- package/build/list-utils.ts +29 -1
- package/build/rule-list.ts +18 -0
- package/build/update-rules.ts +6 -0
- package/eslint.config.js +27 -4
- package/package.json +1 -1
- package/setup/exception-handling.ts +1 -0
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)
|
|
@@ -19,7 +19,6 @@
|
|
|
19
19
|
- 7 rules from [@eslint/markdown](https://github.com/eslint/markdown)
|
|
20
20
|
- 5 rules from [@tanstack/eslint-plugin-query](https://tanstack.com/query/latest/docs/eslint/eslint-plugin-query)
|
|
21
21
|
- 4 rules from [eslint-plugin-barrel-files](https://github.com/thepassle/eslint-plugin-barrel-files)
|
|
22
|
-
- 3 rules from [exception-handling](https://github.com/Akronae/eslint-plugin-exception-handling)
|
|
23
22
|
- 2 rules from [@eslint/json](https://github.com/eslint/json)
|
|
24
23
|
- 1 rule from [eslint-plugin-depend](https://github.com/es-tooling/eslint-plugin-depend/tree/main)
|
|
25
24
|
- 1 rule from [@cspell/eslint-plugin](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell-eslint-plugin)
|
package/build/create-config.ts
CHANGED
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
getListJson,
|
|
5
5
|
getListPlugins,
|
|
6
6
|
getTypeFiles,
|
|
7
|
+
getTypeLanguage,
|
|
7
8
|
} from "./list-utils.ts";
|
|
8
9
|
|
|
9
10
|
export type ConfigOptions = {
|
|
@@ -46,8 +47,10 @@ export const createConfig = async (
|
|
|
46
47
|
},`;
|
|
47
48
|
}
|
|
48
49
|
|
|
50
|
+
const language = getTypeLanguage(type);
|
|
51
|
+
|
|
49
52
|
config += `{
|
|
50
|
-
files: ["${getTypeFiles(type)}"],${optionals}
|
|
53
|
+
files: ["${getTypeFiles(type)}"],${optionals}${language ? `language: "${language}",` : ""}
|
|
51
54
|
plugins: {
|
|
52
55
|
${getListPlugins(list)}
|
|
53
56
|
},
|
package/build/list-utils.ts
CHANGED
|
@@ -29,6 +29,26 @@ export const getListJson = (list: typeof ruleList) => {
|
|
|
29
29
|
.join(",");
|
|
30
30
|
};
|
|
31
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
|
+
|
|
32
52
|
export const getTypeFiles = (type: string) => {
|
|
33
53
|
switch (type) {
|
|
34
54
|
case "core": {
|
|
@@ -40,7 +60,15 @@ export const getTypeFiles = (type: string) => {
|
|
|
40
60
|
}
|
|
41
61
|
|
|
42
62
|
case "json": {
|
|
43
|
-
return ["**/*.
|
|
63
|
+
return ["**/*.json"];
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
case "jsonc": {
|
|
67
|
+
return ["**/*.jsonc"];
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
case "json5": {
|
|
71
|
+
return ["**/*.json5"];
|
|
44
72
|
}
|
|
45
73
|
|
|
46
74
|
case "react": {
|
package/build/rule-list.ts
CHANGED
|
@@ -215,6 +215,24 @@ export const ruleList = [
|
|
|
215
215
|
type: "json",
|
|
216
216
|
url: "https://github.com/eslint/json",
|
|
217
217
|
},
|
|
218
|
+
{
|
|
219
|
+
list: jsonRules,
|
|
220
|
+
name: "@eslint/json",
|
|
221
|
+
order: 0,
|
|
222
|
+
pluginName: "json",
|
|
223
|
+
pluginValue: "json",
|
|
224
|
+
type: "jsonc",
|
|
225
|
+
url: "https://github.com/eslint/json",
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
list: jsonRules,
|
|
229
|
+
name: "@eslint/json",
|
|
230
|
+
order: 0,
|
|
231
|
+
pluginName: "json",
|
|
232
|
+
pluginValue: "json",
|
|
233
|
+
type: "json5",
|
|
234
|
+
url: "https://github.com/eslint/json",
|
|
235
|
+
},
|
|
218
236
|
{
|
|
219
237
|
importString: 'import astro from "eslint-plugin-astro";',
|
|
220
238
|
list: astroRules,
|
package/build/update-rules.ts
CHANGED
package/eslint.config.js
CHANGED
|
@@ -932,9 +932,9 @@ export default tseslint.config(
|
|
|
932
932
|
"sonar/weak-ssl": "error",
|
|
933
933
|
"sonar/x-powered-by": "error",
|
|
934
934
|
"sonar/xml-parser-xxe": "error",
|
|
935
|
-
"exception-handling/might-throw": "
|
|
936
|
-
"exception-handling/no-unhandled": "
|
|
937
|
-
"exception-handling/use-error-cause": "
|
|
935
|
+
"exception-handling/might-throw": "off",
|
|
936
|
+
"exception-handling/no-unhandled": "off",
|
|
937
|
+
"exception-handling/use-error-cause": "off",
|
|
938
938
|
"tailwind/classnames-order": "error",
|
|
939
939
|
"tailwind/enforces-negative-arbitrary-values": "error",
|
|
940
940
|
"tailwind/enforces-shorthand": "error",
|
|
@@ -1266,7 +1266,30 @@ export default tseslint.config(
|
|
|
1266
1266
|
},
|
|
1267
1267
|
},
|
|
1268
1268
|
{
|
|
1269
|
-
files: ["**/*.
|
|
1269
|
+
files: ["**/*.json"],
|
|
1270
|
+
language: "json/json",
|
|
1271
|
+
plugins: {
|
|
1272
|
+
json: json,
|
|
1273
|
+
},
|
|
1274
|
+
rules: {
|
|
1275
|
+
"json/no-duplicate-keys": "error",
|
|
1276
|
+
"json/no-empty-keys": "error",
|
|
1277
|
+
},
|
|
1278
|
+
},
|
|
1279
|
+
{
|
|
1280
|
+
files: ["**/*.jsonc"],
|
|
1281
|
+
language: "json/jsonc",
|
|
1282
|
+
plugins: {
|
|
1283
|
+
json: json,
|
|
1284
|
+
},
|
|
1285
|
+
rules: {
|
|
1286
|
+
"json/no-duplicate-keys": "error",
|
|
1287
|
+
"json/no-empty-keys": "error",
|
|
1288
|
+
},
|
|
1289
|
+
},
|
|
1290
|
+
{
|
|
1291
|
+
files: ["**/*.json5"],
|
|
1292
|
+
language: "json/json5",
|
|
1270
1293
|
plugins: {
|
|
1271
1294
|
json: json,
|
|
1272
1295
|
},
|
package/package.json
CHANGED