-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path.eslintrc.cjs
98 lines (96 loc) · 3.37 KB
/
.eslintrc.cjs
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
module.exports = {
// 필요한 플러그인을 여기에 정의합니다.
plugins: [
"no-relative-import-paths",
// 플러그인 문서:
// 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
"react",
"react-refresh",
"jsx-a11y",
],
extends: [
"@rushstack/eslint-config/profile/web-app",
"plugin:@typescript-eslint/recommended",
"plugin:react/recommended",
"plugin:react-hooks/recommended",
"plugin:react/jsx-runtime",
"plugin:@tanstack/eslint-plugin-query/recommended",
"plugin:storybook/recommended",
"plugin:storybook/recommended",
],
settings: {
// 공통으로 넣고 싶은 설정이 있으면 추가합니다.
react: {
// 현재 React 버전을 명시합니다.
// 명시하지 않을 경우(기본값 'detect') React 라이브러리 전체를 불러오므로
// 린트 과정에서 속도가 느려질 수 있습니다.
version: "detect",
},
},
overrides: [
{
files: ["**/*.{ts,tsx}"],
parser: "@typescript-eslint/parser",
parserOptions: {
project: ["tsconfig.json", "tsconfig.app.json", "tsconfig.node.json"], // tsconfig.json 경로 설정
},
plugins: ["@typescript-eslint"],
rules: {
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-unused-vars": "warn",
},
},
// {
// files: ["**/__tests__/**/*.[jt]s?(x)", "**/?(*.)+(spec|test).[jt]s?(x)"],
// extends: ["plugin:testing-library/react"],
// rules: {
// "react-refresh/only-export-components": "off",
// },
// },
],
rules: {
"react-refresh/only-export-components": [
"warn",
{ allowConstantExport: true },
],
// <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",
// 사용하지 않는 변수를 underscore(_)로 작성할 수 있도록 선행 underscore 허용
"@typescript-eslint/naming-convention": [
"error",
{
selector: "parameter",
format: ["camelCase"],
leadingUnderscore: "allow",
},
{
selector: "variable",
format: ["camelCase", "UPPER_CASE", "PascalCase"],
leadingUnderscore: "allow",
},
],
},
ignorePatterns: ["dist"], // dist 폴더는 ESLint 분석에서 제외
};