@lenne.tech/eslint-config-ts 2.1.4 → 2.2.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 +22 -3
  2. package/package.json +5 -4
package/index.js CHANGED
@@ -2,7 +2,7 @@ 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";
@@ -12,6 +12,25 @@ import eslintcomments from "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 the `import-x/` prefix to `import/`.
17
+ *
18
+ * We moved from `eslint-plugin-import` to its maintained fork
19
+ * `eslint-plugin-import-x` (the original pins minimatch ^3, which is stuck on a
20
+ * brace-expansion line that upstream no longer patches — GHSA-mh99-v99m-4gvg —
21
+ * and its peer range has no eslint 10 entry at all).
22
+ *
23
+ * The fork registers its own rules under `import-x/`, but a rule's public name
24
+ * comes from the key it is registered under in `plugins`, not from the package.
25
+ * So we keep registering it as `import` and only re-key the rule objects the
26
+ * plugin ships. That keeps every consumer's `import/...` rule override AND every
27
+ * `// eslint-disable-next-line import/...` comment across all lt projects
28
+ * working — renaming them would silently stop suppressing, which is a far worse
29
+ * outcome than the dependency swap is worth.
30
+ */
31
+ const asImportPrefix = (rules) =>
32
+ Object.fromEntries(Object.entries(rules).map(([key, value]) => [key.replace(/^import-x\//, "import/"), value]));
33
+
15
34
  export default [
16
35
  { ignores: ["dist/", ".yalc/", "node_modules/", ".husky/", "extras/"] },
17
36
  {
@@ -36,8 +55,8 @@ export default [
36
55
  ...perfectionist.configs["recommended-natural"].rules,
37
56
  ...typescript.configs["eslint-recommended"].rules,
38
57
  ...typescript.configs["recommended"].rules,
39
- ...importPlugin.configs["typescript"].rules,
40
- ...importPlugin.configs["recommended"].rules,
58
+ ...asImportPrefix(importPlugin.configs["typescript"].rules),
59
+ ...asImportPrefix(importPlugin.configs["recommended"].rules),
41
60
  ...eslintcomments.configs["recommended"].rules,
42
61
  ...jsonc.configs["recommended-with-jsonc"].rules,
43
62
  ...yml.configs["standard"].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.2.0",
4
4
  "description": "ESLint config of lenne.Tech for TypeScript",
5
5
  "license": "MIT",
6
6
  "keywords": [
@@ -20,11 +20,12 @@
20
20
  },
21
21
  "dependencies": {
22
22
  "@stylistic/eslint-plugin": "5.4.0",
23
- "@typescript-eslint/eslint-plugin": "8.46.1",
24
- "@typescript-eslint/parser": "8.46.1",
23
+ "@typescript-eslint/eslint-plugin": "8.65.0",
24
+ "@typescript-eslint/parser": "8.65.0",
25
25
  "eslint-config-prettier": "10.1.8",
26
+ "eslint-import-resolver-node": "0.3.9",
26
27
  "eslint-plugin-eslint-comments": "3.2.0",
27
- "eslint-plugin-import": "2.32.0",
28
+ "eslint-plugin-import-x": "4.17.1",
28
29
  "eslint-plugin-jsonc": "2.21.0",
29
30
  "eslint-plugin-markdown": "5.1.0",
30
31
  "eslint-plugin-no-only-tests": "3.3.0",