Files
2026-10-26 12:28:48 +09:00

68 lines
2.1 KiB
JavaScript

// @ts-check
import eslint from '@eslint/js';
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
import globals from 'globals';
import tseslint from 'typescript-eslint';
export default tseslint.config(
{
ignores: ['eslint.config.mjs', 'dist/**', 'coverage/**'],
},
eslint.configs.recommended,
...tseslint.configs.recommendedTypeChecked,
eslintPluginPrettierRecommended,
{
languageOptions: {
globals: {
...globals.node,
...globals.jest,
},
sourceType: 'commonjs',
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
},
},
},
{
rules: {
// 타입 규칙 — 명시적 타입 선언 강제 ([[coding-common]])
'@typescript-eslint/no-explicit-any': 'error',
// 비동기 누락은 조용한 버그가 되므로 error 로 승격
'@typescript-eslint/no-floating-promises': 'error',
'@typescript-eslint/no-unsafe-argument': 'error',
// 로깅 규칙 — console 대신 winston/Nest Logger 사용 ([[logging]])
'no-console': 'error',
// 에러 규칙 — 코드 없는 실패 금지. HttpException 직접 상속/생성 대신
// BusinessException 을 사용한다 ([[error-codes]])
'no-restricted-syntax': [
'error',
{
selector:
"NewExpression[callee.name='HttpException']:not([callee.name='BusinessException'])",
message:
'HttpException 을 직접 생성하지 말고 BusinessException(code) 을 사용하세요. (.claude/rules/error-codes.md)',
},
],
'prettier/prettier': ['error', { endOfLine: 'auto' }],
},
},
{
// 에러 코드 레지스트리·예외 필터는 프레임워크 예외를 직접 다루는 계층이므로 예외 허용
files: ['src/common/errors/**/*.ts', 'src/common/filters/**/*.ts'],
rules: {
'no-restricted-syntax': 'off',
},
},
{
// CLI 스크립트는 콘솔 출력이 정상 동작이다
files: ['scripts/**/*.ts'],
rules: {
'no-console': 'off',
},
},
);