@slashnephy/eslint-config 3.0.418 → 3.0.421

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.418",
3
+ "version": "3.0.421",
4
4
  "keywords": [
5
5
  "eslint",
6
6
  "eslintconfig"
@@ -19,8 +19,8 @@
19
19
  ],
20
20
  "dependencies": {
21
21
  "@eslint-community/eslint-plugin-eslint-comments": "4.7.2",
22
- "@eslint-react/eslint-plugin": "2.13.0",
23
- "@eslint/js": "9.39.5",
22
+ "@eslint-react/eslint-plugin": "5.18.6",
23
+ "@eslint/js": "10.0.1",
24
24
  "@graphql-eslint/eslint-plugin": "4.4.1",
25
25
  "@microsoft/eslint-formatter-sarif": "3.1.0",
26
26
  "@next/eslint-plugin-next": "16.3.2",
@@ -36,7 +36,6 @@
36
36
  "eslint-plugin-n": "18.3.0",
37
37
  "eslint-plugin-package-json": "1.7.1",
38
38
  "eslint-plugin-promise": "7.3.0",
39
- "eslint-plugin-react": "7.37.5",
40
39
  "eslint-plugin-react-hooks": "7.1.1",
41
40
  "eslint-plugin-react-refresh": "0.5.4",
42
41
  "eslint-plugin-relay": "2.0.0",
@@ -56,10 +55,10 @@
56
55
  "devDependencies": {
57
56
  "@eslint/config-inspector": "3.3.0",
58
57
  "@types/node": "25.9.5",
59
- "eslint": "9.39.5"
58
+ "eslint": "10.3.0"
60
59
  },
61
60
  "peerDependencies": {
62
- "eslint": "^9"
61
+ "eslint": "^10"
63
62
  },
64
63
  "engines": {
65
64
  "node": ">= 24"
@@ -9,7 +9,6 @@ export const graphql = defineConfig(
9
9
  parser: graphqlPlugin.parser,
10
10
  },
11
11
  plugins: {
12
- // @ts-expect-error -- 一時的に型定義を無視
13
12
  '@graphql-eslint': graphqlPlugin,
14
13
  },
15
14
  },
@@ -10,7 +10,6 @@ export const graphql = defineConfig(
10
10
  parser: graphqlPlugin.parser,
11
11
  },
12
12
  plugins: {
13
- // @ts-expect-error -- 一時的に型定義を無視
14
13
  '@graphql-eslint': graphqlPlugin,
15
14
  },
16
15
  },
@@ -1,120 +1,72 @@
1
1
  import eslintReact from '@eslint-react/eslint-plugin';
2
+ import stylisticPlugin from '@stylistic/eslint-plugin';
2
3
  import { defineConfig } from 'eslint/config';
3
4
  import jsxA11yX from 'eslint-plugin-jsx-a11y-x';
4
- import reactPlugin from 'eslint-plugin-react';
5
5
  import reactHooksPlugin from 'eslint-plugin-react-hooks';
6
6
  import globals from 'globals';
7
7
  export const react = defineConfig(
8
- // eslint-react(型チェック付きルール + 既存プラグインとの競合回避)
8
+ // eslint-react(型チェック付きルール)
9
+ // eslint-plugin-react は ESLint v10 で削除された context.getFilename() を呼ぶため
10
+ // ロード時にクラッシュする (jsx-eslint/eslint-plugin-react#3977 が open のまま)。
11
+ // correctness 系のルールは eslint-react が、JSX の書式系は @stylistic が肩代わりする。
9
12
  {
10
13
  name: '@eslint-react/eslint-plugin',
11
14
  files: ['**/*.{jsx,tsx}'],
12
- extends: [
13
- eslintReact.configs['recommended-type-checked'],
14
- eslintReact.configs['disable-conflict-eslint-plugin-react'],
15
- ],
15
+ extends: [eslintReact.configs['recommended-type-checked']],
16
+ languageOptions: {
17
+ parserOptions: {
18
+ ecmaFeatures: {
19
+ jsx: true,
20
+ },
21
+ lib: ['dom'],
22
+ },
23
+ globals: globals.browser,
24
+ },
16
25
  rules: {
17
26
  // クラスコンポーネントを禁止(react/prefer-stateless-function と同じ意図)
18
27
  '@eslint-react/no-class-component': 'error',
19
28
  },
20
29
  },
21
- // eslint-plugin-react(スタイル/フォーマット系ルール)
22
- [
23
- {
24
- name: 'eslint-plugin-react',
25
- files: ['**/*.{jsx,tsx}'],
26
- extends: [
27
- reactPlugin.configs.flat.recommended,
28
- reactPlugin.configs.flat['jsx-runtime'],
29
- ],
30
- languageOptions: {
31
- parserOptions: {
32
- ecmaFeatures: {
33
- jsx: true,
34
- },
35
- lib: ['dom'],
30
+ // JSX の書式ルール(eslint-plugin-react から移行)
31
+ // @stylistic は base/javascript.ts でも登録しているが、この設定単体でも解決できるように
32
+ // ここでも明示する。同じモジュールを import しているためインスタンスは共有される。
33
+ {
34
+ name: '@stylistic/eslint-plugin (jsx)',
35
+ files: ['**/*.{jsx,tsx}'],
36
+ plugins: {
37
+ '@stylistic': stylisticPlugin,
38
+ },
39
+ rules: {
40
+ // <div></div> 👉 <div />
41
+ '@stylistic/jsx-self-closing-comp': [
42
+ 'error',
43
+ {
44
+ component: true,
45
+ html: true,
36
46
  },
37
- globals: globals.browser,
38
- },
39
- settings: {
40
- react: {
41
- version: 'detect',
47
+ ],
48
+ // コンポーネント名を PascalCase に強制
49
+ '@stylistic/jsx-pascal-case': 'error',
50
+ // props を並び替える
51
+ '@stylistic/jsx-sort-props': [
52
+ 'error',
53
+ {
54
+ callbacksLast: true,
55
+ shorthandFirst: true,
56
+ multiline: 'last',
57
+ reservedFirst: true,
42
58
  },
43
- },
44
- rules: {
45
- // <div flag={true} /> 👉 <div flag />
46
- 'react/jsx-boolean-value': 'error',
47
- // <div value={'test'} /> 👉 <div value='test' />
48
- 'react/jsx-curly-brace-presence': 'error',
49
- // <div></div> 👉 <div />
50
- 'react/self-closing-comp': [
51
- 'error',
52
- {
53
- component: true,
54
- html: true,
55
- },
56
- ],
57
- // コンポーネント名を PascalCase に強制
58
- 'react/jsx-pascal-case': 'error',
59
- // ハンドラーの名前規則
60
- 'react/jsx-handler-names': 'error',
61
- // useState の分解宣言 & setXXX という名前を強制
62
- 'react/hook-use-state': 'error',
63
- // <React.Fragment /> 👉 </>
64
- 'react/jsx-fragments': 'error',
65
- // ステートレス関数を優先
66
- 'react/prefer-stateless-function': 'error',
67
- // props を並び替える
68
- 'react/jsx-sort-props': [
69
- 'error',
70
- {
71
- callbacksLast: true,
72
- shorthandFirst: true,
73
- multiline: 'last',
74
- reservedFirst: true,
75
- },
76
- ],
77
- // JSX を .tsx でも使えるように
78
- 'react/jsx-filename-extension': [
79
- 'error',
80
- {
81
- extensions: ['.jsx', '.tsx'],
82
- },
83
- ],
84
- // props に対してスプレッド演算子を使えるように
85
- 'react/jsx-props-no-spreading': 'off',
86
- // <></> を使えるように
87
- 'react/jsx-no-useless-fragment': 'off',
88
- // defaultProps を使わない
89
- 'react/require-default-props': 'off',
90
- // useCallback でコールバックを宣言させる
91
- 'react/jsx-no-bind': 'warn',
92
- // コンポーネントの宣言を function Component() {} に強制
93
- 'react/function-component-definition': [
94
- 'error',
95
- {
96
- namedComponents: 'function-declaration',
97
- unnamedComponents: 'arrow-function',
98
- },
99
- ],
100
- },
101
- },
102
- {
103
- name: 'eslint-plugin-react',
104
- files: ['**/*.jsx'],
105
- rules: {
106
- 'react/prop-types': 'error',
107
- },
59
+ ],
108
60
  },
109
- ], {
61
+ }, {
110
62
  name: 'eslint-plugin-react-hooks',
111
63
  // JSX を含むファイルに限定しない。カスタムフックは JSX を返さないので `.ts` / `.js` に
112
64
  // 置かれることが多く、`{jsx,tsx}` だけだとそれらが一切検査されない。
113
65
  // eslint-plugin-react-hooks v7 のルールは React Compiler の診断そのもの
114
66
  // (refs / immutability / preserve-manual-memoization など) であり、
115
67
  // 適用漏れは「Compiler がコンパイルを諦めているのに lint は緑」という状態を生む。
116
- // JSX 前提の eslint-plugin-react や jsx-a11y-x と違い、このプラグインは
117
- // JSX の有無と無関係に効くべきなので、スクリプト全体を対象にする。
68
+ // JSX 前提の jsx-a11y-x と違い、このプラグインは JSX の有無と無関係に効くべきなので、
69
+ // スクリプト全体を対象にする。
118
70
  files: ['**/*.{js,cjs,mjs,jsx,ts,cts,mts,tsx}'],
119
71
  extends: [reactHooksPlugin.configs.flat['recommended-latest']],
120
72
  rules: {
@@ -1,113 +1,65 @@
1
1
  import eslintReact from '@eslint-react/eslint-plugin'
2
+ import stylisticPlugin from '@stylistic/eslint-plugin'
2
3
  import { defineConfig } from 'eslint/config'
3
4
  import jsxA11yX from 'eslint-plugin-jsx-a11y-x'
4
- import reactPlugin from 'eslint-plugin-react'
5
5
  import reactHooksPlugin from 'eslint-plugin-react-hooks'
6
6
  import globals from 'globals'
7
7
 
8
8
  export const react = defineConfig(
9
- // eslint-react(型チェック付きルール + 既存プラグインとの競合回避)
9
+ // eslint-react(型チェック付きルール)
10
+ // eslint-plugin-react は ESLint v10 で削除された context.getFilename() を呼ぶため
11
+ // ロード時にクラッシュする (jsx-eslint/eslint-plugin-react#3977 が open のまま)。
12
+ // correctness 系のルールは eslint-react が、JSX の書式系は @stylistic が肩代わりする。
10
13
  {
11
14
  name: '@eslint-react/eslint-plugin',
12
15
  files: ['**/*.{jsx,tsx}'],
13
- extends: [
14
- eslintReact.configs['recommended-type-checked'],
15
- eslintReact.configs['disable-conflict-eslint-plugin-react'],
16
- ],
16
+ extends: [eslintReact.configs['recommended-type-checked']],
17
+ languageOptions: {
18
+ parserOptions: {
19
+ ecmaFeatures: {
20
+ jsx: true,
21
+ },
22
+ lib: ['dom'],
23
+ },
24
+ globals: globals.browser,
25
+ },
17
26
  rules: {
18
27
  // クラスコンポーネントを禁止(react/prefer-stateless-function と同じ意図)
19
28
  '@eslint-react/no-class-component': 'error',
20
29
  },
21
30
  },
22
- // eslint-plugin-react(スタイル/フォーマット系ルール)
23
- [
24
- {
25
- name: 'eslint-plugin-react',
26
- files: ['**/*.{jsx,tsx}'],
27
- extends: [
28
- reactPlugin.configs.flat.recommended,
29
- reactPlugin.configs.flat['jsx-runtime'],
30
- ],
31
- languageOptions: {
32
- parserOptions: {
33
- ecmaFeatures: {
34
- jsx: true,
35
- },
36
- lib: ['dom'],
31
+ // JSX の書式ルール(eslint-plugin-react から移行)
32
+ // @stylistic は base/javascript.ts でも登録しているが、この設定単体でも解決できるように
33
+ // ここでも明示する。同じモジュールを import しているためインスタンスは共有される。
34
+ {
35
+ name: '@stylistic/eslint-plugin (jsx)',
36
+ files: ['**/*.{jsx,tsx}'],
37
+ plugins: {
38
+ '@stylistic': stylisticPlugin,
39
+ },
40
+ rules: {
41
+ // <div></div> 👉 <div />
42
+ '@stylistic/jsx-self-closing-comp': [
43
+ 'error',
44
+ {
45
+ component: true,
46
+ html: true,
37
47
  },
38
- globals: globals.browser,
39
- },
40
- settings: {
41
- react: {
42
- version: 'detect',
48
+ ],
49
+ // コンポーネント名を PascalCase に強制
50
+ '@stylistic/jsx-pascal-case': 'error',
51
+ // props を並び替える
52
+ '@stylistic/jsx-sort-props': [
53
+ 'error',
54
+ {
55
+ callbacksLast: true,
56
+ shorthandFirst: true,
57
+ multiline: 'last',
58
+ reservedFirst: true,
43
59
  },
44
- },
45
- rules: {
46
- // <div flag={true} /> 👉 <div flag />
47
- 'react/jsx-boolean-value': 'error',
48
- // <div value={'test'} /> 👉 <div value='test' />
49
- 'react/jsx-curly-brace-presence': 'error',
50
- // <div></div> 👉 <div />
51
- 'react/self-closing-comp': [
52
- 'error',
53
- {
54
- component: true,
55
- html: true,
56
- },
57
- ],
58
- // コンポーネント名を PascalCase に強制
59
- 'react/jsx-pascal-case': 'error',
60
- // ハンドラーの名前規則
61
- 'react/jsx-handler-names': 'error',
62
- // useState の分解宣言 & setXXX という名前を強制
63
- 'react/hook-use-state': 'error',
64
- // <React.Fragment /> 👉 </>
65
- 'react/jsx-fragments': 'error',
66
- // ステートレス関数を優先
67
- 'react/prefer-stateless-function': 'error',
68
- // props を並び替える
69
- 'react/jsx-sort-props': [
70
- 'error',
71
- {
72
- callbacksLast: true,
73
- shorthandFirst: true,
74
- multiline: 'last',
75
- reservedFirst: true,
76
- },
77
- ],
78
- // JSX を .tsx でも使えるように
79
- 'react/jsx-filename-extension': [
80
- 'error',
81
- {
82
- extensions: ['.jsx', '.tsx'],
83
- },
84
- ],
85
- // props に対してスプレッド演算子を使えるように
86
- 'react/jsx-props-no-spreading': 'off',
87
- // <></> を使えるように
88
- 'react/jsx-no-useless-fragment': 'off',
89
- // defaultProps を使わない
90
- 'react/require-default-props': 'off',
91
- // useCallback でコールバックを宣言させる
92
- 'react/jsx-no-bind': 'warn',
93
- // コンポーネントの宣言を function Component() {} に強制
94
- 'react/function-component-definition': [
95
- 'error',
96
- {
97
- namedComponents: 'function-declaration',
98
- unnamedComponents: 'arrow-function',
99
- },
100
- ],
101
- },
102
- },
103
- {
104
- name: 'eslint-plugin-react',
105
- files: ['**/*.jsx'],
106
- rules: {
107
- 'react/prop-types': 'error',
108
- },
60
+ ],
109
61
  },
110
- ],
62
+ },
111
63
  {
112
64
  name: 'eslint-plugin-react-hooks',
113
65
  // JSX を含むファイルに限定しない。カスタムフックは JSX を返さないので `.ts` / `.js` に
@@ -115,8 +67,8 @@ export const react = defineConfig(
115
67
  // eslint-plugin-react-hooks v7 のルールは React Compiler の診断そのもの
116
68
  // (refs / immutability / preserve-manual-memoization など) であり、
117
69
  // 適用漏れは「Compiler がコンパイルを諦めているのに lint は緑」という状態を生む。
118
- // JSX 前提の eslint-plugin-react や jsx-a11y-x と違い、このプラグインは
119
- // JSX の有無と無関係に効くべきなので、スクリプト全体を対象にする。
70
+ // JSX 前提の jsx-a11y-x と違い、このプラグインは JSX の有無と無関係に効くべきなので、
71
+ // スクリプト全体を対象にする。
120
72
  files: ['**/*.{js,cjs,mjs,jsx,ts,cts,mts,tsx}'],
121
73
  extends: [reactHooksPlugin.configs.flat['recommended-latest']],
122
74
  rules: {