-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.mjs
More file actions
143 lines (130 loc) · 3.38 KB
/
eslint.config.mjs
File metadata and controls
143 lines (130 loc) · 3.38 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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
/**
* @see https://nextjs.org/docs/app/api-reference/config/eslint
*/
import { defineConfig, globalIgnores } from 'eslint/config';
import nextVitals from 'eslint-config-next/core-web-vitals';
import nextTs from 'eslint-config-next/typescript';
import prettier from 'eslint-config-prettier';
import importPlugin from 'eslint-plugin-import';
import reactCompiler from 'eslint-plugin-react-compiler';
import testingLibrary from 'eslint-plugin-testing-library';
const eslintConfig = defineConfig([
// Next.js 공식 설정 (React, Hooks, Next.js 규칙 포함)
...nextVitals,
...nextTs,
// Prettier와의 충돌 방지
prettier,
// React Compiler
{
plugins: {
'react-compiler': reactCompiler,
},
rules: {
'react-compiler/react-compiler': 'error',
},
},
// Import Plugin 설정
{
files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx', '**/*.mjs'],
plugins: {
import: importPlugin,
},
settings: {
'import/resolver': {
typescript: {
alwaysTryTypes: true,
project: './tsconfig.json',
},
node: {
extensions: ['.ts', '.tsx', '.js', '.jsx', '.mjs'],
},
},
'import/parsers': {
'@typescript-eslint/parser': ['.ts', '.tsx'],
},
},
rules: {
// Import 분석/정확성
'import/no-unresolved': 'error',
'import/named': 'off', // TypeScript가 체크함
'import/default': 'error',
'import/export': 'error',
// Import 경고
'import/no-named-as-default': 'warn',
'import/no-named-as-default-member': 'warn',
'import/no-duplicates': 'warn',
// Import 순서
'import/order': [
'warn',
{
groups: ['builtin', 'external', 'internal', ['parent', 'sibling', 'index'], 'type'],
pathGroups: [
{
pattern: '@/**',
group: 'internal',
position: 'before',
},
],
pathGroupsExcludedImportTypes: ['builtin'],
'newlines-between': 'never',
alphabetize: {
order: 'asc',
caseInsensitive: true,
},
},
],
'import/newline-after-import': 'warn',
// TypeScript 관련
'import/consistent-type-specifier-style': ['warn', 'prefer-inline'],
// Next.js 호환성
'import/no-default-export': 'off',
},
},
// 프로젝트별 커스텀 규칙
{
rules: {
// TypeScript
'@typescript-eslint/no-unused-vars': [
'warn',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
},
],
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/consistent-type-imports': [
'warn',
{
prefer: 'type-imports',
fixStyle: 'inline-type-imports',
},
],
// 일반
'no-console': [
'warn',
{
allow: ['warn', 'error'],
},
],
'prefer-const': 'warn',
'no-var': 'error',
},
},
// Testing Library (테스트 파일에만 적용)
{
files: ['**/*.test.{ts,tsx}'],
...testingLibrary.configs['flat/react'],
},
// 무시할 파일
globalIgnores([
'.next/**',
'node_modules/**',
'out/**',
'build/**',
'.pnpm-store/**',
'next-env.d.ts',
'commitlint.config.mjs',
'cli/**',
]),
]);
export default eslintConfig;