[Refactor/#120] 미사용 파일, 패키지 제거 (프로젝트 재정비) #122
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 Walkthrough🎯 Walkthrough미사용 API 타입 및 함수의 export를 제거하고, 불필요한 컴포넌트(Card, OwnerHeader)와 훅(useModalMotion, useStoreDetail)을 삭제하여 프로젝트 구조를 정리하는 코드 정리 작업입니다. 📋 Changes
🎯 Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes 🔗 Possibly related PRs
✨ Suggested labels
👥 Suggested reviewers
🎭 Poem
💬 리뷰 노트이번 PR은 knip(미사용 코드 탐지 도구) 결과를 바탕으로 한 코드 정리 작업이네요! 몇 가지 확인하고 싶은 부분이 있습니다: ✅ 좋은 부분
🔍 확인 필요한 부분
혹시 로컬 빌드/테스트 과정에서 문제가 없었으면 좋겠습니다. 잘 부탁드립니다! 👍 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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 |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (3)
src/api/endpoints/payments.ts (1)
45-55:⚠️ Potential issue | 🟠 Major
confirmPayment에 에러 처리가 누락되어 있어요.
requestPayment는isSuccess를 체크하고 에러를 throw하는데,confirmPayment는 응답을 그대로 반환하고 있어요. API가 실패 응답을 반환하면 예상치 못한 동작이 발생할 수 있어요.🛠️ 에러 처리 추가 제안
export async function confirmPayment(body: { paymentKey: string; orderId: string; amount: number; }) { const res = await api.post<ApiEnvelope<PaymentConfirmResult>>( "/api/v1/payments/confirm", body, ); + if (!res.data?.isSuccess) { + throw { + status: 0, + code: res.data?.code, + message: res.data?.message ?? "결제 승인에 실패했습니다.", + }; + } return res.data.result; }코딩 가이드라인에 따라
src/api/**파일에서는 에러 처리 전략을 확인해야 해요.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/api/endpoints/payments.ts` around lines 45 - 55, confirmPayment currently returns res.data.result without checking the API envelope for errors; update the confirmPayment function to inspect res.data (ApiEnvelope) the same way requestPayment does (check isSuccess and/or error fields) and throw a descriptive error (including the envelope message/details) when the API indicates failure, otherwise return result (PaymentConfirmResult); reference the confirmPayment function and the ApiEnvelope/PaymentConfirmResult types to locate and apply the fix.src/api/endpoints/reservations.ts (1)
41-47:⚠️ Potential issue | 🟠 Major
SeatsTypes가| string때문에 사실상 무의미해집니다.
"WINDOW" | "GENERAL" | string는 컴파일 단계에서 결국string과 동일하게 동작해서 잘못된 좌석 타입이 그대로 통과됩니다.seatsType요청 파라미터도 동일한 좁은 타입으로 맞추는 게 안전합니다.🔧 제안 코드
-type SeatsTypes = "WINDOW" | "GENERAL" | string; +type SeatsTypes = "WINDOW" | "GENERAL"; ... export type GetAvailableTablesParams = { storeId: string | number; date: string; time: string; partySize: number; isSplitAccepted: boolean; - seatsType?: string; + seatsType?: SeatsTypes; };#!/bin/bash set -e echo "[1] seatsType 관련 타입 선언 점검" rg -n --type=ts -C2 'type\s+SeatsTypes|seatsType\??:\s*string|seatsType:\s*SeatsTypes' src/api src/types echo "[2] 호출부에서 전달하는 seatsType 리터럴 점검" rg -n --type=ts -C2 'seatsType\s*[:=]\s*["'\''][A-Z_]+' srcAs per coding guidelines, "src/api/**: 에러 처리/타임아웃/리트라이 전략 확인, 응답 타입 안전성 유지."
Also applies to: 59-60
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/api/endpoints/reservations.ts` around lines 41 - 47, SeatsTypes is currently declared as "WINDOW" | "GENERAL" | string which collapses to plain string; replace the union with a strict literal type (e.g., type SeatsTypes = "WINDOW" | "GENERAL") and ensure all usages (the AvailableTable.seatsType field and any request parameter typings that accept seatsType) use this SeatsTypes type so only the allowed literals pass through; update any parsing/validation where seatsType is read from requests to validate/convert unknown strings to one of the literal values or return a 4xx error.src/api/endpoints/bookings.ts (1)
11-27:⚠️ Potential issue | 🟠 Major엔드포인트 타입에서
status: string을 안전한 유니온 타입으로 변경하세요.
src/api/endpoints/bookings.ts의BookingListItem에서status: string으로 정의하면, 백엔드가 예상 외의 값을 보낼 때 타입 체크에서 잡지 못해 런타임 버그가 발생할 수 있습니다. 예약 상태는 실제로"CONFIRMED" | "COMPLETED" | "CANCELED"로 제한되므로, 명시적으로 리터럴 유니온 타입으로 정의해야 합니다.🔧 제안 코드
+type BookingStatus = "CONFIRMED" | "COMPLETED" | "CANCELED"; + type BookingListItem = { bookingId: number; storeName: string; storeAddress: string; bookingDate: string; bookingTime: { hour: number; minute: number; second: number; nano: number; }; partySize: number; tableNumbers: string; amount: number; paymentMethod: string; - status: string; + status: BookingStatus; };참고로
src/api/endpoints/payments.ts의PaymentConfirmResult도 동일한 패턴으로status: string을 가지고 있으니, 함께 수정해주세요.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/api/endpoints/bookings.ts` around lines 11 - 27, BookingListItem's status is currently a loose string which can mask invalid backend values; change the BookingListItem type so the status property is a string literal union: status: "CONFIRMED" | "COMPLETED" | "CANCELED". Also locate PaymentConfirmResult (the type with status: string) and replace its status with the appropriate literal union used by the backend (update the exact literals to match the API contract). Update any usages/imports that rely on the old string type so they compile against the new unions (functions/types referencing BookingListItem or PaymentConfirmResult).
🧹 Nitpick comments (2)
src/components/profile/profileAvatar.tsx (2)
8-8: 빈 문자열에 대한 방어 코드를 추가하면 더 안전할 것 같아요.현재
name[0]은 name이 빈 문자열일 경우 undefined를 반환할 수 있습니다. MyInfoPage에서|| "맛"으로 fallback을 제공하고 있지만, 컴포넌트 자체에서도 방어하면 재사용성이 높아집니다.🛡️ 방어 코드 추가 제안
export default function ProfileAvatar({ name }: Props) { return ( <div className="flex h-full w-full items-center justify-center rounded-full bg-gray-200 text-3xl font-semibold text-gray-600"> - {name[0]} + {name[0] || "?"} </div> ); }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/components/profile/profileAvatar.tsx` at line 8, ProfileAvatar currently uses name[0] which can be undefined for an empty string; update the component to compute a safe initial (e.g., const initial = name?.[0] ?? '맛' or name && name.length ? name[0] : '맛') and render that instead of name[0], ensuring the name prop access is defensive inside the ProfileAvatar component so it always shows a fallback initial when name is empty or undefined.
7-9: 접근성을 위해 aria-label 추가를 고려해주세요.현재 프로필 아바타가 단순 div로 렌더링되어 스크린 리더 사용자가 이것이 프로필 이미지라는 것을 인식하기 어려울 수 있습니다.
♿ 접근성 개선 제안
- <div className="flex h-full w-full items-center justify-center rounded-full bg-gray-200 text-3xl font-semibold text-gray-600"> + <div + role="img" + aria-label={`${name}님의 프로필`} + className="flex h-full w-full items-center justify-center rounded-full bg-gray-200 text-3xl font-semibold text-gray-600" + > {name[0]} </div>As per coding guidelines:
src/components/**: 접근성(aria) 체크.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/components/profile/profileAvatar.tsx` around lines 7 - 9, The profile avatar div that renders {name[0]} should include accessible attributes so screen readers understand it's a profile image; update the avatar element in profileAvatar.tsx to add an aria-label like "Profile avatar for {name}" (or just the full name), and give it role="img" (or an appropriate semantic element) so assistive tech announces it; ensure the label uses the component's name prop (name) and keep visual output unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@src/api/endpoints/bookings.ts`:
- Around line 11-27: BookingListItem's status is currently a loose string which
can mask invalid backend values; change the BookingListItem type so the status
property is a string literal union: status: "CONFIRMED" | "COMPLETED" |
"CANCELED". Also locate PaymentConfirmResult (the type with status: string) and
replace its status with the appropriate literal union used by the backend
(update the exact literals to match the API contract). Update any usages/imports
that rely on the old string type so they compile against the new unions
(functions/types referencing BookingListItem or PaymentConfirmResult).
In `@src/api/endpoints/payments.ts`:
- Around line 45-55: confirmPayment currently returns res.data.result without
checking the API envelope for errors; update the confirmPayment function to
inspect res.data (ApiEnvelope) the same way requestPayment does (check isSuccess
and/or error fields) and throw a descriptive error (including the envelope
message/details) when the API indicates failure, otherwise return result
(PaymentConfirmResult); reference the confirmPayment function and the
ApiEnvelope/PaymentConfirmResult types to locate and apply the fix.
In `@src/api/endpoints/reservations.ts`:
- Around line 41-47: SeatsTypes is currently declared as "WINDOW" | "GENERAL" |
string which collapses to plain string; replace the union with a strict literal
type (e.g., type SeatsTypes = "WINDOW" | "GENERAL") and ensure all usages (the
AvailableTable.seatsType field and any request parameter typings that accept
seatsType) use this SeatsTypes type so only the allowed literals pass through;
update any parsing/validation where seatsType is read from requests to
validate/convert unknown strings to one of the literal values or return a 4xx
error.
---
Nitpick comments:
In `@src/components/profile/profileAvatar.tsx`:
- Line 8: ProfileAvatar currently uses name[0] which can be undefined for an
empty string; update the component to compute a safe initial (e.g., const
initial = name?.[0] ?? '맛' or name && name.length ? name[0] : '맛') and render
that instead of name[0], ensuring the name prop access is defensive inside the
ProfileAvatar component so it always shows a fallback initial when name is empty
or undefined.
- Around line 7-9: The profile avatar div that renders {name[0]} should include
accessible attributes so screen readers understand it's a profile image; update
the avatar element in profileAvatar.tsx to add an aria-label like "Profile
avatar for {name}" (or just the full name), and give it role="img" (or an
appropriate semantic element) so assistive tech announces it; ensure the label
uses the component's name prop (name) and keep visual output unchanged.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: efad931d-e0da-4dab-8380-0d5ca68c057c
⛔ Files ignored due to path filters (2)
package.jsonis excluded by none and included by nonepnpm-lock.yamlis excluded by!**/pnpm-lock.yaml,!pnpm-lock.yamland included by none
📒 Files selected for processing (28)
src/api/adapters/store.adapter.tssrc/api/auth.tssrc/api/bookings.tssrc/api/dto/store.dto.tssrc/api/endpoints/bookings.tssrc/api/endpoints/member.tssrc/api/endpoints/payments.tssrc/api/endpoints/reservations.tssrc/api/endpoints/stores.tssrc/api/owner/menus.tssrc/api/owner/reservation.tssrc/api/owner/storeLayout.tssrc/api/owner/stores.tssrc/api/owner/table.tssrc/components/customer-support/faqData.tssrc/components/owner/ownerHeader.tsxsrc/components/owner/tableDashboard.tsxsrc/components/owner/tableDetailModal.tsxsrc/components/profile/profileAvatar.tsxsrc/components/store-registration/Menu.schema.tssrc/components/store-registration/StoreInfo.schema.tssrc/components/store-registration/StoreTransform.utils.tssrc/components/ui/card.tsxsrc/hooks/common/useModalMotion.tssrc/hooks/reservation/useAvailableTimes.tssrc/hooks/reservation/useStoreDetail.tssrc/pages/myPage/MyInfoPage.tsxsrc/types/restaurant.ts
💤 Files with no reviewable changes (7)
- src/hooks/common/useModalMotion.ts
- src/hooks/reservation/useStoreDetail.ts
- src/components/owner/ownerHeader.tsx
- src/types/restaurant.ts
- src/components/ui/card.tsx
- src/api/dto/store.dto.ts
- src/api/endpoints/stores.ts
🔢 관련 이슈 링크
📌 변경사항PR
💻 작업내용
삭제
수정
export 제거
🪧 미완성 작업
🤔 논의 사항 및 참고 사항
✅ 체크리스트
Summary by CodeRabbit
릴리스 노트
리팩토링
UI 개선