@slashnephy/eslint-config 3.0.357 → 3.0.359

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.357",
3
+ "version": "3.0.359",
4
4
  "keywords": [
5
5
  "eslint",
6
6
  "eslintconfig"
@@ -29,11 +29,10 @@
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",
36
- "eslint-plugin-jsx-a11y": "6.10.2",
35
+ "eslint-plugin-jsx-a11y-x": "0.2.0",
37
36
  "eslint-plugin-n": "18.0.1",
38
37
  "eslint-plugin-package-json": "0.91.2",
39
38
  "eslint-plugin-promise": "7.3.0",
@@ -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
  {
@@ -1,7 +1,6 @@
1
1
  import eslintReact from '@eslint-react/eslint-plugin';
2
2
  import { defineConfig } from 'eslint/config';
3
- // @ts-expect-error 型定義ファイルがない
4
- import jsxA11y from 'eslint-plugin-jsx-a11y';
3
+ import jsxA11yX from 'eslint-plugin-jsx-a11y-x';
5
4
  import reactPlugin from 'eslint-plugin-react';
6
5
  import reactHooksPlugin from 'eslint-plugin-react-hooks';
7
6
  import globals from 'globals';
@@ -121,12 +120,19 @@ export const react = defineConfig(
121
120
  },
122
121
  ],
123
122
  },
124
- }, {
125
- name: 'eslint-plugin-jsx-a11y',
123
+ },
124
+ // eslint-plugin-jsx-a11y-x(本家 eslint-plugin-jsx-a11y のフォーク)
125
+ // 本家は 2024-10 の 6.10.2 を最後にリリースが止まっており、ESLint v10 で削除された
126
+ // context.getFilename() を内部で使っているため v10 ではロード時にクラッシュする。
127
+ // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/issues/1075
128
+ // フォーク側は当該 API を排除済みで recommended のルール構成は本家と一致する。
129
+ // 本家が v10 対応をリリースしたら戻せるよう、ルール名の変更以外は同じ設定を保つ。
130
+ {
131
+ name: 'eslint-plugin-jsx-a11y-x',
126
132
  files: ['**/*.{jsx,tsx}'],
127
- extends: [jsxA11y.flatConfigs.recommended],
133
+ extends: [jsxA11yX.configs.recommended],
128
134
  rules: {
129
- 'jsx-a11y/alt-text': [
135
+ 'jsx-a11y-x/alt-text': [
130
136
  'warn',
131
137
  {
132
138
  elements: ['img', 'object', 'area'],
@@ -1,7 +1,6 @@
1
1
  import eslintReact from '@eslint-react/eslint-plugin'
2
2
  import { defineConfig } from 'eslint/config'
3
- // @ts-expect-error 型定義ファイルがない
4
- import jsxA11y from 'eslint-plugin-jsx-a11y'
3
+ import jsxA11yX from 'eslint-plugin-jsx-a11y-x'
5
4
  import reactPlugin from 'eslint-plugin-react'
6
5
  import reactHooksPlugin from 'eslint-plugin-react-hooks'
7
6
  import globals from 'globals'
@@ -124,12 +123,18 @@ export const react = defineConfig(
124
123
  ],
125
124
  },
126
125
  },
126
+ // eslint-plugin-jsx-a11y-x(本家 eslint-plugin-jsx-a11y のフォーク)
127
+ // 本家は 2024-10 の 6.10.2 を最後にリリースが止まっており、ESLint v10 で削除された
128
+ // context.getFilename() を内部で使っているため v10 ではロード時にクラッシュする。
129
+ // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/issues/1075
130
+ // フォーク側は当該 API を排除済みで recommended のルール構成は本家と一致する。
131
+ // 本家が v10 対応をリリースしたら戻せるよう、ルール名の変更以外は同じ設定を保つ。
127
132
  {
128
- name: 'eslint-plugin-jsx-a11y',
133
+ name: 'eslint-plugin-jsx-a11y-x',
129
134
  files: ['**/*.{jsx,tsx}'],
130
- extends: [jsxA11y.flatConfigs.recommended],
135
+ extends: [jsxA11yX.configs.recommended],
131
136
  rules: {
132
- 'jsx-a11y/alt-text': [
137
+ 'jsx-a11y-x/alt-text': [
133
138
  'warn',
134
139
  {
135
140
  elements: ['img', 'object', 'area'],