@slashnephy/eslint-config 3.0.356 → 3.0.358

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@slashnephy/eslint-config",
3
- "version": "3.0.356",
3
+ "version": "3.0.358",
4
4
  "keywords": [
5
5
  "eslint",
6
6
  "eslintconfig"
@@ -29,7 +29,6 @@
29
29
  "@typescript-eslint/utils": "8.59.3",
30
30
  "@vitest/eslint-plugin": "1.6.17",
31
31
  "eslint-config-flat-gitignore": "2.3.0",
32
- "eslint-import-resolver-node": "0.4.0",
33
32
  "eslint-import-resolver-typescript": "4.4.4",
34
33
  "eslint-plugin-import-x": "4.16.2",
35
34
  "eslint-plugin-jest": "29.15.2",
@@ -56,7 +55,7 @@
56
55
  },
57
56
  "devDependencies": {
58
57
  "@eslint/config-inspector": "3.0.2",
59
- "@types/node": "25.8.0",
58
+ "@types/node": "25.9.0",
60
59
  "eslint": "9.39.4"
61
60
  },
62
61
  "peerDependencies": {
@@ -2,7 +2,8 @@ import eslint from '@eslint/js';
2
2
  import eslintCommentsConfig from '@eslint-community/eslint-plugin-eslint-comments/configs';
3
3
  import stylisticPlugin from '@stylistic/eslint-plugin';
4
4
  import { defineConfig } from 'eslint/config';
5
- import { importX } from 'eslint-plugin-import-x';
5
+ import { createTypeScriptImportResolver } from 'eslint-import-resolver-typescript';
6
+ import { createNodeResolver, importX } from 'eslint-plugin-import-x';
6
7
  // @ts-expect-error 型定義ファイルがない
7
8
  import promisePlugin from 'eslint-plugin-promise';
8
9
  import unusedImportsPlugin from 'eslint-plugin-unused-imports';
@@ -156,20 +157,23 @@ export const javaScript = defineConfig({
156
157
  importX.flatConfigs.recommended,
157
158
  ],
158
159
  settings: {
159
- 'import-x/resolver': {
160
- node: {
161
- extensions: ['.js', '.cjs', '.mjs', '.jsx', '.ts', '.cts', '.mts', '.tsx', '.json'],
162
- },
163
- typescript: {
164
- alwaysTryTypes: true,
165
- },
166
- },
160
+ // flat config 専用の新しい resolver API。旧 'import-x/resolver' は解決チェーンごとに
161
+ // resolver を作り直すためキャッシュが効かず、TypeScript の exports condition も評価できない
162
+ // (ESM import CJS の型定義に解決され、tsc ESLint で見えるモジュール形状がずれる)。
163
+ // resolver-next が設定されている場合、import-x は旧 'import-x/resolver' を一切参照しない。
164
+ 'import-x/resolver-next': [
165
+ // alwaysTryTypes は v4 以降デフォルトで有効なため指定しない
166
+ createTypeScriptImportResolver(),
167
+ // tsconfig を持たないプロジェクト向けのフォールバック
168
+ createNodeResolver(),
169
+ ],
167
170
  },
168
171
  rules: {
169
172
  'import-x/no-import-module-exports': 'off',
170
173
  'import-x/no-extraneous-dependencies': 'off',
171
- // 循環 import を禁止
172
- 'import-x/no-cycle': 'error',
174
+ // 循環 import を禁止する。node_modules 側の循環は利用者が修正できず、
175
+ // 依存グラフを外部モジュールまで展開するコストだけが大きいため対象外にする
176
+ 'import-x/no-cycle': ['error', { ignoreExternal: true }],
173
177
  // default export を優先しない
174
178
  'import-x/prefer-default-export': 'off',
175
179
  // default export を禁止
@@ -2,7 +2,8 @@ import eslint from '@eslint/js'
2
2
  import eslintCommentsConfig from '@eslint-community/eslint-plugin-eslint-comments/configs'
3
3
  import stylisticPlugin from '@stylistic/eslint-plugin'
4
4
  import { defineConfig } from 'eslint/config'
5
- import { importX } from 'eslint-plugin-import-x'
5
+ import { createTypeScriptImportResolver } from 'eslint-import-resolver-typescript'
6
+ import { createNodeResolver, importX } from 'eslint-plugin-import-x'
6
7
  // @ts-expect-error 型定義ファイルがない
7
8
  import promisePlugin from 'eslint-plugin-promise'
8
9
  import unusedImportsPlugin from 'eslint-plugin-unused-imports'
@@ -164,20 +165,23 @@ export const javaScript = defineConfig(
164
165
  importX.flatConfigs.recommended,
165
166
  ],
166
167
  settings: {
167
- 'import-x/resolver': {
168
- node: {
169
- extensions: ['.js', '.cjs', '.mjs', '.jsx', '.ts', '.cts', '.mts', '.tsx', '.json'],
170
- },
171
- typescript: {
172
- alwaysTryTypes: true,
173
- },
174
- },
168
+ // flat config 専用の新しい resolver API。旧 'import-x/resolver' は解決チェーンごとに
169
+ // resolver を作り直すためキャッシュが効かず、TypeScript の exports condition も評価できない
170
+ // (ESM import CJS の型定義に解決され、tsc ESLint で見えるモジュール形状がずれる)。
171
+ // resolver-next が設定されている場合、import-x は旧 'import-x/resolver' を一切参照しない。
172
+ 'import-x/resolver-next': [
173
+ // alwaysTryTypes は v4 以降デフォルトで有効なため指定しない
174
+ createTypeScriptImportResolver(),
175
+ // tsconfig を持たないプロジェクト向けのフォールバック
176
+ createNodeResolver(),
177
+ ],
175
178
  },
176
179
  rules: {
177
180
  'import-x/no-import-module-exports': 'off',
178
181
  'import-x/no-extraneous-dependencies': 'off',
179
- // 循環 import を禁止
180
- 'import-x/no-cycle': 'error',
182
+ // 循環 import を禁止する。node_modules 側の循環は利用者が修正できず、
183
+ // 依存グラフを外部モジュールまで展開するコストだけが大きいため対象外にする
184
+ 'import-x/no-cycle': ['error', { ignoreExternal: true }],
181
185
  // default export を優先しない
182
186
  'import-x/prefer-default-export': 'off',
183
187
  // default export を禁止
@@ -231,6 +231,13 @@ export const typeScript = defineConfig({
231
231
  ignorePackages: true,
232
232
  },
233
233
  ],
234
+ // 以下は tsc が同等以上の検査をする一方、import-x 側は対象モジュールを再パースして
235
+ // export 表を組み立てるため高価。importX.flatConfigs.typescript が同じ理由で
236
+ // 'import-x/named' を無効化しているのに倣い、TypeScript では残りも無効化する。
237
+ // namespace は TS2339、default は TS1192/TS2613、export は TS2323/TS2308 で検出される
238
+ 'import-x/namespace': 'off',
239
+ 'import-x/default': 'off',
240
+ 'import-x/export': 'off',
234
241
  },
235
242
  }, {
236
243
  name: '@susisu/eslint-plugin-safe-typescript',
@@ -239,6 +239,13 @@ export const typeScript = defineConfig(
239
239
  ignorePackages: true,
240
240
  },
241
241
  ],
242
+ // 以下は tsc が同等以上の検査をする一方、import-x 側は対象モジュールを再パースして
243
+ // export 表を組み立てるため高価。importX.flatConfigs.typescript が同じ理由で
244
+ // 'import-x/named' を無効化しているのに倣い、TypeScript では残りも無効化する。
245
+ // namespace は TS2339、default は TS1192/TS2613、export は TS2323/TS2308 で検出される
246
+ 'import-x/namespace': 'off',
247
+ 'import-x/default': 'off',
248
+ 'import-x/export': 'off',
242
249
  },
243
250
  },
244
251
  {