-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.js
More file actions
125 lines (123 loc) · 3.76 KB
/
eslint.config.js
File metadata and controls
125 lines (123 loc) · 3.76 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
import js from '@eslint/js';
import globals from 'globals';
import reactHooks from 'eslint-plugin-react-hooks';
import reactRefresh from 'eslint-plugin-react-refresh';
import tseslint from 'typescript-eslint';
import react from 'eslint-plugin-react';
import unusedImports from 'eslint-plugin-unused-imports';
import eslintConfigPrettier from 'eslint-config-prettier/flat';
import perfectionist from 'eslint-plugin-perfectionist';
import { defineConfig } from 'eslint/config';
/*
참고: tseslint.config depracated
https://typescript-eslint.io/packages/typescript-eslint/#config-deprecated
*/
const config = defineConfig(
{ ignores: ['dist', 'node_modules'] },
{
extends: [
js.configs.recommended,
...tseslint.configs.recommended,
reactHooks.configs.recommended,
perfectionist.configs['recommended-natural'],
eslintConfigPrettier,
],
files: ['**/*.{ts,tsx}'],
languageOptions: {
ecmaVersion: 2020,
globals: { ...globals.browser },
},
plugins: {
react,
'unused-imports': unusedImports,
'react-refresh': reactRefresh,
},
rules: {
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/naming-convention': [
'error',
{
format: ['camelCase', 'UPPER_CASE', 'PascalCase'],
leadingUnderscore: 'allow',
selector: 'variableLike',
},
{
format: ['PascalCase'],
selector: ['typeLike', 'enumMember'],
},
{
format: ['camelCase', 'UPPER_CASE'],
leadingUnderscore: 'allow',
selector: 'typeProperty',
trailingUnderscore: 'allow',
},
],
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-unused-vars': 'error',
'unused-imports/no-unused-imports': 'error',
'unused-imports/no-unused-vars': [
'warn',
{
vars: 'all',
varsIgnorePattern: '^_',
args: 'after-used',
argsIgnorePattern: '^_',
},
],
curly: 'error',
// 아래 자동정렬은 런타임 동작에 영향을 줄 수 있는 것들이에요.
'perfectionist/sort-enums': 'off',
'perfectionist/sort-objects': 'off',
'perfectionist/sort-maps': 'off',
'perfectionist/sort-modules': 'off',
'perfectionist/sort-imports': [
'error',
{
groups: [
'type',
['builtin', 'external'],
'internal-type',
'internal',
['parent-type', 'sibling-type', 'index-type'],
['parent', 'sibling', 'index'],
'object',
'unknown',
],
newlinesBetween: 'always',
customGroups: {
type: {},
value: {},
},
},
],
'react/display-name': [1, { ignoreTranspilerName: false }],
'react/no-unescaped-entities': 'off',
'react/no-unknown-property': ['error', { ignore: ['css'] }],
'react/prop-types': 'off',
'react/react-in-jsx-scope': 'off',
'react/self-closing-comp': [
'error',
{
component: true,
html: true,
},
],
'react-hooks/rules-of-hooks': 'error',
'react-hooks/react-compiler': 'warn',
// perfectionist의 sorting과 겹칠 수 있어서 off해요.
'sort-imports': 'off',
'object-shorthand': ['error', 'always'],
'no-console': ['error', { allow: ['warn', 'error'] }],
},
settings: {
'import/external-module-folders': ['node_modules'],
'import/resolver': {},
react: {
version: 'detect',
},
},
},
);
export default config;