Skip to content

refactor(lint): cross-feature 내부 import 금지 (boundaries) + barrel 경유 정리 (P2-3)#127

Merged
chanwoo7 merged 1 commit into
developfrom
refactor/cross-feature-import-boundaries
Jun 3, 2026
Merged

refactor(lint): cross-feature 내부 import 금지 (boundaries) + barrel 경유 정리 (P2-3)#127
chanwoo7 merged 1 commit into
developfrom
refactor/cross-feature-import-boundaries

Conversation

@chanwoo7
Copy link
Copy Markdown
Member

@chanwoo7 chanwoo7 commented Jun 3, 2026

Summary

플랜 P2-3의 cross-feature 경계 강화입니다 (#126 코어에 이어). eslint-plugin-boundaries 로 "feature 는 다른 feature 를 barrel(index.ts) 로만 import" 를 자동 강제하고, 기존에 deep-path 로 다른 feature 내부 파일을 직접 참조하던 6곳을 barrel 경유로 정리했습니다.

CLAUDE.md "features 가 다른 features 의 내부 파일을 직접 import 금지 → Module export provider 로 주입" 룰을 사람 규율이 아니라 lint 로 강제합니다.

Scope

신규 의존성: eslint-plugin-boundaries (devDependency)

eslint.config.mjs

  • element 정의: common / config / prisma / global / feature(src/features/*, family capture)
  • boundaries/entry-point: feature 타깃은 index.ts 로만 import 허용 (비-feature 요소는 임의 파일 허용). 같은 feature 내부 import 와 app.module(src 루트, 미분류) 의 import 는 검사 대상 아님 — 진짜 cross-feature 내부 결합만 차단
  • 테스트 파일은 통합 테스트 편의상 boundaries/ignore 로 제외

import 정리 (6곳, deep-path → barrel)

  • user-wishlist.service · user-recent-view.service@/features/product (ProductRepository)
  • user-order.service · user-mypage.service@/features/order (OrderRepository)
  • user.module@/features/order · @/features/product (Order/ProductModule)

product/order barrel 은 이미 해당 심볼을 export 하고 있어 export 추가는 불필요했습니다.

진행 상황

Impact

  • FE / DB / 런타임: 영향 없음 (lint 설정 + import 경로만, 동작 동일).
  • CI: lint 단계에서 cross-feature 내부 import 차단. 현재 위반 0건.
  • 알려진 후속 과제: boundaries/entry-point 는 v6 에서 deprecated (→ boundaries/dependencies). 신규 API 는 default-disallow 라 refactor(lint): import/no-cycle 활성화 + common/global 모듈 경계 ESLint 강제 (P2-3) #126 의 no-restricted-imports 방향 룰과 중복·충돌 소지가 있어, 현 시점은 검증된 entry-point 를 유지. dependencies 마이그레이션은 Tech Debt 로 분리 추적.

Test plan

  • 음성 테스트: deep-path cross-feature import 를 일시 복원 → boundaries 가 정확히 차단함을 확인 (There is no rule allowing dependencies from feature/user to feature/order)
  • barrel import 는 허용 (clean 상태 위반 0건)
  • yarn validate (lint + tsc + dto:check + test:cov) 통과 — 1254 tests, 146 suites
  • CI 통과 확인

…리 (P2-3)

- eslint-plugin-boundaries 도입: feature 는 다른 feature 를 barrel(index.ts) 로만
  import 하도록 boundaries/entry-point 로 강제 (같은 feature 내부/ app.module 은 비대상)
- user 서비스·모듈 6곳의 deep-path cross-feature import 를 barrel 경유로 정리:
  - user-{wishlist,recent-view}.service → @/features/product (ProductRepository)
  - user-{order,mypage}.service → @/features/order (OrderRepository)
  - user.module → @/features/{order,product} (Order/ProductModule)
- 위반 0건. 향후 cross-feature 내부 결합 회귀 방지.

NOTE: boundaries/entry-point 는 v6 에서 deprecated(→ boundaries/dependencies).
신규 API 가 default-disallow 라 #126 no-restricted 와 중복·충돌 소지가 있어
현 시점은 검증된 entry-point 유지. 마이그레이션은 후속 과제(Tech Debt)로 분리.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 3, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: a7767809-8fb3-4db3-9d7c-2c29ba1a3dc2

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/cross-feature-import-boundaries

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 3, 2026

Coverage report

St.
Category Percentage Covered / Total
🟢 Statements 97.42% 3555/3649
🟢 Branches 93.83% 1125/1199
🟢 Functions 94.09% 653/694
🟢 Lines 97.66% 3253/3331

Test suite run success

1254 tests passing in 146 suites.

Report generated by 🧪jest coverage report action from d49dd6c

@chanwoo7 chanwoo7 merged commit 8dd2866 into develop Jun 3, 2026
9 checks passed
@chanwoo7 chanwoo7 deleted the refactor/cross-feature-import-boundaries branch June 3, 2026 19:35
@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 3, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant