Repository navigation
Expand file tree
/
Copy patheslint.config.js
More file actions
54 lines (49 loc) · 1.73 KB
/
Copy patheslint.config.js
File metadata and controls
54 lines (49 loc) · 1.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import js from '@eslint/js';
import globals from 'globals';
import reactPlugin from 'eslint-plugin-react';
import reactHooks from 'eslint-plugin-react-hooks';
import reactRefresh from 'eslint-plugin-react-refresh';
export default [
// ① グローバルな無視設定(これ単体で独立させる)
{
ignores: ['dist/**', 'node_modules/**'],
},
// ② 共通の設定
{
files: ['**/*.{js,jsx}'],
languageOptions: {
ecmaVersion: 2024,
sourceType: 'module',
globals: {
...globals.browser,
...globals.es2021,
},
parserOptions: {
ecmaFeatures: { jsx: true },
},
},
plugins: {
react: reactPlugin,
'react-hooks': reactHooks,
'react-refresh': reactRefresh,
},
rules: {
// ESLint 推奨ルール
...js.configs.recommended.rules,
// React ルール
...reactPlugin.configs.recommended.rules,
'react/react-in-jsx-scope': 'off', // React 17+ では不要
'react/prop-types': 'off', // TypeScript を使わない構成のため無効化
// React Hooks ルール
...reactHooks.configs.recommended.rules,
// React Refresh(HMR)
'react-refresh/only-export-components': ['warn', { allowConstantExport: true }],
// プロジェクト固有のカスタムルール
'no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
'no-console': ['warn', { allow: ['warn', 'error'] }],
},
settings: {
react: { version: 'detect' },
},
},
];