@lenne.tech/eslint-config-ts 2.1.3 → 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 +31 -7
  2. package/package.json +11 -12
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";
@@ -10,6 +10,26 @@ import markdown from "eslint-plugin-markdown";
10
10
  import jsonc from "eslint-plugin-jsonc";
11
11
  import eslintcomments from "eslint-plugin-eslint-comments";
12
12
  import noonlytests from "eslint-plugin-no-only-tests";
13
+ import eslintConfigPrettier from 'eslint-config-prettier';
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]));
13
33
 
14
34
  export default [
15
35
  { ignores: ["dist/", ".yalc/", "node_modules/", ".husky/", "extras/"] },
@@ -35,8 +55,8 @@ export default [
35
55
  ...perfectionist.configs["recommended-natural"].rules,
36
56
  ...typescript.configs["eslint-recommended"].rules,
37
57
  ...typescript.configs["recommended"].rules,
38
- ...importPlugin.configs["typescript"].rules,
39
- ...importPlugin.configs["recommended"].rules,
58
+ ...asImportPrefix(importPlugin.configs["typescript"].rules),
59
+ ...asImportPrefix(importPlugin.configs["recommended"].rules),
40
60
  ...eslintcomments.configs["recommended"].rules,
41
61
  ...jsonc.configs["recommended-with-jsonc"].rules,
42
62
  ...yml.configs["standard"].rules,
@@ -70,6 +90,10 @@ export default [
70
90
  "@typescript-eslint/consistent-type-definitions": ["error", "interface"],
71
91
  "@typescript-eslint/prefer-ts-expect-error": "error",
72
92
  "@typescript-eslint/no-require-imports": "off",
93
+ "@typescript-eslint/no-unused-expressions": [
94
+ "warn",
95
+ { allowShortCircuit: true, allowTernary: true },
96
+ ],
73
97
  // Override JS
74
98
  "no-useless-constructor": "off",
75
99
  "no-invalid-this": "off",
@@ -118,6 +142,7 @@ export default [
118
142
  "always",
119
143
  { exceptAfterSingleLine: true },
120
144
  ],
145
+ "@stylistic/indent": ["error", 2],
121
146
 
122
147
  // off
123
148
  "@typescript-eslint/consistent-indexed-object-style": "off",
@@ -157,10 +182,7 @@ export default [
157
182
  "unused-imports/no-unused-vars": [
158
183
  "warn",
159
184
  {
160
- vars: "all",
161
- varsIgnorePattern: "^_",
162
- args: "after-used",
163
- argsIgnorePattern: "\\b(type|of|returns)\\b", // Arguments containing the words "type", "of", or "returns" will be ignored --> nest-server
185
+ caughtErrors: "none",
164
186
  },
165
187
  ],
166
188
 
@@ -291,4 +313,6 @@ export default [
291
313
  "yml/no-empty-document": "off",
292
314
  },
293
315
  },
316
+ // Prettier config must be last to override conflicting rules
317
+ eslintConfigPrettier,
294
318
  ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lenne.tech/eslint-config-ts",
3
- "version": "2.1.3",
3
+ "version": "2.2.0",
4
4
  "description": "ESLint config of lenne.Tech for TypeScript",
5
5
  "license": "MIT",
6
6
  "keywords": [
@@ -19,23 +19,22 @@
19
19
  "eslint": ">=9.26.0"
20
20
  },
21
21
  "dependencies": {
22
- "@stylistic/eslint-plugin": "5.2.2",
23
- "@typescript-eslint/eslint-plugin": "8.38.0",
24
- "@typescript-eslint/parser": "8.38.0",
22
+ "@stylistic/eslint-plugin": "5.4.0",
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-jsonc": "2.20.1",
28
+ "eslint-plugin-import-x": "4.17.1",
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",
31
- "eslint-plugin-perfectionist": "4.15.0",
32
- "eslint-plugin-prettier": "5.5.3",
33
- "eslint-plugin-unused-imports": "4.1.4",
34
- "eslint-plugin-yml": "1.18.0",
35
- "functions-have-names": "1.2.3"
32
+ "eslint-plugin-perfectionist": "4.15.1",
33
+ "eslint-plugin-unused-imports": "4.2.0",
34
+ "eslint-plugin-yml": "1.19.0"
36
35
  },
37
36
  "devDependencies": {
38
- "eslint": "9.31.0",
37
+ "eslint": "9.37.0",
39
38
  "watch": "1.0.2"
40
39
  }
41
40
  }