forked from Crazy-Cow/Client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheslint.config.js
115 lines (110 loc) · 2.89 KB
/
eslint.config.js
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
import globals from 'globals';
import js from '@eslint/js';
import tseslint from '@typescript-eslint/eslint-plugin';
import * as parser from '@typescript-eslint/parser';
import reactPlugin from 'eslint-plugin-react';
import prettier from 'eslint-config-prettier';
import airbnbConfig from 'eslint-config-airbnb';
import airbnbTypeScriptConfig from 'eslint-config-airbnb-typescript';
import importPlugin from 'eslint-plugin-import';
import jsxA11yPlugin from 'eslint-plugin-jsx-a11y';
/** @type {import('eslint').Linter.FlatConfig[]} */
export default [
// JS recommended config
js.configs.recommended,
// Airbnb style config
{
files: ['**/*.{js,jsx,ts,tsx}'],
plugins: {
import: importPlugin,
'jsx-a11y': jsxA11yPlugin,
react: reactPlugin,
},
rules: {
...airbnbConfig.rules,
'react-hooks/exhaustive-deps': 'warn',
// Airbnb 스타일의 일부 규칙을 프로젝트에 맞게 수정
'react/react-in-jsx-scope': 'off', // React 17+ 에서는 불필요
'react/jsx-filename-extension': [
'error',
{ extensions: ['.jsx', '.tsx'] },
],
'import/extensions': [
'error',
'ignorePackages',
{
js: 'never',
jsx: 'never',
ts: 'never',
tsx: 'never',
},
],
'react/no-unknown-property': [
'error',
{
ignore: [
'geometry',
'material',
'skeleton',
'rotation',
'dispose',
'object',
],
},
],
},
settings: {
'import/resolver': {
node: {
extensions: ['.js', '.jsx', '.ts', '.tsx'],
},
},
react: {
version: 'detect',
},
},
},
// TypeScript config with Airbnb TypeScript rules
{
files: ['**/*.{ts,tsx}'],
plugins: {
'@typescript-eslint': tseslint,
},
languageOptions: {
parser: parser,
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
ecmaFeatures: {
jsx: true,
},
project: './tsconfig.json', // tsconfig.json 경로 지정
},
},
rules: {
...tseslint.configs['recommended'].rules,
...airbnbTypeScriptConfig.rules,
// TypeScript 관련 규칙 커스터마이징
'@typescript-eslint/no-unused-vars': [
'error',
{ argsIgnorePattern: '^_' },
],
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-explicit-any': 'warn',
},
},
// Global settings
{
files: ['**/*.{js,jsx,ts,tsx}'],
languageOptions: {
globals: {
...globals.browser,
...globals.es2021,
JSX: 'readonly', // JSX 전역 타입 추가
},
},
},
// Prettier config (항상 마지막에 위치해야 함)
prettier,
];