@lenne.tech/eslint-config-ts 2.1.4 → 2.3.0

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.
Files changed (2) hide show
  1. package/index.js +35 -5
  2. package/package.json +13 -12
package/index.js CHANGED
@@ -2,16 +2,46 @@ console.log("Linting TypeScript...");
2
2
  import tsParser from "@typescript-eslint/parser";
3
3
  import typescript from "@typescript-eslint/eslint-plugin";
4
4
  import perfectionist from "eslint-plugin-perfectionist";
5
- import importPlugin from "eslint-plugin-import";
5
+ import importPlugin from "eslint-plugin-import-x";
6
6
  import unusedImportPlugin from "eslint-plugin-unused-imports";
7
7
  import yml from "eslint-plugin-yml";
8
8
  import stylistic from "@stylistic/eslint-plugin";
9
9
  import markdown from "eslint-plugin-markdown";
10
10
  import jsonc from "eslint-plugin-jsonc";
11
- import eslintcomments from "eslint-plugin-eslint-comments";
11
+ import eslintcomments from "@eslint-community/eslint-plugin-eslint-comments";
12
12
  import noonlytests from "eslint-plugin-no-only-tests";
13
13
  import eslintConfigPrettier from 'eslint-config-prettier';
14
14
 
15
+ /**
16
+ * Re-key a shipped config's rules from a fork's own prefix back to the prefix
17
+ * this config registers the plugin under.
18
+ *
19
+ * Two plugins here are maintained FORKS of unmaintained originals:
20
+ * eslint-plugin-import -> eslint-plugin-import-x (`import-x/`)
21
+ * eslint-plugin-eslint-comments -> @eslint-community/…-eslint-comments (`@eslint-community/eslint-comments/`)
22
+ *
23
+ * Both originals are dead ends for eslint 10: the first pins minimatch ^3,
24
+ * stuck on a brace-expansion line upstream no longer patches
25
+ * (GHSA-mh99-v99m-4gvg), and the second still calls `context.getSourceCode()` /
26
+ * `context.getScope()`, which eslint 10 removed — its permissive `>=4.19.1`
27
+ * peer range is an empty promise.
28
+ *
29
+ * A rule's public name comes from the key it is registered under in `plugins`,
30
+ * not from the package name. So both forks stay registered under the ORIGINAL
31
+ * keys (`import`, `eslint-comments`) and only the rule objects they ship get
32
+ * re-keyed. That keeps every consumer's rule override AND every
33
+ * `// eslint-disable-next-line import/...` or `eslint-comments/...` comment
34
+ * across all lt projects working. Renaming them would silently stop suppressing
35
+ * anything — a far worse outcome than a dependency swap is worth.
36
+ */
37
+ const rekey = (rules, fromPrefix, toPrefix) =>
38
+ Object.fromEntries(
39
+ Object.entries(rules).map(([key, value]) => [
40
+ key.startsWith(fromPrefix) ? toPrefix + key.slice(fromPrefix.length) : key,
41
+ value,
42
+ ]),
43
+ );
44
+
15
45
  export default [
16
46
  { ignores: ["dist/", ".yalc/", "node_modules/", ".husky/", "extras/"] },
17
47
  {
@@ -36,9 +66,9 @@ export default [
36
66
  ...perfectionist.configs["recommended-natural"].rules,
37
67
  ...typescript.configs["eslint-recommended"].rules,
38
68
  ...typescript.configs["recommended"].rules,
39
- ...importPlugin.configs["typescript"].rules,
40
- ...importPlugin.configs["recommended"].rules,
41
- ...eslintcomments.configs["recommended"].rules,
69
+ ...rekey(importPlugin.configs["typescript"].rules, "import-x/", "import/"),
70
+ ...rekey(importPlugin.configs["recommended"].rules, "import-x/", "import/"),
71
+ ...rekey(eslintcomments.configs["recommended"].rules, "@eslint-community/eslint-comments/", "eslint-comments/"),
42
72
  ...jsonc.configs["recommended-with-jsonc"].rules,
43
73
  ...yml.configs["standard"].rules,
44
74
  ...markdown.configs["recommended"].rules,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lenne.tech/eslint-config-ts",
3
- "version": "2.1.4",
3
+ "version": "2.3.0",
4
4
  "description": "ESLint config of lenne.Tech for TypeScript",
5
5
  "license": "MIT",
6
6
  "keywords": [
@@ -16,24 +16,25 @@
16
16
  "reinit": "rimraf package-lock.json && rimraf node_modules && npm cache clean --force && npm i"
17
17
  },
18
18
  "peerDependencies": {
19
- "eslint": ">=9.26.0"
19
+ "eslint": ">=9.38.0"
20
20
  },
21
21
  "dependencies": {
22
- "@stylistic/eslint-plugin": "5.4.0",
23
- "@typescript-eslint/eslint-plugin": "8.46.1",
24
- "@typescript-eslint/parser": "8.46.1",
22
+ "@eslint-community/eslint-plugin-eslint-comments": "4.7.2",
23
+ "@stylistic/eslint-plugin": "5.10.0",
24
+ "@typescript-eslint/eslint-plugin": "8.65.0",
25
+ "@typescript-eslint/parser": "8.65.0",
25
26
  "eslint-config-prettier": "10.1.8",
26
- "eslint-plugin-eslint-comments": "3.2.0",
27
- "eslint-plugin-import": "2.32.0",
28
- "eslint-plugin-jsonc": "2.21.0",
27
+ "eslint-import-resolver-node": "0.4.0",
28
+ "eslint-plugin-import-x": "4.17.1",
29
+ "eslint-plugin-jsonc": "3.3.0",
29
30
  "eslint-plugin-markdown": "5.1.0",
30
31
  "eslint-plugin-no-only-tests": "3.3.0",
31
- "eslint-plugin-perfectionist": "4.15.1",
32
- "eslint-plugin-unused-imports": "4.2.0",
33
- "eslint-plugin-yml": "1.19.0"
32
+ "eslint-plugin-perfectionist": "5.10.0",
33
+ "eslint-plugin-unused-imports": "4.4.1",
34
+ "eslint-plugin-yml": "3.6.0"
34
35
  },
35
36
  "devDependencies": {
36
- "eslint": "9.37.0",
37
+ "eslint": "10.8.0",
37
38
  "watch": "1.0.2"
38
39
  }
39
40
  }