Skip to content

Commit 6a2a671

Browse files
committed
refactor: lint:fix
1 parent 00e16c2 commit 6a2a671

File tree

12 files changed

+50
-31
lines changed

12 files changed

+50
-31
lines changed

fundamentals/today-i-learned/src/components/features/discussions/PostDetail/CommentInput.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { Avatar } from "@/components/shared/ui/Avatar";
33
import { useAddDiscussionComment } from "@/api/hooks/useDiscussions";
44
import { useAuth } from "@/contexts/AuthContext";
55
import { css } from "@styled-system/css";
6+
import { handleApiError } from "@/utils/errors";
67

78
interface CommentInputProps {
89
discussionId: string;
@@ -22,7 +23,7 @@ export function CommentInput({ discussionId }: CommentInputProps) {
2223
});
2324
setCommentText("");
2425
} catch (error) {
25-
console.error("댓글 작성 실패:", error);
26+
handleApiError(error);
2627
}
2728
}
2829
};
@@ -148,4 +149,4 @@ const errorMessage = css({
148149
color: "#ef4444",
149150
fontSize: "14px",
150151
fontWeight: "500"
151-
});
152+
});

fundamentals/today-i-learned/src/components/features/sprint/SprintDayItem.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ type DayStatus =
1515
| "past-without-contribution";
1616

1717
function getDayStatus(day: SprintDay): DayStatus {
18-
if (day.isFuture) return "future";
18+
if (day.isFuture) {
19+
return "future";
20+
}
1921
if (day.isToday) {
2022
return day.hasContribution
2123
? "today-with-contribution"
@@ -27,7 +29,9 @@ function getDayStatus(day: SprintDay): DayStatus {
2729
}
2830

2931
function getDisplayText(day: SprintDay): string {
30-
if (day.isToday) return "오늘";
32+
if (day.isToday) {
33+
return "오늘";
34+
}
3135
return format(day.date, "E", { locale: ko });
3236
}
3337

fundamentals/today-i-learned/src/components/shared/common/UserDropdown.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@ interface UserDropdownProps {
4646
}
4747

4848
export function UserDropdown({ isOpen, onClose, onLogout }: UserDropdownProps) {
49-
if (!isOpen) return null;
49+
if (!isOpen) {
50+
return null;
51+
}
5052

5153
return (
5254
<div className={css(dropdownContainer)}>

fundamentals/today-i-learned/src/components/shared/ui/ReactionTooltip.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ export function ReactionTooltip({
3131
children,
3232
className
3333
}: ReactionTooltipProps) {
34-
if (!isVisible) return null;
34+
if (!isVisible) {
35+
return null;
36+
}
3537

3638
return <div className={cx(tooltipStyles, className)}>{children}</div>;
3739
}

fundamentals/today-i-learned/src/contexts/AuthContext.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,9 @@ export function AuthProvider({ children }: AuthProviderProps) {
8282
}, []);
8383

8484
const login = () => {
85-
if (typeof window === "undefined") return;
85+
if (typeof window === "undefined") {
86+
return;
87+
}
8688

8789
const redirectUri =
8890
"https://frontend-fundamentals.com/api/github/login-callback";

fundamentals/today-i-learned/src/contexts/ThemeContext.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ export function ThemeProvider({ children }: ThemeProviderProps) {
4949
};
5050

5151
useEffect(() => {
52-
if (typeof window === "undefined") return;
52+
if (typeof window === "undefined") {
53+
return;
54+
}
5355

5456
const savedTheme = localStorage.getItem("theme") as Theme;
5557
if (savedTheme) {

fundamentals/today-i-learned/src/hooks/useDiscussionReactions.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,12 @@ import {
55
getHeartAndUpvoteCounts,
66
getUserReactionStates
77
} from "@/utils/reactions";
8+
import { handleApiError } from "@/utils/errors";
89
import type { GitHubDiscussionDetail } from "@/api/remote/discussions";
910

10-
export function useDiscussionReactions(discussionDetail: GitHubDiscussionDetail) {
11+
export function useDiscussionReactions(
12+
discussionDetail: GitHubDiscussionDetail
13+
) {
1114
const { user } = useAuth();
1215
const { handleLike, handleUpvote } = usePostReactions({
1316
discussion: discussionDetail
@@ -40,7 +43,7 @@ export function useDiscussionReactions(discussionDetail: GitHubDiscussionDetail)
4043
handleUpvote(discussionDetail.id);
4144
}
4245
} catch (error) {
43-
console.error("반응 처리 실패:", error);
46+
handleApiError(error);
4447
}
4548
};
4649

@@ -57,4 +60,4 @@ export function useDiscussionReactions(discussionDetail: GitHubDiscussionDetail)
5760
heartCount,
5861
upvoteCount
5962
};
60-
}
63+
}

fundamentals/today-i-learned/src/hooks/usePostReactions.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export function usePostReactions({ discussion }: UsePostReactionsParams = {}) {
5555
DISCUSSIONS_QUERY_KEYS.detail(targetId)
5656
);
5757

58-
if (!currentData) return;
58+
if (!currentData) {return;}
5959

6060
const isCurrentlyReacted = hasUserReacted(currentData, "HEART");
6161

@@ -134,7 +134,7 @@ export function usePostReactions({ discussion }: UsePostReactionsParams = {}) {
134134
DISCUSSIONS_QUERY_KEYS.detail(targetId)
135135
);
136136

137-
if (!currentData) return;
137+
if (!currentData) {return;}
138138

139139
const isCurrentlyReacted = hasUserReacted(currentData, "THUMBS_UP");
140140

fundamentals/today-i-learned/src/pages/search/SearchContent.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export function SearchContent({ query }: SearchContentProps) {
5555
<div className={searchResultsContainer}>
5656
<h1 className={searchResultsTitle}>"{query}" 검색 결과</h1>
5757
<div className={resultsWrapper}>
58-
{[...new Array(3)].map((_, index) => (
58+
{new Array(3).fill().map((_, index) => (
5959
<div key={index} className={index < 2 ? skeletonWithMargin : ""}>
6060
<PostCardSkeleton />
6161
</div>

fundamentals/today-i-learned/src/pages/timeline/components/CommentList.tsx

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,11 @@ import { useAuth } from "@/contexts/AuthContext";
1111
interface CommentListProps {
1212
comments: GitHubComment[];
1313
discussionId: string;
14-
// onUpvote: (commentId: string) => void;
15-
// onLike: (commentId: string) => void;
16-
// onReply: (commentId: string, content: string) => void;
1714
}
1815

19-
// FIXME: suspense 적용 + errorboundary 적용 + 내부로 함수 다 불러오기
20-
export function CommentList({
21-
comments,
22-
discussionId
23-
// onUpvote,
24-
// onLike,
25-
// onReply
26-
}: CommentListProps) {
16+
export function CommentList({ comments, discussionId }: CommentListProps) {
2717
const { user } = useAuth();
18+
2819
if (comments.length === 0) {
2920
return (
3021
<div className={emptyState}>
@@ -124,10 +115,14 @@ const findCommentById = (
124115
id: string
125116
): GitHubComment | null => {
126117
for (const comment of comments) {
127-
if (comment.id === id) return comment;
118+
if (comment.id === id) {
119+
return comment;
120+
}
128121
if (comment.replies?.nodes) {
129122
const found = findCommentById(comment.replies.nodes, id);
130-
if (found) return found;
123+
if (found) {
124+
return found;
125+
}
131126
}
132127
}
133128
return null;

0 commit comments

Comments
 (0)