@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 CHANGED
@@ -5,7 +5,7 @@
5
5
  > [!CAUTION]
6
6
  > Do not use this with Prettier! Styling rules are included.
7
7
 
8
- - 890 errored rules.
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)
@@ -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
@@ -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": "error",
936
- "exception-handling/no-unhandled": "error",
937
- "exception-handling/use-error-cause": "error",
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: ["**/*.{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.0",
3
+ "version": "19.7.2",
4
4
  "repository": {
5
5
  "url": "git+https://github.com/eglove/eslint-config-ethang.git"
6
6
  },
@@ -9,4 +9,5 @@ export const exceptionHandlingRules = genRules(
9
9
  ruleNames,
10
10
  [],
11
11
  "exception-handling",
12
+ "off", // TODO fix with https://github.com/Akronae/eslint-plugin-exception-handling/issues/5
12
13
  );