-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.mjs
More file actions
95 lines (89 loc) · 2.93 KB
/
eslint.config.mjs
File metadata and controls
95 lines (89 loc) · 2.93 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
import { defineConfig, globalIgnores } from 'eslint/config';
import nextVitals from 'eslint-config-next/core-web-vitals';
import nextTs from 'eslint-config-next/typescript';
import pluginReactHooks from 'eslint-plugin-react-hooks';
import simpleImportSort from 'eslint-plugin-simple-import-sort';
const eslintConfig = defineConfig([
...nextVitals,
...nextTs,
globalIgnores(['.next/**', 'out/**', 'build/**', 'next-env.d.ts']),
{
plugins: {
'react-hooks': pluginReactHooks,
},
settings: { react: { version: 'detect' } },
rules: {
...pluginReactHooks.configs.recommended.rules,
// React scope는 새로운 JSX 변환에서는 필요하지 않음
'react/react-in-jsx-scope': 'off',
'react/prop-types': 'off',
// App Router를 사용하므로 이 규칙은 필요하지 않음
'@next/next/no-html-link-for-pages': 'off',
},
},
{
plugins: {
'simple-import-sort': simpleImportSort,
},
settings: {
'import/resolver': {
typescript: {
alwaysTryTypes: true,
project: ['./tsconfig.json'],
},
node: {
extensions: ['.js', '.jsx', '.ts', '.tsx'],
},
},
},
rules: {
// Import 관련 규칙들
'import/no-unresolved': 'error',
'import/no-duplicates': 'error',
'import/no-unused-modules': 'warn',
'import/newline-after-import': ['error', { count: 1 }],
// Simple import sort (더 강력한 import 정렬)
'simple-import-sort/imports': [
'error',
{
groups: [
['^\\u0000.*'], // Side effects
['^(?=react)'], // React
['^(?=[@\\w])'], // External libraries
['^(?=\\.)'], // Relative imports
['.*\\.(png|webp|jpg|jpeg|svg|lottie|mp4|wav)$'], // Assets
],
},
],
// 사용하지 않는 변수 처리 (언더스코어로 시작하는 변수 무시)
'@typescript-eslint/no-unused-vars': [
'warn',
{
varsIgnorePattern: '^_$',
caughtErrorsIgnorePattern: '^_$',
},
],
// Type import 명시적 사용
'@typescript-eslint/consistent-type-imports': [
'error',
{
prefer: 'type-imports',
fixStyle: 'inline-type-imports',
},
],
// 개행 규칙
'padding-line-between-statements': [
'error',
{ blankLine: 'always', prev: '*', next: '*' },
{ blankLine: 'any', prev: 'import', next: 'import' },
{ blankLine: 'any', prev: 'case', next: 'case' },
{ blankLine: 'any', prev: 'directive', next: 'directive' },
{ blankLine: 'any', prev: ['const', 'let'], next: ['const', 'let'] },
{ blankLine: 'any', prev: 'expression', next: 'expression' },
{ blankLine: 'any', prev: 'export', next: 'export' },
{ blankLine: 'any', prev: '*', next: 'break' },
],
},
},
]);
export default eslintConfig;