@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.
@@ -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
  },
@@ -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 ["**/*.{json,jsonc,json5}"];
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": {
@@ -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,
@@ -27,6 +27,12 @@ export const coreFile = [
27
27
  {
28
28
  name: "json",
29
29
  },
30
+ {
31
+ name: "jsonc",
32
+ },
33
+ {
34
+ name: "json5",
35
+ },
30
36
  ];
31
37
 
32
38
  const astroFile = [
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: ["**/*.{json,jsonc,json5}"],
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ethang/eslint-config",
3
- "version": "19.7.1",
3
+ "version": "19.7.3",
4
4
  "repository": {
5
5
  "url": "git+https://github.com/eglove/eslint-config-ethang.git"
6
6
  },
@@ -38,6 +38,10 @@ const customRules = [
38
38
  name: "sort-jsx-props",
39
39
  rule: ["error", { groups: ["shorthand", "multiline"] }],
40
40
  },
41
+ {
42
+ name: "sort-objects",
43
+ rule: ["error", { partitionByComment: true }],
44
+ },
41
45
  {
42
46
  name: "sort-svelte-attributes",
43
47
  rule: [