refactor(lint): import/no-cycle 활성화 + common/global 모듈 경계 ESLint 강제 (P2-3)#126
Conversation
…P2-3 코어)
- import/no-cycle 활성화 (현재 위반 0건, 순환참조 회귀 방지)
- no-restricted-imports 로 CLAUDE.md 의존성 방향 룰 강제:
- common → features/global/prisma 의존 금지 (common → 무의존)
- common/utils → DI(Injectable/Inject)·ConfigService·Prisma 의존 금지
(DI 없는 값 클래스 HttpException 류는 허용 — finding 5)
- global → features/prisma 의존 금지 (global → common, config)
- 신규 의존성 없음 (eslint-plugin-import 기존 설치). 기존 코드 위반 0건.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Coverage report
Test suite run success1254 tests passing in 146 suites. Report generated by 🧪jest coverage report action from d155da7 |
Summary
리팩토링 플랜 P2-3(ESLint
import/no-cycle활성화 + 모듈 경계 강화)의 코어를 적용합니다. CLAUDE.md 의 의존성 방향 룰을 사람 규율이 아니라 ESLint 로 자동 강제해, 경계 위반·순환참조가 PR 단계에서 잡히게 합니다.신규 의존성 없이(
eslint-plugin-import기존 설치) 적용했고, 기존 코드 위반 0건이라 회귀 방지 성격입니다.cross-feature 내부 import 강제(features 간 직접 import 금지)는 별도 결정사항으로 분리했습니다 — 아래 진행 상황 참조.
Scope
변경:
eslint.config.mjsimport/no-cycle활성화 (error,ignoreExternal) — 현재 순환참조 0건no-restricted-imports경계 룰 3종 추가:src/common/**→@/features·@/global·@/prismaimport 금지 (common → 무의존)src/common/utils/**→ 위 +@nestjs/common의Injectable/Inject·@nestjs/configimport 금지 (순수 함수 보장). DI 없는 값 클래스(HttpException류)는 허용src/global/**→@/features·@/prismaimport 금지 (global → common, config)진행 상황
플랜 P2 잔여, 자율 진행 중.
user서비스 4곳이product/order의 repository 내부 파일을 deep-path 로 직접 import (CLAUDE.md "내부 파일 직접 import 금지" 위반). 강제하려면 (a)eslint-plugin-boundaries신규 의존성 도입 또는 (b) feature 별no-restricted-imports설정 + 해당 4개 import 를 barrel 경유로 수정 필요 → 사용자 사인오프 후 별도 PRImpact
Test plan
npx eslint 'src/**/*.ts'— 새 규칙 위반 0건yarn lint— 0 errors (기존 미사용 import 경고 1건은 무관)yarn validate(pre-push) 통과