@lenne.tech/eslint-config-ts 2.2.0 → 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 +29 -18
  2. package/package.json +10 -10
package/index.js CHANGED
@@ -8,28 +8,39 @@ 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
15
  /**
16
- * Re-key a shipped config's rules from the `import-x/` prefix to `import/`.
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.
17
18
  *
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).
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
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.
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.
30
36
  */
31
- const asImportPrefix = (rules) =>
32
- Object.fromEntries(Object.entries(rules).map(([key, value]) => [key.replace(/^import-x\//, "import/"), value]));
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
+ );
33
44
 
34
45
  export default [
35
46
  { ignores: ["dist/", ".yalc/", "node_modules/", ".husky/", "extras/"] },
@@ -55,9 +66,9 @@ export default [
55
66
  ...perfectionist.configs["recommended-natural"].rules,
56
67
  ...typescript.configs["eslint-recommended"].rules,
57
68
  ...typescript.configs["recommended"].rules,
58
- ...asImportPrefix(importPlugin.configs["typescript"].rules),
59
- ...asImportPrefix(importPlugin.configs["recommended"].rules),
60
- ...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/"),
61
72
  ...jsonc.configs["recommended-with-jsonc"].rules,
62
73
  ...yml.configs["standard"].rules,
63
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.2.0",
3
+ "version": "2.3.0",
4
4
  "description": "ESLint config of lenne.Tech for TypeScript",
5
5
  "license": "MIT",
6
6
  "keywords": [
@@ -16,25 +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",
22
+ "@eslint-community/eslint-plugin-eslint-comments": "4.7.2",
23
+ "@stylistic/eslint-plugin": "5.10.0",
23
24
  "@typescript-eslint/eslint-plugin": "8.65.0",
24
25
  "@typescript-eslint/parser": "8.65.0",
25
26
  "eslint-config-prettier": "10.1.8",
26
- "eslint-import-resolver-node": "0.3.9",
27
- "eslint-plugin-eslint-comments": "3.2.0",
27
+ "eslint-import-resolver-node": "0.4.0",
28
28
  "eslint-plugin-import-x": "4.17.1",
29
- "eslint-plugin-jsonc": "2.21.0",
29
+ "eslint-plugin-jsonc": "3.3.0",
30
30
  "eslint-plugin-markdown": "5.1.0",
31
31
  "eslint-plugin-no-only-tests": "3.3.0",
32
- "eslint-plugin-perfectionist": "4.15.1",
33
- "eslint-plugin-unused-imports": "4.2.0",
34
- "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"
35
35
  },
36
36
  "devDependencies": {
37
- "eslint": "9.37.0",
37
+ "eslint": "10.8.0",
38
38
  "watch": "1.0.2"
39
39
  }
40
40
  }