-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path.eslintrc.json
More file actions
105 lines (104 loc) · 3.66 KB
/
.eslintrc.json
File metadata and controls
105 lines (104 loc) · 3.66 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
{
// 플러그인 문서:
// https://github.com/MelvinVermeer/eslint-plugin-no-relative-import-paths#readme
// https://www.npmjs.com/package/eslint-plugin-react
// https://github.com/ArnaudBarre/eslint-plugin-react-refresh
// https://www.npmjs.com/package/eslint-plugin-jsx-a11y
"root": true,
"plugins": ["no-relative-import-paths", "react", "jsx-a11y", "tailwindcss", "prettier"],
"extends": [
"next/core-web-vitals",
"plugin:react/recommended",
"plugin:import/recommended", // Import 관련 규칙
"plugin:react/jsx-runtime",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended", // ts 권장
"plugin:@tanstack/eslint-plugin-query/recommended", // React Query 관련 규칙
"plugin:tailwindcss/recommended"
],
"parser": "@typescript-eslint/parser",
"settings": {
"next": {
// Next.js 프로젝트일 경우
"rootDir": ["./src/"]
},
// React 버전을 지정합니다.
// 지정하지 않을 경우, React 라이브러리 전체를 탐색하므로 린트 속도가 느려질 수 있습니다. ( 기본값: "detect" )
"react": {
"version": "18"
},
// typescript, node 모듈 설정
"import/resolver": {
"typescript": {
"alwaysTryTypes": true,
"project": "./tsconfig.json"
},
"node": {
"extensions": [".js", ".jsx", ".ts", ".tsx"]
}
},
"import/external-module-folders": [".yarn"],
"tailwindcss": {
// Tailwind를 사용하는 className override 함수를 지정합니다.
"callees": ["className", "clsx", "cn"],
"config": "tailwind.config.ts"
}
},
"rules": {
// <img> 엘리먼트에 유의미한 대체 텍스트가 있는지 체크
"jsx-a11y/alt-text": ["warn", { "elements": ["img"] }],
// 유효한 aria-* 속성만 사용
"jsx-a11y/aria-props": "warn",
// 유효한 aria-* 상태/값만 사용
"jsx-a11y/aria-proptypes": "warn",
// DOM에서 지원되는 role, ARIA만 사용
"jsx-a11y/aria-unsupported-elements": "warn",
// 필수 ARIA 속성이 빠져있는지 체크
"jsx-a11y/role-has-required-aria-props": "warn",
// ARIA 속성은 지원되는 role에서만 사용
"jsx-a11y/role-supports-aria-props": "warn",
// DOM에 정의되지 않은 속성을 사용했는지 체크 (emotion css 속성 등 예외 케이스가 있으므로 기본은 off)
"react/no-unknown-property": "off",
// 정의한 props 중에 빠진게 있는지 체크 (NextPage 등 일부 추상화 컴포넌트에서 복잡해지므로 기본은 off)
"react/prop-types": "off",
// console.warn, console.error만 허용
"no-console": [
"error",
{
"allow": ["warn", "error"]
}
],
// import 순서 정렬
"import/order": [
"error",
{
"groups": ["builtin", "external", "internal", "parent", "sibling", "index"], // 그룹핑 순서
"newlines-between": "always", // 그룹 사이에 빈 줄 추가 여부
"pathGroups": [
{
"pattern": "react*",
"group": "external",
"position": "before"
}
],
"pathGroupsExcludedImportTypes": ["@tanstack*"],
"alphabetize": {
"order": "asc",
"caseInsensitive": true
}
}
],
// 사용하지 않는 변수 체크
"@typescript-eslint/no-unused-vars": [
"error",
{
"varsIgnorePattern": "_.*",
"argsIgnorePattern": "_.*",
"args": "none"
}
],
"import/no-duplicates": ["error", { "prefer-inline": true }],
"tailwindcss/classnames-order": "error",
"tailwindcss/enforces-shorthand": "error"
}
}