Skip to content

refactor: namespace 및 namespace import 제거 & subpath named export 전환 & relative parent import 제거#58

Open
MU-Software wants to merge 4 commits into
mainfrom
refactor/remove-namespace-usage
Open

refactor: namespace 및 namespace import 제거 & subpath named export 전환 & relative parent import 제거#58
MU-Software wants to merge 4 commits into
mainfrom
refactor/remove-namespace-usage

Conversation

@MU-Software
Copy link
Copy Markdown
Member

Summary

코드베이스 전반의 import / module 구조를 현대적인 TypeScript 컨벤션에 맞춰 정리하는 순수 리팩터링입니다. 기능 변경은 없습니다.

1. namespace 키워드 및 namespace import 제거

  • TypeScript에서 비권장하는 namespace Foo { ... } 키워드 사용을 패키지 전반에서 제거 (shop의 9개 배럴 + common/components)
  • import * as React / * as R 등 namespace import 196 → 2개 (남은 2개는 ...runtime, ...provider 스프레드용으로 필수)
  • 효과: 번들러 트리쉐이킹 정상 동작, IDE 자동 import / "Find References" 정확도 향상

2. Subpath named export 전환

  • 배럴의 namespace export (export * as Components, export { default as ... }) 제거 → 평탄한 named re-export
  • 소비자는 import { MDXRenderer } from "@frontend/common/components" 같은 subpath named import 사용
  • MUI · Radix · TanStack · date-fns 등 주요 React 라이브러리들의 사실상 표준 패턴
  • 효과: 어떤 심볼이 어디서 오는지 import 경로에서 즉시 확인 가능

3. Relative parent import 제거

  • ../../../../packages/common/src/schemas/backendAPI 같은 깊은 상대 경로를 alias로 일괄 치환 (239개)
  • 신규 alias: @apps/pyconkr-admin/*, @apps/pyconkr-participant-portal/* (root tsconfig에 추가)
  • tsconfig.base.json을 신설해 7개 tsconfig의 중복 옵션 일원화 (extends로 상속)
  • 효과: 파일 이동 시 경로 깨짐 없음, grep 가독성 향상

보너스

  • ESLint import/no-restricted-paths 규칙 추가
    • 패키지 → 앱 / common → shop / 앱끼리 cross-import 금지를 빌드 차원에서 강제
  • ESLint flat config의 ignores 위치 버그 수정
  • 부수적으로 발견한 React Hook 위반 4건 (SignInButton hook-in-callback, signin 페이지 conditional hook) 해소
  • *.tsbuildinfo gitignore 추가

import { MobileLanguageToggle } from "./MobileLanguageToggle";
import { SignInButton } from "../../SignInButton";
// import { ScanCodeButton } from "../../UserScanCodeButton";
// import { ScanCodeButton } from "@apps/pyconkr-2025/components/layout/UserScanCodeButton";
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

아주 마이너한 내용이지만 주석 import 제거하면 좋을 것 같습니다!

import { SignInButton } from "@apps/pyconkr-2025/components/layout/SignInButton";
import { useAppContext } from "@apps/pyconkr-2025/contexts/app_context";

// import { ScanCodeIconButton } from "@apps/pyconkr-2025/components/layout/UserScanCodeButton";
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

여기서도 주석 import 제거하면 좋을 것 같습니다!

Copy link
Copy Markdown
Contributor

@earthyoung earthyoung left a comment

Choose a reason for hiding this comment

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

작업량이 엄청 많았는데 고생하셨습니다..!! LGTM 입니다!

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.

2 participants