Skip to content

[공통] Barrel import 제거 #1181

Merged
ff1451 merged 2 commits into
developfrom
refactor/1180/barrel-import
Feb 19, 2026
Merged

[공통] Barrel import 제거 #1181
ff1451 merged 2 commits into
developfrom
refactor/1180/barrel-import

Conversation

@ff1451
Copy link
Copy Markdown
Contributor

@ff1451 ff1451 commented Feb 13, 2026

What is this PR? 🔍

Changes 📝

api/index.ts barrel 경유 import가 광범위하게 사용되어 의존성 추적성과 번들 최적화 측면에서 단점이 있어 리팩토링 진행했습니다.

주요 변경사항

  • api 사용 패턴 정리
  • import * as api from 'api' -> import { ... } from 'api/<domain>' 전환
  • src/api/cafeteria/index.ts에서 default export 제거
  • cafeteria API를 명시적 named export로 통일
    • getCafeteriaDinings
    • likeCafeteriaDining
    • cancelCafeteriaDiningLike
  • 이름 충돌 해소
    • useLogin: login -> submitLogin
    • useDinings: like/cancelLike mutation 객체명 명확화
  • 호출부 전반(pages, hooks)의 import/함수 참조 업데이트

ScreenShot 📷

작업 이전 초기 번들 크기
image

리팩토링 이후 초기 번들 크기 (4kB 감소)
image

✔️ Please check if the PR fulfills these requirements

  • It's submitted to the correct branch, not the develop branch unconditionally?
  • [] If on a hotfix branch, ensure it targets main?
  • There are no warning message when you run yarn lint

@ff1451 ff1451 self-assigned this Feb 13, 2026
@claude
Copy link
Copy Markdown

claude Bot commented Feb 13, 2026

Claude finished @ff1451's task in 2m 1s —— View job


PR 리뷰 완료

  • 변경사항 컨텍스트 파악
  • Barrel import 제거 패턴 검토
  • 잠재적 버그/이슈 확인
  • 네이밍 일관성 검토
  • 최종 리뷰 요약

전체 평가

Barrel import 제거를 통한 번들 최적화 리팩토링입니다. 전반적으로 잘 진행되었으며, 4kB 번들 크기 감소 효과가 확인되었습니다.


발견된 이슈

[P1] 누락된 파일 - 일관성 문제

다음 2개 파일에서 barrel import 패턴이 아직 남아있습니다:

1. src/components/GraduationCalculatorPage/hooks/useGeneralEducation.ts:2

// 현재 (barrel import 사용 중)
import { graduationCalculator } from 'api';
// ...
queryFn: () => graduationCalculator.getGeneralEducation(token),
// 권장 변경
import { getGeneralEducation } from 'api/graduationCalculator';
// ...
queryFn: () => getGeneralEducation(token),

2. src/components/GraduationCalculatorPage/hooks/useCourseType.ts:2

// 현재 (barrel import 사용 중)
import { graduationCalculator } from 'api';
// ...
queryFn: () => graduationCalculator.getCourseType(token, semester, name, generalEducationArea),
// 권장 변경
import { getCourseType } from 'api/graduationCalculator';
// ...
queryFn: () => getCourseType(token, semester, name, generalEducationArea),

이 이슈 수정하기 →


긍정적 측면

  1. 일관된 패턴 적용: 59개 파일에서 import * as api from 'api' 또는 import { domain } from 'api' 패턴을 import { specificFunction } from 'api/domain' 패턴으로 일관되게 변경
  2. 명시적 네이밍: cafeteria API에서 default export 제거 후 명확한 named export 사용 (getCafeteriaDinings, likeCafeteriaDining, cancelCafeteriaDiningLike)
  3. 이름 충돌 해결: useLogin에서 loginsubmitLogin으로 변경하여 API 함수와의 이름 충돌 해소
  4. 번들 최적화: 4kB 번들 크기 감소 확인
  5. CI 통과: lint-action이 성공적으로 통과함

결론

위 2개 파일의 누락된 변경사항을 추가하면 머지 가능합니다.

@ff1451 ff1451 added the 🔨 Refactor 코드 리팩토링 label Feb 13, 2026
@claude
Copy link
Copy Markdown

claude Bot commented Feb 13, 2026

Claude finished @ff1451's task in 1m 12s —— View job


PR 리뷰 완료

  • 이전 리뷰에서 지적된 파일 수정 확인
  • 새로운 커밋 변경사항 검토
  • 최종 리뷰 요약

전체 평가: ✅ LGTM

이전 리뷰에서 지적된 2개 파일의 barrel import 누락이 최신 커밋(97520cb)에서 정상적으로 수정되었습니다.


수정 확인됨

src/components/GraduationCalculatorPage/hooks/useGeneralEducation.ts

// 변경 전
import { graduationCalculator } from 'api';
// 변경 후 ✅
import { getGeneralEducation } from 'api/graduationCalculator';

src/components/GraduationCalculatorPage/hooks/useCourseType.ts

// 변경 전
import { graduationCalculator } from 'api';
// 변경 후 ✅
import { getCourseType } from 'api/graduationCalculator';

검증 결과

항목 상태
Barrel import 패턴 제거 import * as api from 'api'from 'api' 패턴 미검출
Cafeteria API named export ✅ 정상 적용
이름 충돌 해결 (submitLogin) ✅ 정상 적용
lint-action ✅ 통과

결론

모든 지적 사항이 수정되었습니다. 머지 가능합니다.


Copy link
Copy Markdown
Contributor

@dooohun dooohun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

직접 수정해야 하는 내용들이 대부분이라 변경하는데 오래 걸렸을 거 같네요! 수고하셨습니다~👍

@ff1451 ff1451 merged commit 5e287fd into develop Feb 19, 2026
3 checks passed
@github-actions github-actions Bot deleted the refactor/1180/barrel-import branch February 19, 2026 07:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🔨 Refactor 코드 리팩토링

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[공통] Barrel import 제거

2 participants