@ethang/eslint-config 19.7.1 → 19.7.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/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 +25 -2
- package/package.json +1 -1
- package/setup/perfectionist.ts +4 -0
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
|
@@ -1094,7 +1094,7 @@ export default tseslint.config(
|
|
|
1094
1094
|
"perfectionist/sort-named-exports": "error",
|
|
1095
1095
|
"perfectionist/sort-named-imports": "error",
|
|
1096
1096
|
"perfectionist/sort-object-types": "error",
|
|
1097
|
-
"perfectionist/sort-objects": "error",
|
|
1097
|
+
"perfectionist/sort-objects": ["error", { partitionByComment: true }],
|
|
1098
1098
|
"perfectionist/sort-sets": "error",
|
|
1099
1099
|
"perfectionist/sort-svelte-attributes": [
|
|
1100
1100
|
"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
package/setup/perfectionist.ts
CHANGED