-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy patheslint.config.js
More file actions
143 lines (137 loc) · 5.28 KB
/
eslint.config.js
File metadata and controls
143 lines (137 loc) · 5.28 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
import eslint from "@eslint/js"
import tseslint from "typescript-eslint"
import eslintConfigPrettier from "eslint-config-prettier"
import jsdoc from "eslint-plugin-jsdoc"
import globals from "globals"
import mochaPlugin from "eslint-plugin-mocha"
import licenseHeader from "eslint-plugin-license-header"
export default tseslint.config(
{
ignores: [
"**/node_modules/**",
"**/build/**",
"**/examples/**",
"tsup.config.ts",
"itdoc-doc/**",
"**/*.md",
"**/*.mdx",
"output/**",
],
},
// ESLint 기본 추천 규칙
eslint.configs.recommended,
// TypeScript 추천 규칙
...tseslint.configs.recommended,
// JSDoc 문서화 추천 규칙
jsdoc.configs["flat/recommended"],
// Mocha 플러그인 설정
{
plugins: {
mocha: mochaPlugin,
},
},
{
files: ["**/*.ts"],
languageOptions: {
// 사용할 JavaScript 버전 지정
ecmaVersion: 2022,
// ESM 모듈 시스템 사용
sourceType: "module",
// TypeScript 파서 사용
parser: tseslint.parser,
parserOptions: {
// TypeScript 설정 파일 지정
project: ["./tsconfig.json", "./tsconfig.test.json"],
},
// env 대신 globals 사용
globals: {
...globals.node,
...globals.es2022,
...globals.mocha,
},
},
plugins: {
jsdoc,
"license-header": licenseHeader,
},
rules: {
// TypeScript 관련 규칙
// 함수의 반환 타입 명시 필수 -> widdershins 모듈문제로 임시 비활성화
"@typescript-eslint/explicit-function-return-type": "off",
// 사용하지 않는 변수 에러 처리 (_로 시작하는 변수는 제외)
"@typescript-eslint/no-explicit-any": "warn", // error에서 warn으로 변경
"@typescript-eslint/no-unused-vars": ["error", { argsIgnorePattern: "^_" }],
// 클래스 멤버의 접근 제한자 명시 필수
"@typescript-eslint/explicit-member-accessibility": [
"error",
{ accessibility: "explicit" },
],
"@typescript-eslint/no-require-imports": "warn", // error에서 warn으로 변경
// JSDoc 규칙 완화
"jsdoc/require-description": "warn",
"jsdoc/require-param-description": "warn",
"jsdoc/require-returns-description": "warn",
"jsdoc/require-example": "off", // 필수 예제 비활성화
"jsdoc/check-examples": "off", // 예제 검사 비활성화
"jsdoc/require-throws": "warn",
"jsdoc/require-param": "warn",
"jsdoc/require-returns": "warn",
"jsdoc/require-param-type": "warn",
// 코드 품질 규칙
// 중첩 콜백 최대 3개까지 허용
"max-nested-callbacks": ["error", 3],
// 함수당 최대 50줄 제한 (빈 줄과 주석 제외)
"max-lines-per-function": [
"warn", // error에서 warn으로 변경
{ max: 150, skipBlankLines: true, skipComments: true },
],
// Mocha 테스트 규칙
"mocha/no-skipped-tests": "warn",
// 단독 실행 테스트 금지
"mocha/no-exclusive-tests": "error",
// 라이센스 헤더 규칙
"license-header/header": [
"error",
[
"/*",
" * Copyright " + new Date().getFullYear() + " the original author or authors.",
" *",
' * Licensed under the Apache License, Version 2.0 (the "License");',
" * you may not use this file except in compliance with the License.",
" * You may obtain a copy of the License at",
" *",
" * http://www.apache.org/licenses/LICENSE-2.0",
" *",
" * Unless required by applicable law or agreed to in writing, software",
' * distributed under the License is distributed on an "AS IS" BASIS,',
" * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.",
" * See the License for the specific language governing permissions and",
" * limitations under the License.",
" */",
],
],
// no-console 규칙: widdershins 모듈문제로 임시 비활성화
"no-console": "off",
},
// JSDoc 설정
settings: {
jsdoc: {
mode: "typescript",
// 태그 이름 설정
tagNamePreference: {
returns: "returns",
example: "example",
},
},
},
},
{
files: ["**/__tests__/**/*.ts"],
rules: {
"max-lines-per-function": "off",
"max-nested-callbacks": "off",
},
},
// Prettier와의 충돌 방지
eslintConfigPrettier,
)