Skip to content

Connect, collaborate, and grow with a community of TypeScript developers

chore: enable a few useful stylistic or unused-code-detection ESLint rules (#1694)

Josh Goldberg ✨3f62e09b049b
diff --git a/apps/admin/src/app/dashboard/reports/[id]/_actions.ts b/apps/admin/src/app/dashboard/reports/[id]/_actions.ts
index dad03690..c4022136 100644
--- a/apps/admin/src/app/dashboard/reports/[id]/_actions.ts
+++ b/apps/admin/src/app/dashboard/reports/[id]/_actions.ts
@@ -138,7 +138,7 @@ export async function deleteSolution(solutionId: number, reportId: number) {
}),
]);
return 'ok';
- } catch (e) {
+ } catch {
return 'failed';
}
}
diff --git a/apps/admin/src/app/dashboard/reports/[id]/_components/comment.report.tsx b/apps/admin/src/app/dashboard/reports/[id]/_components/comment.report.tsx
index d7ec11a0..f67d2320 100644
--- a/apps/admin/src/app/dashboard/reports/[id]/_components/comment.report.tsx
+++ b/apps/admin/src/app/dashboard/reports/[id]/_components/comment.report.tsx
@@ -5,7 +5,6 @@ import type { ReportWithInfo } from '../_actions';
export function CommentReport({ report }: { report: NonNullable<ReportWithInfo> }) {
if (report.type !== 'COMMENT' || report.commentId === null || !report.comment) return null;
- const rootId = report.comment.rootChallengeId ?? report.comment.rootSolutionId ?? -1;
return (
<div>
diff --git a/apps/admin/src/app/dashboard/reports/[id]/_components/extra-actions.report.tsx b/apps/admin/src/app/dashboard/reports/[id]/_components/extra-actions.report.tsx
index f4ff5fbd..a5b94595 100644
--- a/apps/admin/src/app/dashboard/reports/[id]/_components/extra-actions.report.tsx
+++ b/apps/admin/src/app/dashboard/reports/[id]/_components/extra-actions.report.tsx
@@ -13,7 +13,7 @@ export const ExtraActionsButton = ({ report }: { report: ReportWithInfo }) => {
description: <p>Comment deleted successfully</p>,
});
router.push('/?tab=reports');
- } catch (e) {
+ } catch {
toast({
title: 'Error',
variant: 'destructive',
@@ -25,7 +25,7 @@ export const ExtraActionsButton = ({ report }: { report: ReportWithInfo }) => {
try {
await banChallenge(challengeId, reportId);
router.push('/?tab=reports');
- } catch (e) {
+ } catch {
toast({
title: 'Error',
variant: 'destructive',
diff --git a/apps/admin/src/app/dashboard/reports/[id]/actions.tsx b/apps/admin/src/app/dashboard/reports/[id]/actions.tsx
index a83962b4..9bc71d73 100644
--- a/apps/admin/src/app/dashboard/reports/[id]/actions.tsx
+++ b/apps/admin/src/app/dashboard/reports/[id]/actions.tsx
@@ -54,7 +54,7 @@ export function ReportActions({ report }: ReportActionsProps) {
description: <p>User banned successfully.</p>,
});
router.push('/?tab=reports');
- } catch (e) {
+ } catch {
toast({
title: 'Error',
variant: 'destructive',
diff --git a/apps/admin/src/app/dashboard/reports/[id]/page.tsx b/apps/admin/src/app/dashboard/reports/[id]/page.tsx
index b2f6ab58..412ec637 100644
--- a/apps/admin/src/app/dashboard/reports/[id]/page.tsx
+++ b/apps/admin/src/app/dashboard/reports/[id]/page.tsx
@@ -12,7 +12,7 @@ import { SolutionReport } from './_components/solution.report';
import { UserReport } from './_components/user.report';
import { ReportActions } from './actions';
-export interface Props {
+export interface ReportPageProps {
params: {
id: string;
};
@@ -39,7 +39,7 @@ const getComponentByType = (type: ReportWithInfo['type']) => {
USER: UserReport,
}[type];
};
-export default async function ReportPage({ params: { id } }: Props) {
+export default async function ReportPage({ params: { id } }: ReportPageProps) {
const session = await auth();
assertAdmin(session);
diff --git a/apps/admin/src/app/dashboard/tracks/[trackId]/_actions/update-track.action.ts b/apps/admin/src/app/dashboard/tracks/[trackId]/_actions/update-track.action.ts
index 2f17b8c0..e52a1924 100644
--- a/apps/admin/src/app/dashboard/tracks/[trackId]/_actions/update-track.action.ts
+++ b/apps/admin/src/app/dashboard/tracks/[trackId]/_actions/update-track.action.ts
@@ -20,7 +20,7 @@ export async function updateTrack(data: FormSchema & { trackId: number }) {
trackChallenges: {
createMany: {
data: trackChallenges.map((tc) => {
- const { challenge, ...rest } = tc;
+ const { challenge: _, ...rest } = tc;
return { ...rest };
}),
},
diff --git a/apps/admin/src/app/dashboard/tracks/[trackId]/_components/draggable-challenge.tsx b/apps/admin/src/app/dashboard/tracks/[trackId]/_components/draggable-challenge.tsx
index c21da754..a45fce10 100644
--- a/apps/admin/src/app/dashboard/tracks/[trackId]/_components/draggable-challenge.tsx
+++ b/apps/admin/src/app/dashboard/tracks/[trackId]/_components/draggable-challenge.tsx
@@ -9,13 +9,13 @@ interface DragItem {
type: string;
}
-export interface Props {
+export interface DraggableChallengeProps {
id: number;
text: string;
index: number;
moveChallenge: (dragIndex: number, hoverIndex: number) => void;
}
-export function DraggableChallenge({ id, text, index, moveChallenge }: Props) {
+export function DraggableChallenge({ id, text, index, moveChallenge }: DraggableChallengeProps) {
const ref = useRef<HTMLDivElement>(null);
const [{ handlerId }, drop] = useDrop<DragItem, unknown, { handlerId: Identifier | null }>({
accept: 'trackChallenge',
@@ -83,7 +83,6 @@ export function DraggableChallenge({ id, text, index, moveChallenge }: Props) {
}),
});
- const opacity = isDragging ? 0 : 1;
drag(drop(ref));
return (
<div
diff --git a/apps/admin/src/app/dashboard/tracks/[trackId]/_components/update-track-form.tsx b/apps/admin/src/app/dashboard/tracks/[trackId]/_components/update-track-form.tsx
index 371e6846..e5f8b9b5 100644
--- a/apps/admin/src/app/dashboard/tracks/[trackId]/_components/update-track-form.tsx
+++ b/apps/admin/src/app/dashboard/tracks/[trackId]/_components/update-track-form.tsx
@@ -38,7 +38,7 @@ const formSchema = z.object({
});
export type FormSchema = z.infer<typeof formSchema>;
-export interface Props {
+export interface UpdateTrackFormProps {
track: TrackToManage;
challenges: ChallengesForTrack;
}
@@ -50,7 +50,7 @@ function transformChallengesForDropdown(challenges: ChallengesForTrack) {
}));
}
-export function UpdateTrackForm({ challenges, track }: Props) {
+export function UpdateTrackForm({ challenges, track }: UpdateTrackFormProps) {
const { toast } = useToast();
const form = useForm<FormSchema>({
@@ -96,7 +96,7 @@ export function UpdateTrackForm({ challenges, track }: Props) {
toast({
title: 'Track Updated',
});
- } catch (e) {
+ } catch {
toast({
variant: 'destructive',
title: 'Something went wrong',
@@ -170,7 +170,7 @@ export function UpdateTrackForm({ challenges, track }: Props) {
<Select
isMulti
styles={{
- option: (base, { data, isDisabled, isFocused, isSelected }) => {
+ option: (base, { isFocused, isSelected }) => {
return {
...base,
':active': {
diff --git a/apps/admin/src/app/dashboard/tracks/[trackId]/page.tsx b/apps/admin/src/app/dashboard/tracks/[trackId]/page.tsx
index 2d42ae99..e4f268a7 100644
--- a/apps/admin/src/app/dashboard/tracks/[trackId]/page.tsx
+++ b/apps/admin/src/app/dashboard/tracks/[trackId]/page.tsx
@@ -3,13 +3,13 @@ import { prisma } from '@repo/db';
import { assertAdmin } from '~/utils/auth-guards';
import { UpdateTrackForm } from './_components/update-track-form';
-export interface Props {
+export interface TracksPageProps {
params: {
trackId: string;
};
}
-export default async function TrackPage(props: Props) {
+export default async function TrackPage(props: TracksPageProps) {
const session = await auth();
assertAdmin(session);
diff --git a/apps/admin/src/app/dashboard/tracks/[trackId]/providers.tsx b/apps/admin/src/app/dashboard/tracks/[trackId]/providers.tsx
index f769c6ba..95865bfa 100644
--- a/apps/admin/src/app/dashboard/tracks/[trackId]/providers.tsx
+++ b/apps/admin/src/app/dashboard/tracks/[trackId]/providers.tsx
@@ -3,10 +3,10 @@
import { DndProvider } from 'react-dnd';
import { HTML5Backend } from 'react-dnd-html5-backend';
-interface Props {
+interface ProvidersProps {
children: React.ReactNode;
}
-export function Providers({ children }: Props) {
+export function Providers({ children }: ProvidersProps) {
return <DndProvider backend={HTML5Backend}>{children}</DndProvider>;
}
diff --git a/apps/admin/src/app/dashboard/tracks/_components/add-track-form.tsx b/apps/admin/src/app/dashboard/tracks/_components/add-track-form.tsx
index b7f4ad09..8e0a050d 100644
--- a/apps/admin/src/app/dashboard/tracks/_components/add-track-form.tsx
+++ b/apps/admin/src/app/dashboard/tracks/_components/add-track-form.tsx
@@ -25,10 +25,10 @@ const formSchema = z.object({
export type FormSchema = z.infer<typeof formSchema>;
-interface Props {
+interface AddTrackFormProps {
toggle: (value: boolean) => void;
}
-export function AddTrackForm({ toggle }: Props) {
+export function AddTrackForm({ toggle }: AddTrackFormProps) {
const { toast } = useToast();
const router = useRouter();
@@ -54,7 +54,7 @@ export function AddTrackForm({ toggle }: Props) {
</pre>
),
});
- } catch (e) {
+ } catch {
toast({
variant: 'destructive',
title: 'Something went wrong',
diff --git a/apps/admin/src/app/dashboard/tracks/tracks.actions.ts b/apps/admin/src/app/dashboard/tracks/tracks.actions.ts
index 193eff29..1d1220cc 100644
--- a/apps/admin/src/app/dashboard/tracks/tracks.actions.ts
+++ b/apps/admin/src/app/dashboard/tracks/tracks.actions.ts
@@ -19,7 +19,7 @@ export async function createTrack(data: Omit<Prisma.TrackCreateInput, 'slug'>) {
const session = await auth();
assertAdmin(session);
- const { trackChallenges, ...rest } = data;
+ const { trackChallenges: _, ...rest } = data;
const slug = rest.name.toLowerCase().replace(/\s/g, '-');
return prisma.track.create({
data: {
diff --git a/apps/admin/src/app/providers.tsx b/apps/admin/src/app/providers.tsx
index acc8a142..d0601c61 100644
--- a/apps/admin/src/app/providers.tsx
+++ b/apps/admin/src/app/providers.tsx
@@ -5,7 +5,7 @@ import { TooltipProvider } from '@repo/ui/components/tooltip';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { ThemeProvider } from 'next-themes';
-interface Props {
+interface ProvidersProps {
children: React.ReactNode;
}
@@ -17,7 +17,7 @@ const queryClient = new QueryClient({
},
});
-export function Providers({ children }: Props) {
+export function Providers({ children }: ProvidersProps) {
return (
<QueryClientProvider client={queryClient}>
<SessionProvider>
diff --git a/apps/admin/src/components/navigation.tsx b/apps/admin/src/components/navigation.tsx
index a5799b6e..562a627d 100644
--- a/apps/admin/src/components/navigation.tsx
+++ b/apps/admin/src/components/navigation.tsx
@@ -94,7 +94,7 @@ function LoginButton() {
setLoading(true);
// page reloads after sign in, so no need to setLoading(false), othersiwe ugly visual glitch
await signIn('github', { redirect: false });
- } catch (error) {
+ } catch {
// only set loading to false if there was an error and page didn't reload after sign in
setLoading(false);
}
diff --git a/apps/aot/src/app/error.tsx b/apps/aot/src/app/error.tsx
index 5a0ef696..9a7db56c 100644
--- a/apps/aot/src/app/error.tsx
+++ b/apps/aot/src/app/error.tsx
@@ -3,7 +3,11 @@
import Snowfall from '~/components/landing/Snowfall';
import { useEffect } from 'react';
-export default function Error({ error, reset }: { error: Error; reset: () => void }) {
+export interface ErrorProps {
+ error: Error;
+}
+
+export default function Error({ error }: ErrorProps) {
useEffect(() => {
console.error(error);
}, [error]);
diff --git a/apps/aot/src/app/events/(leaderboard)/2023/leaderboard/[day]/layout.tsx b/apps/aot/src/app/events/(leaderboard)/2023/leaderboard/[day]/layout.tsx
index 9a8386cf..664439bb 100644
--- a/apps/aot/src/app/events/(leaderboard)/2023/leaderboard/[day]/layout.tsx
+++ b/apps/aot/src/app/events/(leaderboard)/2023/leaderboard/[day]/layout.tsx
@@ -5,7 +5,7 @@ import { DAY } from '../../date_constants';
export const dynamic = 'force-static';
export const dynamicParams = false;
-export async function generateStaticParams() {
+export function generateStaticParams() {
return Array.from({ length: DAY }).map((_, index) => ({ day: (index + 1).toString() }));
}
diff --git a/apps/aot/src/app/events/(leaderboard)/2023/leaderboard/[day]/page.tsx b/apps/aot/src/app/events/(leaderboard)/2023/leaderboard/[day]/page.tsx
index 2f433c3d..c890483f 100644
--- a/apps/aot/src/app/events/(leaderboard)/2023/leaderboard/[day]/page.tsx
+++ b/apps/aot/src/app/events/(leaderboard)/2023/leaderboard/[day]/page.tsx
@@ -2,7 +2,7 @@ import { getFirst100SubmissionsRanked } from '../../../_components/daily-leaderb
import { LeaderboardPage } from '../../../_components/leaderboard-page';
import { DAY, YEAR } from '../../date_constants';
-export async function generateStaticParams() {
+export function generateStaticParams() {
return Array.from({ length: DAY }).map((_, index) => ({ day: (index + 1).toString() }));
}
diff --git a/apps/aot/src/app/events/(leaderboard)/2023/leaderboard/page.tsx b/apps/aot/src/app/events/(leaderboard)/2023/leaderboard/page.tsx
index 662bd3cd..57c406c3 100644
--- a/apps/aot/src/app/events/(leaderboard)/2023/leaderboard/page.tsx
+++ b/apps/aot/src/app/events/(leaderboard)/2023/leaderboard/page.tsx
@@ -5,11 +5,8 @@ import { LeaderboardPage } from '../../_components/leaderboard-page';
import { getOverallLeaderboard, getOverallTableData } from '../../_components/overall-leaderboard';
import { YEAR } from '../date_constants';
-export async function generateMetadata() {
- return buildMetaForEventPage({
- title: 'Advent of Typescript',
- description: 'Advent of Typescript',
- });
+export function generateMetadata() {
+ return buildMetaForEventPage();
}
export default async function Page() {
const { enableAotPlatform } = await getAllFlags();
diff --git a/apps/aot/src/app/events/(leaderboard)/2024/leaderboard/page.tsx b/apps/aot/src/app/events/(leaderboard)/2024/leaderboard/page.tsx
index 662bd3cd..57c406c3 100644
--- a/apps/aot/src/app/events/(leaderboard)/2024/leaderboard/page.tsx
+++ b/apps/aot/src/app/events/(leaderboard)/2024/leaderboard/page.tsx
@@ -5,11 +5,8 @@ import { LeaderboardPage } from '../../_components/leaderboard-page';
import { getOverallLeaderboard, getOverallTableData } from '../../_components/overall-leaderboard';
import { YEAR } from '../date_constants';
-export async function generateMetadata() {
- return buildMetaForEventPage({
- title: 'Advent of Typescript',
- description: 'Advent of Typescript',
- });
+export function generateMetadata() {
+ return buildMetaForEventPage();
}
export default async function Page() {
const { enableAotPlatform } = await getAllFlags();
diff --git a/apps/aot/src/app/events/[year]/[day]/_components/challenge-layout-wrapper.tsx b/apps/aot/src/app/events/[year]/[day]/_components/challenge-layout-wrapper.tsx
index 46989243..ff01da27 100644
--- a/apps/aot/src/app/events/[year]/[day]/_components/challenge-layout-wrapper.tsx
+++ b/apps/aot/src/app/events/[year]/[day]/_components/challenge-layout-wrapper.tsx
@@ -6,12 +6,12 @@ import { ChallengeLayout, MOBILE_BREAKPOINT } from './challenge-layout';
import type { Challenge } from './types';
import usePanelAdjustments from './usePanelAdjustments';
-interface Props {
+interface ChallengeLayoutWrapperProps {
challenge: Challenge;
children: ReactNode;
}
-export function ChallengeLayoutWrapper({ challenge, children }: Props) {
+export function ChallengeLayoutWrapper({ challenge, children }: ChallengeLayoutWrapperProps) {
const [isDesktop, setIsDesktop] = useState(window.innerWidth > MOBILE_BREAKPOINT);
const LEFT_PANEL_BREAKPOINT = isDesktop ? 500 : 318;
const DEFAULT_DESKTOP_WIDTH_PX = `${LEFT_PANEL_BREAKPOINT}px`;
diff --git a/apps/aot/src/app/events/[year]/[day]/_components/challenge-layout.tsx b/apps/aot/src/app/events/[year]/[day]/_components/challenge-layout.tsx
index 1930877b..5222e52e 100644
--- a/apps/aot/src/app/events/[year]/[day]/_components/challenge-layout.tsx
+++ b/apps/aot/src/app/events/[year]/[day]/_components/challenge-layout.tsx
@@ -10,12 +10,12 @@ export const DEFAULT_SETTINGS = {
};
type Settings = typeof DEFAULT_SETTINGS;
-interface State {
+interface ChallengeLayoutState {
settings: Settings;
updateSettings: (settings: Settings) => void;
}
-export const useLayoutSettingsStore = create<State>()(
+export const useLayoutSettingsStore = create<ChallengeLayoutState>()(
persist(
(set, get) => ({
settings: DEFAULT_SETTINGS,
@@ -61,7 +61,7 @@ export function ChallengeLayout({
const rightSide = useRef<HTMLDivElement>(null);
const { settings, updateSettings } = useLayoutSettingsStore();
- const { fssettings, updateFSSettings } = useFullscreenSettingsStore();
+ const { fssettings } = useFullscreenSettingsStore();
const [isCollapsed, setIsCollapsed] = useState(false);
const LEFT_PANEL_BREAKPOINT = isDesktop ? 500 : 318;
diff --git a/apps/aot/src/app/events/[year]/[day]/_components/comments/comment-input.tsx b/apps/aot/src/app/events/[year]/[day]/_components/comments/comment-input.tsx
index df102696..18e20eff 100644
--- a/apps/aot/src/app/events/[year]/[day]/_components/comments/comment-input.tsx
+++ b/apps/aot/src/app/events/[year]/[day]/_components/comments/comment-input.tsx
@@ -16,7 +16,7 @@ import { useForm } from 'react-hook-form';
import { MentionInput } from '~/components/mention/mention-input';
import { singleFieldSchema, type SingleFieldSchema } from '~/utils/zodSingleStringField';
-interface Props {
+interface CommentInputProps {
mode: 'create' | 'edit' | 'reply';
onCancel?: () => void;
placeholder?: string;
@@ -29,8 +29,8 @@ interface CommentInputRefProps {
setInputValue: (value: string) => void;
}
-export const CommentInput = forwardRef<CommentInputRefProps, Props>(
- ({ mode, onCancel, placeholder, onSubmit, defaultValue }: Props, ref) => {
+export const CommentInput = forwardRef<CommentInputRefProps, CommentInputProps>(
+ ({ mode, onCancel, placeholder, onSubmit, defaultValue }: CommentInputProps, ref) => {
const { data: session } = useSession();
const [commentMode, setCommentMode] = useState<'editor' | 'preview'>('editor');
diff --git a/apps/aot/src/app/events/[year]/[day]/_components/comments/comment.action.ts b/apps/aot/src/app/events/[year]/[day]/_components/comments/comment.action.ts
index 7ad6d21c..7181b702 100644
--- a/apps/aot/src/app/events/[year]/[day]/_components/comments/comment.action.ts
+++ b/apps/aot/src/app/events/[year]/[day]/_components/comments/comment.action.ts
@@ -187,7 +187,7 @@ export async function replyComment(
export async function updateComment(text: string, id: number) {
const session = await auth();
- if (!session || !session.user) return 'unauthorized';
+ if (!session?.user) return 'unauthorized';
if (text.length === 0) return 'text_is_empty';
const comment = await prisma.comment.findFirstOrThrow({
diff --git a/apps/aot/src/app/events/[year]/[day]/_components/comments/comment.tsx b/apps/aot/src/app/events/[year]/[day]/_components/comments/comment.tsx
index 00efd1d7..0380b5a0 100644
--- a/apps/aot/src/app/events/[year]/[day]/_components/comments/comment.tsx
+++ b/apps/aot/src/app/events/[year]/[day]/_components/comments/comment.tsx
@@ -21,7 +21,6 @@ import {
import clsx from 'clsx';
import { useParams, useSearchParams } from 'next/navigation';
import { useEffect, useRef, useState } from 'react';
-import { z } from 'zod';
import { ReportDialog } from '~/components/report-dialog';
import { isAdminOrModerator } from '~/utils/auth-guards';
import { getRelativeTimeStrict } from '~/utils/relativeTime';
@@ -55,26 +54,13 @@ type CommentProps = SingleCommentProps & {
updateComment: (text: string, commentId: number) => Promise<void>;
};
-const commentReportSchema = z
- .object({
- spam: z.boolean().optional(),
- threat: z.boolean().optional(),
- hate_speech: z.boolean().optional(),
- bullying: z.boolean().optional(),
- text: z.string().optional(),
- })
- .refine(
- (obj) => {
- const { spam, threat, hate_speech, bullying, text } = obj;
- return spam || threat || hate_speech || bullying || (text !== undefined && text !== '');
- },
- {
- path: ['text'],
- message: 'Your report should include an issue or a reason.',
- },
- );
-
-export type CommentReportSchemaType = z.infer<typeof commentReportSchema>;
+export interface CommentReportSchemaType {
+ spam: boolean;
+ threat: boolean;
+ hate_speech: boolean;
+ bullying: boolean;
+ text: string;
+}
// million-ignore
export function Comment({
diff --git a/apps/aot/src/app/events/[year]/[day]/_components/comments/comments.hooks.tsx b/apps/aot/src/app/events/[year]/[day]/_components/comments/comments.hooks.tsx
index f62dee45..0b3cf765 100644
--- a/apps/aot/src/app/events/[year]/[day]/_components/comments/comments.hooks.tsx
+++ b/apps/aot/src/app/events/[year]/[day]/_components/comments/comments.hooks.tsx
@@ -110,7 +110,7 @@ export function useComments(props: UseCommentsProps) {
queryClient.invalidateQueries({
queryKey: getQueryKey({ sort: commentsMeta.sort.value, page: newPage }),
});
- } catch (e) {
+ } catch {
toast({
...commentErrors.unexpected,
variant: 'destructive',
@@ -138,7 +138,7 @@ export function useComments(props: UseCommentsProps) {
queryClient.invalidateQueries({
queryKey: getQueryKey({ sort: commentsMeta.sort.value, page: newPage }),
});
- } catch (e) {
+ } catch {
toast({
...commentErrors.unauthorized,
variant: 'destructive',
@@ -157,7 +157,7 @@ export function useComments(props: UseCommentsProps) {
queryClient.invalidateQueries({
queryKey: getQueryKey({ sort: commentsMeta.sort.value, page: commentsMeta.page }),
});
- } catch (e) {
+ } catch {
toast({
...commentErrors.unauthorized,
variant: 'destructive',
@@ -270,7 +270,7 @@ export function useCommentsReplies({
}
//Invalidate the root query to refetch the comments
queryClient.invalidateQueries({ queryKey: rootQueryKey });
- } catch (e) {
+ } catch {
toast({
...commentErrors.unauthorized,
variant: 'destructive',
@@ -287,7 +287,7 @@ export function useCommentsReplies({
toast(commentErrors.unauthorized);
}
queryClient.invalidateQueries({ queryKey });
- } catch (e) {
+ } catch {
toast({
...commentErrors.unauthorized,
variant: 'destructive',
@@ -309,7 +309,7 @@ export function useCommentsReplies({
}
//Invalidate the root query to refetch the comments
queryClient.invalidateQueries({ queryKey: rootQueryKey });
- } catch (e) {
+ } catch {
toast({
...commentErrors.unexpected,
variant: 'destructive',
diff --git a/apps/aot/src/app/events/[year]/[day]/_components/comments/getCommentRouteData.ts b/apps/aot/src/app/events/[year]/[day]/_components/comments/getCommentRouteData.ts
index 12a572b0..48618299 100644
--- a/apps/aot/src/app/events/[year]/[day]/_components/comments/getCommentRouteData.ts
+++ b/apps/aot/src/app/events/[year]/[day]/_components/comments/getCommentRouteData.ts
@@ -62,7 +62,7 @@ export async function getPreselectedSolutionCommentMetadata(
},
});
- if (!solution || !solution.solutionComment) return;
+ if (!solution?.solutionComment) return;
const comments = solution.solutionComment;
const index = comments.findIndex((comment) => comment.id === commentId);
diff --git a/apps/aot/src/app/events/[year]/[day]/_components/comments/index.tsx b/apps/aot/src/app/events/[year]/[day]/_components/comments/index.tsx
index 47b9022c..e32b4017 100644
--- a/apps/aot/src/app/events/[year]/[day]/_components/comments/index.tsx
+++ b/apps/aot/src/app/events/[year]/[day]/_components/comments/index.tsx
@@ -16,7 +16,7 @@ import { useComments } from './comments.hooks';
import { type PreselectedCommentMetadata } from './getCommentRouteData';
import NoComments from './nocomments';
-interface Props {
+interface CommentsProps {
preselectedCommentMetadata?: PreselectedCommentMetadata;
expanded?: boolean;
root: Challenge | SolutionRouteData;
@@ -24,7 +24,12 @@ interface Props {
}
// million-ignore
-export function Comments({ preselectedCommentMetadata, root, type, expanded = false }: Props) {
+export function Comments({
+ preselectedCommentMetadata,
+ root,
+ type,
+ expanded = false,
+}: CommentsProps) {
const [showComments, setShowComments] = useState(expanded);
const commentContainerRef = useRef<HTMLDivElement>(null);
const {
diff --git a/apps/aot/src/app/events/[year]/[day]/_components/description/index.tsx b/apps/aot/src/app/events/[year]/[day]/_components/description/index.tsx
index 9400987d..f859e98d 100644
--- a/apps/aot/src/app/events/[year]/[day]/_components/description/index.tsx
+++ b/apps/aot/src/app/events/[year]/[day]/_components/description/index.tsx
@@ -22,7 +22,7 @@ import { addOrRemoveBookmark } from '../bookmark.action';
import type { Challenge } from '../types';
import { Vote } from '../vote';
-interface Props {
+interface DescriptionProps {
challenge: Challenge;
}
@@ -33,7 +33,7 @@ export interface FormValues {
other: boolean;
}
-export function Description({ challenge }: Props) {
+export function Description({ challenge }: DescriptionProps) {
const [hasBookmarked, setHasBookmarked] = useState(challenge.bookmark.length > 0);
const session = useSession();
diff --git a/apps/aot/src/app/events/[year]/[day]/_components/editor-shortcuts/editor-shortcuts-form.tsx b/apps/aot/src/app/events/[year]/[day]/_components/editor-shortcuts/editor-shortcuts-form.tsx
index 32d6ae2c..e4946bfa 100644
--- a/apps/aot/src/app/events/[year]/[day]/_components/editor-shortcuts/editor-shortcuts-form.tsx
+++ b/apps/aot/src/app/events/[year]/[day]/_components/editor-shortcuts/editor-shortcuts-form.tsx
@@ -2,12 +2,12 @@
import type { PropsWithChildren } from 'react';
-interface Props {
+interface EditorShortcutProps {
title: string;
description: React.ReactNode;
}
-function EditorShortcut(props: Props) {
+function EditorShortcut(props: EditorShortcutProps) {
return (
<div className="grid grid-cols-2 gap-2">
<h1>{props.title}</h1>
diff --git a/apps/aot/src/app/events/[year]/[day]/_components/sort-select.tsx b/apps/aot/src/app/events/[year]/[day]/_components/sort-select.tsx
index 3013f5e3..616844f9 100644
--- a/apps/aot/src/app/events/[year]/[day]/_components/sort-select.tsx
+++ b/apps/aot/src/app/events/[year]/[day]/_components/sort-select.tsx
@@ -13,13 +13,13 @@ interface SortKey {
order: string;
}
-interface Props {
+interface SortSelectProps {
currentSortKey: SortKey;
totalSortKeys: readonly SortKey[];
onValueChange: (value: string) => void;
}
-export function SortSelect({ currentSortKey, totalSortKeys, onValueChange }: Props) {
+export function SortSelect({ currentSortKey, totalSortKeys, onValueChange }: SortSelectProps) {
return (
<div className="flex items-center gap-2 px-3 py-2">
<Select value={currentSortKey.value} defaultValue="newest" onValueChange={onValueChange}>
diff --git a/apps/aot/src/app/events/[year]/[day]/comments/[commentId]/page.tsx b/apps/aot/src/app/events/[year]/[day]/comments/[commentId]/page.tsx
index 0838c01e..130e76aa 100644
--- a/apps/aot/src/app/events/[year]/[day]/comments/[commentId]/page.tsx
+++ b/apps/aot/src/app/events/[year]/[day]/comments/[commentId]/page.tsx
@@ -7,7 +7,7 @@ import { getAotSlug } from '~/utils/getAotSlug';
import { isAfterJanuaryFirst } from '~/utils/time-utils';
import { notFound } from 'next/navigation';
-interface Props {
+interface CommentPageProps {
params: {
year: string;
day: string;
@@ -15,7 +15,7 @@ interface Props {
};
}
-export default async function CommentPage({ params: { year, day, commentId } }: Props) {
+export default async function CommentPage({ params: { year, day, commentId } }: CommentPageProps) {
const session = await auth();
const { challenge } = await getChallengeRouteData(getAotSlug({ year, day }), session);
const preselectedCommentMetadata = await getPreselectedCommentMetadata(
diff --git a/apps/aot/src/app/events/[year]/[day]/layout.tsx b/apps/aot/src/app/events/[year]/[day]/layout.tsx
index b2b4fd94..5ad2a9d0 100644
--- a/apps/aot/src/app/events/[year]/[day]/layout.tsx
+++ b/apps/aot/src/app/events/[year]/[day]/layout.tsx
@@ -8,17 +8,8 @@ import { isChallengeUnlocked } from '~/utils/time-utils';
import { notFound } from 'next/navigation';
import { getAllFlags } from '~/utils/feature-flag';
-interface Props {
- params: {
- year: string;
- day: string;
- };
-}
-export async function generateMetadata({ params: { year } }: Props) {
- return buildMetaForEventPage({
- title: `Advent of Typescript ${year}`,
- description: `Advent of Typescript ${year}`,
- });
+export function generateMetadata() {
+ return buildMetaForEventPage();
}
export default async function LayoutData({
diff --git a/apps/aot/src/app/events/[year]/[day]/left-wrapper.tsx b/apps/aot/src/app/events/[year]/[day]/left-wrapper.tsx
index 124a5d0f..54c3c4d1 100644
--- a/apps/aot/src/app/events/[year]/[day]/left-wrapper.tsx
+++ b/apps/aot/src/app/events/[year]/[day]/left-wrapper.tsx
@@ -9,13 +9,13 @@ import { FlaskConical, History, Text } from '@repo/ui/icons';
import { isAfterJanuaryFirst } from '~/utils/time-utils';
type Tab = 'description' | 'solutions' | 'submissions';
-interface Props {
+interface LeftWrapperProps {
children: ReactNode;
expandPanel: () => void;
isDesktop: boolean;
}
-export function LeftWrapper({ children, expandPanel, isDesktop }: Props) {
+export function LeftWrapper({ children, expandPanel, isDesktop }: LeftWrapperProps) {
const pathname = usePathname();
const router = useRouter();
const { year, day } = useParams();
diff --git a/apps/aot/src/app/events/[year]/[day]/page.tsx b/apps/aot/src/app/events/[year]/[day]/page.tsx
index 9eb4a5f5..56065458 100644
--- a/apps/aot/src/app/events/[year]/[day]/page.tsx
+++ b/apps/aot/src/app/events/[year]/[day]/page.tsx
@@ -5,14 +5,14 @@ import { isAfterJanuaryFirst } from '~/utils/time-utils';
import { Comments } from './_components/comments';
import { Description } from './_components/description';
-interface Props {
+interface ChallengesProps {
params: {
year: string;
day: string;
};
}
-export default async function Challenges({ params: { year, day } }: Props) {
+export default async function Challenges({ params: { year, day } }: ChallengesProps) {
const challenge = await api.event.getEventChallengeBySlug({ slug: getAotSlug({ year, day }) });
return (
diff --git a/apps/aot/src/app/events/[year]/[day]/right-wrapper.tsx b/apps/aot/src/app/events/[year]/[day]/right-wrapper.tsx
index 9dc19ca7..5e2a5c35 100644
--- a/apps/aot/src/app/events/[year]/[day]/right-wrapper.tsx
+++ b/apps/aot/src/app/events/[year]/[day]/right-wrapper.tsx
@@ -8,11 +8,11 @@ import { saveSubmission } from './submissions/[[...catchAll]]/save-submission.ac
import { SettingsElements } from './SettingsElements';
import { useQueryClient } from '@tanstack/react-query';
-interface Props {
+interface RightWrapperProps {
challenge: Challenge;
}
-export function RightWrapper({ challenge }: Props) {
+export function RightWrapper({ challenge }: RightWrapperProps) {
const queryClient = useQueryClient();
const router = useRouter();
const { year, day } = useParams();
@@ -26,11 +26,7 @@ export function RightWrapper({ challenge }: Props) {
}
// Redirect to solution on successful submission and show suggestions
- async function handleSuccessfulSubmission(
- isSuccessful: boolean,
- submissionId: number,
- slug?: string,
- ) {
+ function handleSuccessfulSubmission(isSuccessful: boolean, submissionId: number, slug?: string) {
const query = slug ? `&slug=${slug}` : '';
if (isSuccessful) {
router.push(`/events/${year}/${day}/submissions/${submissionId}?success=true${query}`);
diff --git a/apps/aot/src/app/events/[year]/[day]/solutions/[solutionId]/comments/[commentId]/page.tsx b/apps/aot/src/app/events/[year]/[day]/solutions/[solutionId]/comments/[commentId]/page.tsx
index ffac16e8..e4c0f6e1 100644
--- a/apps/aot/src/app/events/[year]/[day]/solutions/[solutionId]/comments/[commentId]/page.tsx
+++ b/apps/aot/src/app/events/[year]/[day]/solutions/[solutionId]/comments/[commentId]/page.tsx
@@ -5,7 +5,7 @@ import { SolutionDetails } from '../../../_components/solution-detail';
import { Comments } from '../../../../_components/comments';
import { getAotSlug } from '~/utils/getAotSlug';
-interface Props {
+interface SolutionPageCommentsProps {
params: {
year: string;
day: string;
@@ -16,7 +16,7 @@ interface Props {
export default async function SolutionPageComments({
params: { solutionId, commentId, year, day },
-}: Props) {
+}: SolutionPageCommentsProps) {
const session = await auth();
const solution = await getSolutionIdRouteData(getAotSlug({ year, day }), solutionId, session);
const preselectedCommentMetadata = await getPreselectedSolutionCommentMetadata(
diff --git a/apps/aot/src/app/events/[year]/[day]/solutions/[solutionId]/page.tsx b/apps/aot/src/app/events/[year]/[day]/solutions/[solutionId]/page.tsx
index b7ad89a6..e9b223d1 100644
--- a/apps/aot/src/app/events/[year]/[day]/solutions/[solutionId]/page.tsx
+++ b/apps/aot/src/app/events/[year]/[day]/solutions/[solutionId]/page.tsx
@@ -5,7 +5,7 @@ import { getSolutionIdRouteData } from './getSolutionIdRouteData';
import { Comments } from '../../_components/comments';
import { getAotSlug } from '~/utils/getAotSlug';
-interface Props {
+interface SolutionPageProps {
params: {
year: string;
day: string;
@@ -14,7 +14,9 @@ interface Props {
}
export type ChallengeSolution = NonNullable<Awaited<ReturnType<typeof getSolutionIdRouteData>>>;
-export default async function SolutionPage({ params: { solutionId, year, day } }: Props) {
+export default async function SolutionPage({
+ params: { solutionId, year, day },
+}: SolutionPageProps) {
const session = await auth();
const solution = await getSolutionIdRouteData(getAotSlug({ year, day }), solutionId, session);
@@ -27,7 +29,7 @@ export default async function SolutionPage({ params: { solutionId, year, day } }
);
}
-export async function generateMetadata({ params: { solutionId } }: Props) {
+export async function generateMetadata({ params: { solutionId } }: SolutionPageProps) {
const solution = await prisma.sharedSolution.findFirstOrThrow({
where: {
id: Number(solutionId),
diff --git a/apps/aot/src/app/events/[year]/[day]/solutions/_components/delete/index.tsx b/apps/aot/src/app/events/[year]/[day]/solutions/_components/delete/index.tsx
index df660e61..530d9a16 100644
--- a/apps/aot/src/app/events/[year]/[day]/solutions/_components/delete/index.tsx
+++ b/apps/aot/src/app/events/[year]/[day]/solutions/_components/delete/index.tsx
@@ -41,7 +41,7 @@ export function SolutionDeleteDialog({
queryKey: ['challenge-solutions', slug],
});
router.back();
- } catch (e) {
+ } catch {
toast({
title: 'Uh Oh!',
variant: 'destructive',
diff --git a/apps/aot/src/app/events/[year]/[day]/solutions/_components/edit-solution.tsx b/apps/aot/src/app/events/[year]/[day]/solutions/_components/edit-solution.tsx
index a2782c7a..f1d04d38 100644
--- a/apps/aot/src/app/events/[year]/[day]/solutions/_components/edit-solution.tsx
+++ b/apps/aot/src/app/events/[year]/[day]/solutions/_components/edit-solution.tsx
@@ -25,12 +25,12 @@ const formSchema = z.object({
export type FormSchema = z.infer<typeof formSchema>;
-interface Props {
+interface EditSolutionProps {
solution: ChallengeSolution;
setIsEditing: (isEditing: boolean) => void;
}
-export function EditSolution({ solution, setIsEditing }: Props) {
+export function EditSolution({ solution, setIsEditing }: EditSolutionProps) {
const { slug } = useParams();
const session = useSession();
const form = useForm<FormSchema>({
@@ -56,7 +56,7 @@ export function EditSolution({ solution, setIsEditing }: Props) {
variant: 'success',
title: 'Your solution has been updated!',
});
- } catch (error) {
+ } catch {
toast({
variant: 'destructive',
title: 'Uh oh! Something went wrong. Please try again.',
diff --git a/apps/aot/src/app/events/[year]/[day]/solutions/_components/index.tsx b/apps/aot/src/app/events/[year]/[day]/solutions/_components/index.tsx
index ab990595..909513fb 100644
--- a/apps/aot/src/app/events/[year]/[day]/solutions/_components/index.tsx
+++ b/apps/aot/src/app/events/[year]/[day]/solutions/_components/index.tsx
@@ -20,7 +20,7 @@ import { SortSelect } from '../../_components/sort-select';
import { Pagination } from '../../_components/pagination';
import { UserBadge } from '../../_components/comments/enhanced-user-badge';
-interface Props {
+interface SolutionsProps {
slug: string;
}
@@ -47,7 +47,7 @@ export const SORT_KEYS = [
type View = 'details' | 'editor' | 'list';
-export function Solutions({ slug }: Props) {
+export function Solutions({ slug }: SolutionsProps) {
const [view, setView] = useState<View>('list');
const commentContainerRef = useRef<HTMLDivElement>(null);
const [storageKey, setStorageKey] = useLocalStorage('sortKey', 'newest');
diff --git a/apps/aot/src/app/events/[year]/[day]/solutions/_components/nosolutions.tsx b/apps/aot/src/app/events/[year]/[day]/solutions/_components/nosolutions.tsx
index f52657f0..6d01c05b 100644
--- a/apps/aot/src/app/events/[year]/[day]/solutions/_components/nosolutions.tsx
+++ b/apps/aot/src/app/events/[year]/[day]/solutions/_components/nosolutions.tsx
@@ -1,12 +1,12 @@
import { SubmitSolution } from './submit-solution';
-interface Props {
+interface NoSolutionsProps {
loggedInUser: boolean;
loggedInUserHasSolution: boolean;
setView: (view: 'editor' | 'list') => void;
}
-export function NoSolutions({ setView, loggedInUser, loggedInUserHasSolution }: Props) {
+export function NoSolutions({ setView, loggedInUser, loggedInUserHasSolution }: NoSolutionsProps) {
return (
<div className="flex h-full items-center justify-center">
<p className="flex flex-col items-center gap-2 text-center text-neutral-500 dark:text-zinc-400">
diff --git a/apps/aot/src/app/events/[year]/[day]/solutions/_components/solution-detail.tsx b/apps/aot/src/app/events/[year]/[day]/solutions/_components/solution-detail.tsx
index dc09d26d..426ac0ef 100644
--- a/apps/aot/src/app/events/[year]/[day]/solutions/_components/solution-detail.tsx
+++ b/apps/aot/src/app/events/[year]/[day]/solutions/_components/solution-detail.tsx
@@ -26,11 +26,11 @@ import { SolutionDeleteDialog } from './delete';
import { EditSolution } from './edit-solution';
import { useGetQueryString } from './useGetQueryString';
-interface Props {
+interface SolutionDetailsProps {
solution: ChallengeSolution;
}
-export function SolutionDetails({ solution }: Props) {
+export function SolutionDetails({ solution }: SolutionDetailsProps) {
const { year, day } = useParams<Record<string, string>>();
const slug = getAotSlug({ year: year!, day: day! });
const { data: session } = useSession();
diff --git a/apps/aot/src/app/events/[year]/[day]/solutions/_components/solution-editor.tsx b/apps/aot/src/app/events/[year]/[day]/solutions/_components/solution-editor.tsx
index a45e2bfb..b11d4c23 100644
--- a/apps/aot/src/app/events/[year]/[day]/solutions/_components/solution-editor.tsx
+++ b/apps/aot/src/app/events/[year]/[day]/solutions/_components/solution-editor.tsx
@@ -40,13 +40,13 @@ const formSchema = z.object({
export type FormSchema = z.infer<typeof formSchema>;
-interface Props {
+interface SolutionEditorProps {
challengeId: number;
code?: string;
dismiss: () => void;
}
-export function SolutionEditor({ dismiss, challengeId, code }: Props) {
+export function SolutionEditor({ dismiss, challengeId, code }: SolutionEditorProps) {
const { year, day } = useParams();
const slug = getAotSlug({ year: year as string, day: day as string });
const queryClient = useQueryClient();
@@ -82,7 +82,7 @@ export function SolutionEditor({ dismiss, challengeId, code }: Props) {
queryClient.refetchQueries({
queryKey: ['challenge-solutions', slug],
});
- } catch (error) {
+ } catch {
toast({
variant: 'destructive',
title: 'Uh oh! Something went wrong. Please try again.',
diff --git a/apps/aot/src/app/events/[year]/[day]/solutions/_components/submit-solution.tsx b/apps/aot/src/app/events/[year]/[day]/solutions/_components/submit-solution.tsx
index d05ff5f8..97c772f3 100644
--- a/apps/aot/src/app/events/[year]/[day]/solutions/_components/submit-solution.tsx
+++ b/apps/aot/src/app/events/[year]/[day]/solutions/_components/submit-solution.tsx
@@ -1,12 +1,12 @@
import { Button } from '@repo/ui/components/button';
import { Plus } from '@repo/ui/icons';
-interface Props {
+interface SubmitSolutionProps {
disabled: boolean;
setView: (view: 'editor' | 'list') => void;
}
-export function SubmitSolution({ disabled, setView }: Props) {
+export function SubmitSolution({ disabled, setView }: SubmitSolutionProps) {
return (
<Button
className="h-8 rounded-lg px-3 py-2"
diff --git a/apps/aot/src/app/events/[year]/[day]/solutions/page.tsx b/apps/aot/src/app/events/[year]/[day]/solutions/page.tsx
index c1beb887..2cc78624 100644
--- a/apps/aot/src/app/events/[year]/[day]/solutions/page.tsx
+++ b/apps/aot/src/app/events/[year]/[day]/solutions/page.tsx
@@ -4,21 +4,18 @@ import { getAotSlug } from '~/utils/getAotSlug';
import { buildMetaForEventPage } from '~/utils/metadata';
import { Solutions } from './_components';
-interface Props {
+interface SolutionPageProps {
params: {
year: string;
day: string;
};
}
-export async function generateMetadata() {
- return buildMetaForEventPage({
- title: 'Advent of Typescript',
- description: 'Advent of Typescript',
- });
+export function generateMetadata() {
+ return buildMetaForEventPage();
}
-export default async function SolutionPage({ params: { year, day } }: Props) {
+export default function SolutionPage({ params: { year, day } }: SolutionPageProps) {
const slug = getAotSlug({ year, day });
if (!isAfterJanuaryFirst(Number(year))) {
diff --git a/apps/aot/src/app/events/[year]/[day]/submissions/[[...catchAll]]/_components/index.tsx b/apps/aot/src/app/events/[year]/[day]/submissions/[[...catchAll]]/_components/index.tsx
index f9a631a3..af2e3b90 100644
--- a/apps/aot/src/app/events/[year]/[day]/submissions/[[...catchAll]]/_components/index.tsx
+++ b/apps/aot/src/app/events/[year]/[day]/submissions/[[...catchAll]]/_components/index.tsx
@@ -10,12 +10,12 @@ import { getRelativeTimeStrict } from '~/utils/relativeTime';
import type { ChallengeSubmissions } from '../page';
import { useParams } from 'next/navigation';
-interface Props {
+interface SubmissionsProps {
submissions: ChallengeSubmissions;
}
type Status = 'accepted' | 'all' | 'rejected';
-export function Submissions({ submissions }: Props) {
+export function Submissions({ submissions }: SubmissionsProps) {
const [selectedStatus, setSelectStatus] = useState<Status>('all');
const filteredSubmissions = useMemo(() => {
diff --git a/apps/aot/src/app/events/[year]/[day]/submissions/[[...catchAll]]/_components/overview.tsx b/apps/aot/src/app/events/[year]/[day]/submissions/[[...catchAll]]/_components/overview.tsx
index 27495936..6f82ae7d 100644
--- a/apps/aot/src/app/events/[year]/[day]/submissions/[[...catchAll]]/_components/overview.tsx
+++ b/apps/aot/src/app/events/[year]/[day]/submissions/[[...catchAll]]/_components/overview.tsx
@@ -7,7 +7,7 @@ import { useParams } from 'next/navigation';
import { getRelativeTimeStrict } from '~/utils/relativeTime';
import { getChallengeSubmissionById } from '../getChallengeSubmissions';
-interface Props {
+interface SubmissionOverviewProps {
submissionId: string;
}
const codifyForMarkdown = (code: string) => {
@@ -15,7 +15,7 @@ const codifyForMarkdown = (code: string) => {
${code}`;
};
-export function SubmissionOverview({ submissionId }: Props) {
+export function SubmissionOverview({ submissionId }: SubmissionOverviewProps) {
const { year, day } = useParams();
const { data: submission } = useQuery({
queryKey: [`submission`, submissionId],
diff --git a/apps/aot/src/app/events/[year]/[day]/submissions/[[...catchAll]]/page.tsx b/apps/aot/src/app/events/[year]/[day]/submissions/[[...catchAll]]/page.tsx
index d8921796..7ca535d5 100644
--- a/apps/aot/src/app/events/[year]/[day]/submissions/[[...catchAll]]/page.tsx
+++ b/apps/aot/src/app/events/[year]/[day]/submissions/[[...catchAll]]/page.tsx
@@ -7,7 +7,7 @@ import { createChallengeSubmissionCacheKey } from './cache-keys';
import { withUnstableCache } from '~/utils/withUnstableCache';
import { getAotSlug } from '~/utils/getAotSlug';
-interface Props {
+interface SubmissionPageProps {
params: {
year: string;
day: string;
@@ -19,7 +19,7 @@ export const metadata = {
description: 'View your submissions to this challenge on TypeHero.',
};
-export default async function SubmissionPage({ params: { year, day } }: Props) {
+export default async function SubmissionPage({ params: { year, day } }: SubmissionPageProps) {
const session = await auth();
const slug = getAotSlug({ year, day });
diff --git a/apps/aot/src/app/events/[year]/day.tsx b/apps/aot/src/app/events/[year]/day.tsx
index a298f27e..3233be67 100644
--- a/apps/aot/src/app/events/[year]/day.tsx
+++ b/apps/aot/src/app/events/[year]/day.tsx
@@ -42,8 +42,6 @@ interface DayProps {
}
export default function DaySolved({ day, active, hasSolved }: DayProps) {
- const currentDay = new Date().getDate() === day;
-
return (
<motion.div
key={day}
diff --git a/apps/aot/src/app/events/[year]/page.tsx b/apps/aot/src/app/events/[year]/page.tsx
index e0b24060..d032dbbf 100644
--- a/apps/aot/src/app/events/[year]/page.tsx
+++ b/apps/aot/src/app/events/[year]/page.tsx
@@ -11,20 +11,17 @@ import Partners from '~/components/landing/Partners';
import { Footsies } from '~/components/footsies';
type Challenge = RouterOutputs['event']['getEventChallengesByYear'][0];
-interface Props {
+interface EventByYearLandingPageProps {
params: {
year: string;
};
}
-export async function generateMetadata() {
- return buildMetaForEventPage({
- title: 'Advent of Typescript',
- description: 'Advent of Typescript',
- });
+export function generateMetadata() {
+ return buildMetaForEventPage();
}
-export default async function EventByYearLandingPage({ params }: Props) {
+export default async function EventByYearLandingPage({ params }: EventByYearLandingPageProps) {
const year = Number(params.year);
if (!isValidAdventYear(year)) return notFound();
diff --git a/apps/aot/src/app/layout.tsx b/apps/aot/src/app/layout.tsx
index 02bbf04a..64d38012 100644
--- a/apps/aot/src/app/layout.tsx
+++ b/apps/aot/src/app/layout.tsx
@@ -15,7 +15,7 @@ export const metadata: Metadata = {
title: 'Advent of TypeScript',
};
-export default async function RootLayout({
+export default function RootLayout({
children,
}: Readonly<{
children: React.ReactNode;
diff --git a/apps/aot/src/app/login/_components/LoginButton.tsx b/apps/aot/src/app/login/_components/LoginButton.tsx
index 9ebcd5ed..d37e98dd 100644
--- a/apps/aot/src/app/login/_components/LoginButton.tsx
+++ b/apps/aot/src/app/login/_components/LoginButton.tsx
@@ -14,7 +14,7 @@ export function LoginButton({ redirectTo }: { redirectTo: string }) {
try {
setState('pending');
await signIn('github', { callbackUrl: redirectTo });
- } catch (error) {
+ } catch {
setState('error');
}
};
diff --git a/apps/aot/src/app/login/page.tsx b/apps/aot/src/app/login/page.tsx
index 3bb3b725..c4a1a50d 100644
--- a/apps/aot/src/app/login/page.tsx
+++ b/apps/aot/src/app/login/page.tsx
@@ -2,13 +2,10 @@ import Link from 'next/link';
import { LoginButton } from './_components/LoginButton';
import { buildMetaForEventPage } from '~/utils/metadata';
-export async function generateMetadata() {
- return buildMetaForEventPage({
- title: 'Advent of Typescript',
- description: 'Advent of Typescript',
- });
+export function generateMetadata() {
+ return buildMetaForEventPage();
}
-export default async function Index({
+export default function Index({
searchParams,
}: {
searchParams: {
diff --git a/apps/aot/src/app/page.tsx b/apps/aot/src/app/page.tsx
index 22c4ec94..9f7c7ccf 100644
--- a/apps/aot/src/app/page.tsx
+++ b/apps/aot/src/app/page.tsx
@@ -5,11 +5,8 @@ import Snowfall from '../components/landing/Snowfall';
import { buildMetaForEventPage } from '~/utils/metadata';
import { Footsies } from '~/components/footsies';
-export async function generateMetadata() {
- return buildMetaForEventPage({
- title: 'Advent of Typescript',
- description: 'Advent of Typescript',
- });
+export function generateMetadata() {
+ return buildMetaForEventPage();
}
export default function Home() {
return (
diff --git a/apps/aot/src/app/providers.tsx b/apps/aot/src/app/providers.tsx
index dc4e712b..c5df2ac6 100644
--- a/apps/aot/src/app/providers.tsx
+++ b/apps/aot/src/app/providers.tsx
@@ -5,11 +5,11 @@ import { TooltipProvider } from '@repo/ui/components/tooltip';
import { ThemeProvider } from 'next-themes';
import { TRPCReactProvider } from '~/trpc/react';
-interface Props {
+interface ProvidersProps {
children: React.ReactNode;
}
-export function Providers({ children }: Props) {
+export function Providers({ children }: ProvidersProps) {
return (
<SessionProvider>
<TRPCReactProvider>
diff --git a/apps/aot/src/components/footsies.tsx b/apps/aot/src/components/footsies.tsx
index 82ee630b..56158a00 100644
--- a/apps/aot/src/components/footsies.tsx
+++ b/apps/aot/src/components/footsies.tsx
@@ -2,7 +2,7 @@ import Link from 'next/link';
import { Binary, Github, Twitter } from '@repo/ui/icons';
import { ThemeButton } from './navigation/theme-button';
-export async function Footsies() {
+export function Footsies() {
return (
<footer className="flex w-full flex-col items-center gap-2 bg-neutral-50 px-8 py-12 text-sm font-light sm:px-16 md:px-0 dark:bg-neutral-900">
<div className="container flex flex-col-reverse justify-between gap-8 md:flex-row md:items-end md:gap-2">
diff --git a/apps/aot/src/components/mention/user-results.tsx b/apps/aot/src/components/mention/user-results.tsx
index 36608ec9..d63fd764 100644
--- a/apps/aot/src/components/mention/user-results.tsx
+++ b/apps/aot/src/components/mention/user-results.tsx
@@ -9,14 +9,14 @@ import { useEffect, useRef, useState } from 'react';
import { Loader } from '../loader';
import { searchUsers } from './actions';
-interface Props {
+interface UserResultsProps {
isOpen: boolean;
query: string;
onFocusOutside: () => void;
onSelectedUser: (user: string) => void;
}
-export function UserResults({ isOpen, onFocusOutside, onSelectedUser, query }: Props) {
+export function UserResults({ isOpen, onFocusOutside, onSelectedUser, query }: UserResultsProps) {
const { toast } = useToast();
const popoverRef = useRef<HTMLDivElement | null>(null);
const [selectedIndex, setSelectedIndex] = useState(0);
diff --git a/apps/aot/src/components/navigation/index.tsx b/apps/aot/src/components/navigation/index.tsx
index 4ad16cff..50971308 100644
--- a/apps/aot/src/components/navigation/index.tsx
+++ b/apps/aot/src/components/navigation/index.tsx
@@ -154,7 +154,7 @@ export async function Navigation() {
);
}
-async function LoginButton({ session }: { session: Session | null }) {
+function LoginButton({ session }: { session: Session | null }) {
return session?.user ? (
<DropdownMenu>
<DropdownMenuTrigger asChild>
diff --git a/apps/aot/src/components/navigation/mobile-nav.tsx b/apps/aot/src/components/navigation/mobile-nav.tsx
index 0e3a5558..c3f71393 100644
--- a/apps/aot/src/components/navigation/mobile-nav.tsx
+++ b/apps/aot/src/components/navigation/mobile-nav.tsx
@@ -3,11 +3,11 @@ import { cn } from '@repo/ui/cn';
import { usePathname } from 'next/navigation';
import React, { useEffect } from 'react';
-interface Props {
+interface MobileNavProps {
children: React.ReactNode;
}
-export function MobileNav({ children }: Props) {
+export function MobileNav({ children }: MobileNavProps) {
const pathname = usePathname();
const [open, setOpen] = React.useState(false);
const [mounted, setMounted] = React.useState(false);
diff --git a/apps/aot/src/components/report-dialog/index.tsx b/apps/aot/src/components/report-dialog/index.tsx
index 1bbffa3c..9d066e72 100644
--- a/apps/aot/src/components/report-dialog/index.tsx
+++ b/apps/aot/src/components/report-dialog/index.tsx
@@ -59,13 +59,7 @@ export function ReportDialog({
| ReportSolutionDialogProps
| ReportUserDialogProps
>) {
- const {
- handleSubmit,
- formState: { errors },
- register,
- control,
- setValue,
- } = useForm({
+ const { handleSubmit, register, control, setValue } = useForm({
defaultValues: {
derogatory: false,
unclear: false,
@@ -187,7 +181,7 @@ export function ReportDialog({
<FormField
control={control}
name="derogatory"
- render={({ field }) => (
+ render={() => (
<FormItem>
<div className="flex items-center gap-2">
<Checkbox
@@ -203,7 +197,7 @@ export function ReportDialog({
<FormField
control={control}
name="derogatory"
- render={({ field }) => (
+ render={() => (
<FormItem>
<div className="flex items-center gap-2">
<Checkbox
@@ -219,7 +213,7 @@ export function ReportDialog({
<FormField
control={control}
name="hateSpeech"
- render={({ field }) => (
+ render={() => (
<FormItem>
<div className="flex items-center gap-2">
<Checkbox
@@ -235,7 +229,7 @@ export function ReportDialog({
<FormField
control={control}
name="spam"
- render={({ field }) => (
+ render={() => (
<FormItem>
<div className="flex items-center gap-2">
<Checkbox
@@ -251,7 +245,7 @@ export function ReportDialog({
<FormField
control={control}
name="threat"
- render={({ field }) => (
+ render={() => (
<FormItem>
<div className="flex items-center gap-2">
<Checkbox
@@ -268,7 +262,7 @@ export function ReportDialog({
<FormField
control={control}
name="unclear"
- render={({ field }) => (
+ render={() => (
<FormItem>
<div className="flex items-center gap-2">
<Checkbox
@@ -286,7 +280,7 @@ export function ReportDialog({
<FormField
control={control}
name="comments"
- render={({ field }) => (
+ render={() => (
<FormItem className="my-3">
<div className="flex flex-col gap-3">
<div>Other information</div>
diff --git a/apps/aot/src/components/share-url.tsx b/apps/aot/src/components/share-url.tsx
index 09215505..61528281 100644
--- a/apps/aot/src/components/share-url.tsx
+++ b/apps/aot/src/components/share-url.tsx
@@ -17,7 +17,7 @@ export function ShareUrl({ code, description }: { code?: string; description?: s
const [localStorageCode] = useLocalStorage(`challenge-${year}-${day}`, '');
const url = `${window.location.origin}/events/${year}/${day}`;
- const genShortUrl = useCallback(async () => {
+ const genShortUrl = useCallback(() => {
let long = url;
const codeToCopy = code ?? localStorageCode;
if (copyWithCode && codeToCopy) {
@@ -29,7 +29,7 @@ export function ShareUrl({ code, description }: { code?: string; description?: s
const copyToClipboard = useCallback(async () => {
setState('loading');
- const short = await genShortUrl();
+ const short = genShortUrl();
try {
if (navigator.clipboard) {
await navigator.clipboard.writeText(short);
diff --git a/apps/aot/src/server/api/trpc.ts b/apps/aot/src/server/api/trpc.ts
index a0264fd5..d322434a 100644
--- a/apps/aot/src/server/api/trpc.ts
+++ b/apps/aot/src/server/api/trpc.ts
@@ -86,7 +86,7 @@ export const publicProcedure = t.procedure;
* @see https://trpc.io/docs/procedures
*/
export const protectedProcedure = t.procedure.use(({ ctx, next }) => {
- if (!ctx.session || !ctx.session.user) {
+ if (!ctx.session?.user) {
throw new TRPCError({ code: 'UNAUTHORIZED' });
}
return next({
diff --git a/apps/aot/src/utils/metadata.ts b/apps/aot/src/utils/metadata.ts
index 9309ed26..8ecc3d69 100644
--- a/apps/aot/src/utils/metadata.ts
+++ b/apps/aot/src/utils/metadata.ts
@@ -43,20 +43,14 @@ export const baseMetadata: Metadata = {
},
};
-export const buildMetaForEventPage = async ({
- title,
- description,
-}: {
- title?: string;
- description?: string;
-}): Promise<Metadata> => {
+export const buildMetaForEventPage = (): Metadata => {
return buildMeta({
ogImageUrl: `${OG_URL}/api/aot-2024`,
});
};
/** update the metadata for og */
-const buildMeta = async ({ ogImageUrl }: { ogImageUrl: string }): Promise<Metadata> => {
+const buildMeta = ({ ogImageUrl }: { ogImageUrl: string }): Metadata => {
baseMetadata.openGraph!.images = ogImageUrl;
baseMetadata.twitter!.images = ogImageUrl;
diff --git a/apps/aot/src/utils/sorting.ts b/apps/aot/src/utils/sorting.ts
index 05ea3d03..a845eb79 100644
--- a/apps/aot/src/utils/sorting.ts
+++ b/apps/aot/src/utils/sorting.ts
@@ -1,8 +1,5 @@
-const sortingKeys = ['createdAt', 'vote', 'replies', 'solutionComment'] as const;
-const sortingOrders = ['asc', 'desc'] as const;
-
-export type SortKey = (typeof sortingKeys)[number];
-export type SortOrder = (typeof sortingOrders)[number];
+export type SortKey = 'createdAt' | 'replies' | 'solutionComment' | 'vote';
+export type SortOrder = 'asc' | 'desc';
export function orderBy(sortKey: SortKey, sortOrder: SortOrder) {
switch (sortKey) {
diff --git a/apps/web/src/app/(email)/newsletter/_components/index.tsx b/apps/web/src/app/(email)/newsletter/_components/index.tsx
index b24507c3..96710b8e 100644
--- a/apps/web/src/app/(email)/newsletter/_components/index.tsx
+++ b/apps/web/src/app/(email)/newsletter/_components/index.tsx
@@ -2,7 +2,7 @@ import { Balancer } from 'react-wrap-balancer';
import styles from './newsletter.module.css';
import { NewsletterForm } from './newsletter-form';
-export function Newsletter({ params: { locale } }: { params: { locale: string } }) {
+export function Newsletter() {
return (
<main className="relative min-h-[calc(100vh-56px)] sm:px-16 md:px-0">
<div className={`${styles.newsletterBackground} fixed left-0 top-0 -z-10 h-full w-full`} />
diff --git a/apps/web/src/app/(email)/newsletter/_components/newsletter-form.tsx b/apps/web/src/app/(email)/newsletter/_components/newsletter-form.tsx
index 4958edf2..24ba8e9f 100644
--- a/apps/web/src/app/(email)/newsletter/_components/newsletter-form.tsx
+++ b/apps/web/src/app/(email)/newsletter/_components/newsletter-form.tsx
@@ -43,7 +43,7 @@ export function NewsletterForm() {
},
});
- async function onSubmit(data: NewsletterFormSchema) {
+ function onSubmit(data: NewsletterFormSchema) {
mutation.mutate(data);
}
diff --git a/apps/web/src/app/(email)/newsletter/page.tsx b/apps/web/src/app/(email)/newsletter/page.tsx
index d35f001d..5ae07ae9 100644
--- a/apps/web/src/app/(email)/newsletter/page.tsx
+++ b/apps/web/src/app/(email)/newsletter/page.tsx
@@ -1,7 +1,7 @@
import type { Metadata } from 'next';
import { buildMetaForDefault } from '~/app/metadata';
-export async function generateMetadata(): Promise<Metadata> {
+export function generateMetadata(): Metadata {
return buildMetaForDefault({
title: 'Newsletter | TypeHero',
description: 'Subscribe to the TypeHero newsletter and stay informed about our latest updates!',
diff --git a/apps/web/src/app/(legal)/privacy/page.tsx b/apps/web/src/app/(legal)/privacy/page.tsx
index c8a2092e..781409b8 100644
--- a/apps/web/src/app/(legal)/privacy/page.tsx
+++ b/apps/web/src/app/(legal)/privacy/page.tsx
@@ -2,7 +2,7 @@ import type { Metadata } from 'next';
import { buildMetaForDefault } from '~/app/metadata';
import { Footsies } from '~/components/footsies';
-export async function generateMetadata(): Promise<Metadata> {
+export function generateMetadata(): Metadata {
return buildMetaForDefault({
title: 'Privacy | TypeHero',
description: 'Read the TypeHero Privacy Policy.',
diff --git a/apps/web/src/app/(legal)/tos/page.tsx b/apps/web/src/app/(legal)/tos/page.tsx
index 5e76c1a7..64993449 100644
--- a/apps/web/src/app/(legal)/tos/page.tsx
+++ b/apps/web/src/app/(legal)/tos/page.tsx
@@ -2,7 +2,7 @@ import type { Metadata } from 'next';
import { buildMetaForDefault } from '~/app/metadata';
import { Footsies } from '~/components/footsies';
-export async function generateMetadata(): Promise<Metadata> {
+export function generateMetadata(): Metadata {
return buildMetaForDefault({
title: 'ToS | TypeHero',
description: 'Read the TypeHero Terms of Service.',
diff --git a/apps/web/src/app/(playgrounds)/challenge-playground/challenge-playground-store.ts b/apps/web/src/app/(playgrounds)/challenge-playground/challenge-playground-store.ts
index efa84730..8d846de9 100644
--- a/apps/web/src/app/(playgrounds)/challenge-playground/challenge-playground-store.ts
+++ b/apps/web/src/app/(playgrounds)/challenge-playground/challenge-playground-store.ts
@@ -13,12 +13,12 @@ export const DEFAULT_VALUES = {
type Values = typeof DEFAULT_VALUES;
-interface State {
+interface ChallengePlaygroundState {
values: Values;
updateValues: (values: Values) => void;
}
-export const useChallengePlaygroundStore = create<State>()(
+export const useChallengePlaygroundStore = create<ChallengePlaygroundState>()(
persist(
(set, get) => ({
values: DEFAULT_VALUES,
diff --git a/apps/web/src/app/(playgrounds)/challenge-playground/left-wrapper.tsx b/apps/web/src/app/(playgrounds)/challenge-playground/left-wrapper.tsx
index 8372c497..5f14ef1b 100644
--- a/apps/web/src/app/(playgrounds)/challenge-playground/left-wrapper.tsx
+++ b/apps/web/src/app/(playgrounds)/challenge-playground/left-wrapper.tsx
@@ -2,10 +2,10 @@
import { type ReactNode } from 'react';
-interface Props {
+interface LeftWrapperProps {
children: ReactNode;
}
-export function LeftWrapper({ children }: Props) {
+export function LeftWrapper({ children }: LeftWrapperProps) {
return <div className="flex h-full w-full flex-col">{children}</div>;
}
diff --git a/apps/web/src/app/(profile)/[username]/_components/activity-chart.tsx b/apps/web/src/app/(profile)/[username]/_components/activity-chart.tsx
index d8817916..67911602 100644
--- a/apps/web/src/app/(profile)/[username]/_components/activity-chart.tsx
+++ b/apps/web/src/app/(profile)/[username]/_components/activity-chart.tsx
@@ -45,7 +45,7 @@ export function ActivityChart(props: {
<ScatterChart data={props.data} accessibilityLayer>
<ChartTooltip
cursor={false}
- content={({ payload, content, ...props }) => {
+ content={({ payload, content: _, ...props }) => {
const innerPayload = (payload?.[0]?.payload as Record<string, number>) ?? {};
const customPayload = Object.entries(innerPayload ?? {})
.filter(([key]) => key === 'comments' || key === 'badges' || key === 'submissions')
diff --git a/apps/web/src/app/(profile)/[username]/edit/_components/edit-form.schema.ts b/apps/web/src/app/(profile)/[username]/edit/_components/edit-form.schema.ts
index 67092f27..b2dc1d0d 100644
--- a/apps/web/src/app/(profile)/[username]/edit/_components/edit-form.schema.ts
+++ b/apps/web/src/app/(profile)/[username]/edit/_components/edit-form.schema.ts
@@ -6,7 +6,7 @@ const validUrlWithHttpOrHttps = z.string().refine(
try {
const parsedUrl = new URL(url);
return ['https:', 'http:'].includes(parsedUrl.protocol);
- } catch (error) {
+ } catch {
return false;
}
},
diff --git a/apps/web/src/app/(profile)/[username]/edit/_components/edit-form.tsx b/apps/web/src/app/(profile)/[username]/edit/_components/edit-form.tsx
index a00e93cc..ac0879a6 100644
--- a/apps/web/src/app/(profile)/[username]/edit/_components/edit-form.tsx
+++ b/apps/web/src/app/(profile)/[username]/edit/_components/edit-form.tsx
@@ -53,7 +53,7 @@ export function EditForm(props: {
description: 'Your profile has been successfully updated !',
variant: 'success',
});
- } catch (error) {
+ } catch {
toast({
title: 'Could not update profile',
variant: 'destructive',
diff --git a/apps/web/src/app/_components/features.tsx b/apps/web/src/app/_components/features.tsx
index ed5af081..893e08c0 100644
--- a/apps/web/src/app/_components/features.tsx
+++ b/apps/web/src/app/_components/features.tsx
@@ -23,7 +23,7 @@ import {
CuratedTracksCard,
} from './feature-card';
-export async function Features() {
+export function Features() {
return (
<section className="relative overflow-hidden" id="features">
<div className="mx-auto mb-[64px] grid max-w-[1400px] items-center justify-center px-4 sm:px-24 md:px-4 lg:px-24">
diff --git a/apps/web/src/app/_components/newsletter-banner.tsx b/apps/web/src/app/_components/newsletter-banner.tsx
index c3557cc7..33703235 100644
--- a/apps/web/src/app/_components/newsletter-banner.tsx
+++ b/apps/web/src/app/_components/newsletter-banner.tsx
@@ -5,7 +5,7 @@ import { Balancer } from 'react-wrap-balancer';
import styles from './newsletter.module.css';
import { Button } from '@repo/ui/components/button';
-export async function NewsletterBanner() {
+export function NewsletterBanner() {
return (
<section className={clsx(styles.backdrop, 'relative overflow-hidden')}>
<div className="container relative grid grid-cols-1 items-center justify-center py-[64px] md:grid-cols-2">
diff --git a/apps/web/src/app/aot-2023/_components/index.tsx b/apps/web/src/app/aot-2023/_components/index.tsx
index 32cf382c..7d18af63 100644
--- a/apps/web/src/app/aot-2023/_components/index.tsx
+++ b/apps/web/src/app/aot-2023/_components/index.tsx
@@ -1,5 +1,5 @@
import { permanentRedirect } from 'next/navigation';
-export async function AotLandingPage() {
+export function AotLandingPage() {
return permanentRedirect('https://adventofts.com/');
}
diff --git a/apps/web/src/app/challenge/[slug]/comments/[commentId]/page.tsx b/apps/web/src/app/challenge/[slug]/comments/[commentId]/page.tsx
index 8ffaa734..837ed434 100644
--- a/apps/web/src/app/challenge/[slug]/comments/[commentId]/page.tsx
+++ b/apps/web/src/app/challenge/[slug]/comments/[commentId]/page.tsx
@@ -4,14 +4,14 @@ import { getPreselectedCommentMetadata } from '../../../_components/comments/get
import { Description } from '../../../_components/description';
import { getChallengeRouteData } from '../../getChallengeRouteData';
-interface Props {
+interface CommentPageProps {
params: {
slug: string;
commentId: string;
};
}
-export default async function CommentPage({ params: { slug, commentId } }: Props) {
+export default async function CommentPage({ params: { slug, commentId } }: CommentPageProps) {
const session = await auth();
const { challenge } = await getChallengeRouteData(slug, session);
const preselectedCommentMetadata = await getPreselectedCommentMetadata(
diff --git a/apps/web/src/app/challenge/[slug]/context-providers.tsx b/apps/web/src/app/challenge/[slug]/context-providers.tsx
index a3c0f74c..a0439d69 100644
--- a/apps/web/src/app/challenge/[slug]/context-providers.tsx
+++ b/apps/web/src/app/challenge/[slug]/context-providers.tsx
@@ -6,11 +6,11 @@ import { AllChallengesProvider } from './all-challenges.hook';
import { ProblemExplorerProvider } from '~/app/problem-explorer.hooks';
import { ChallegeRouteDataProvider } from './challenge-route-data.hook';
-interface Props {
+interface ContextProvidersProps {
children: React.ReactNode;
}
-export async function ContextProviders({ children }: Props) {
+export async function ContextProviders({ children }: ContextProvidersProps) {
const allChallenges = await getAllChallenges();
const session = await auth();
const isExplorerDisabled = await isEnrolledInAnyTrack(session);
diff --git a/apps/web/src/app/challenge/[slug]/left-wrapper.tsx b/apps/web/src/app/challenge/[slug]/left-wrapper.tsx
index 7af16782..4d60f6f9 100644
--- a/apps/web/src/app/challenge/[slug]/left-wrapper.tsx
+++ b/apps/web/src/app/challenge/[slug]/left-wrapper.tsx
@@ -15,7 +15,7 @@ import { useTrackNavigationVisiblity } from './use-track-visibility.hook';
import { ProblemExplorerTrackNav } from '~/components/Navigation/problem-explorer-track-nav';
type Tab = 'description' | 'solutions' | 'submissions';
-interface Props {
+interface LeftWrapperProps {
children: ReactNode;
challenge: ChallengeRouteData['challenge'];
track: ChallengeRouteData['track'];
@@ -23,7 +23,13 @@ interface Props {
isDesktop: boolean;
}
-export function LeftWrapper({ children, challenge, track, expandPanel, isDesktop }: Props) {
+export function LeftWrapper({
+ children,
+ challenge,
+ track,
+ expandPanel,
+ isDesktop,
+}: LeftWrapperProps) {
const pathname = usePathname();
const router = useRouter();
const [isCollapsed, setIsCollapsed] = useState(false);
diff --git a/apps/web/src/app/challenge/[slug]/page.tsx b/apps/web/src/app/challenge/[slug]/page.tsx
index d93ce13c..13c82b9b 100644
--- a/apps/web/src/app/challenge/[slug]/page.tsx
+++ b/apps/web/src/app/challenge/[slug]/page.tsx
@@ -6,13 +6,13 @@ import { Comments } from '../_components/comments';
import { Description } from '../_components/description';
import { getChallengeRouteData } from './getChallengeRouteData';
-interface Props {
+interface ChallengesProps {
params: {
slug: string;
};
}
-export async function generateMetadata({ params: { slug } }: Props) {
+export async function generateMetadata({ params: { slug } }: ChallengesProps) {
const { challenge } = await getChallengeRouteData(slug, null);
const description = `Unlock your TypeScript potential by solving the ${challenge.name} challenge on TypeHero.`;
@@ -25,7 +25,7 @@ export async function generateMetadata({ params: { slug } }: Props) {
});
}
-export default async function Challenges({ params: { slug } }: Props) {
+export default async function Challenges({ params: { slug } }: ChallengesProps) {
const session = await auth();
const { challenge } = await getChallengeRouteData(slug, session);
diff --git a/apps/web/src/app/challenge/[slug]/right-wrapper.tsx b/apps/web/src/app/challenge/[slug]/right-wrapper.tsx
index 87c70a9a..1040a46d 100644
--- a/apps/web/src/app/challenge/[slug]/right-wrapper.tsx
+++ b/apps/web/src/app/challenge/[slug]/right-wrapper.tsx
@@ -13,13 +13,13 @@ import { saveSubmission } from './submissions/[[...catchAll]]/save-submission.ac
import SwapPanelButton from '../_components/swap-panel-button';
import { useQueryClient } from '@tanstack/react-query';
-interface Props {
+interface RightWrapperProps {
challenge: ChallengeRouteData['challenge'];
track: ChallengeRouteData['track'];
toggleDirection: () => void;
}
-export function RightWrapper({ track, challenge, toggleDirection }: Props) {
+export function RightWrapper({ track, challenge, toggleDirection }: RightWrapperProps) {
const queryClient = useQueryClient();
const router = useRouter();
const segments = useSelectedLayoutSegments();
@@ -32,11 +32,7 @@ export function RightWrapper({ track, challenge, toggleDirection }: Props) {
}
// Redirect to solution on successful submission and show suggestions
- async function handleSuccessfulSubmission(
- isSuccessful: boolean,
- submissionId: number,
- slug?: string,
- ) {
+ function handleSuccessfulSubmission(isSuccessful: boolean, submissionId: number, slug?: string) {
const query = slug ? `&slug=${slug}` : '';
if (isSuccessful) {
router.push(`/challenge/${challenge.slug}/submissions/${submissionId}?success=true${query}`);
diff --git a/apps/web/src/app/challenge/[slug]/solutions/[solutionId]/comments/[commentId]/page.tsx b/apps/web/src/app/challenge/[slug]/solutions/[solutionId]/comments/[commentId]/page.tsx
index fb69d37a..a13a19fe 100644
--- a/apps/web/src/app/challenge/[slug]/solutions/[solutionId]/comments/[commentId]/page.tsx
+++ b/apps/web/src/app/challenge/[slug]/solutions/[solutionId]/comments/[commentId]/page.tsx
@@ -4,7 +4,7 @@ import { Comments } from '~/app/challenge/_components/comments';
import { getPreselectedSolutionCommentMetadata } from '~/app/challenge/_components/comments/getCommentRouteData';
import { getSolutionIdRouteData } from '../../getSolutionIdRouteData';
-interface Props {
+interface SolutionPageCommentsProps {
params: {
slug: string;
commentId: string;
@@ -14,7 +14,7 @@ interface Props {
export default async function SolutionPageComments({
params: { solutionId, commentId, slug },
-}: Props) {
+}: SolutionPageCommentsProps) {
const session = await auth();
const solution = await getSolutionIdRouteData(slug, solutionId, session);
const preselectedCommentMetadata = await getPreselectedSolutionCommentMetadata(
diff --git a/apps/web/src/app/challenge/[slug]/solutions/[solutionId]/page.tsx b/apps/web/src/app/challenge/[slug]/solutions/[solutionId]/page.tsx
index fbf2a264..732d3f7f 100644
--- a/apps/web/src/app/challenge/[slug]/solutions/[solutionId]/page.tsx
+++ b/apps/web/src/app/challenge/[slug]/solutions/[solutionId]/page.tsx
@@ -4,7 +4,7 @@ import { auth } from '~/server/auth';
import { Comments } from '~/app/challenge/_components/comments';
import { getSolutionIdRouteData } from './getSolutionIdRouteData';
-interface Props {
+interface ChallengeSolutionProps {
params: {
slug: string;
solutionId: string;
@@ -12,7 +12,9 @@ interface Props {
}
export type ChallengeSolution = NonNullable<Awaited<ReturnType<typeof getSolutionIdRouteData>>>;
-export default async function SolutionPage({ params: { solutionId, slug } }: Props) {
+export default async function SolutionPage({
+ params: { solutionId, slug },
+}: ChallengeSolutionProps) {
const session = await auth();
const solution = await getSolutionIdRouteData(slug, solutionId, session);
@@ -25,7 +27,7 @@ export default async function SolutionPage({ params: { solutionId, slug } }: Pro
);
}
-export async function generateMetadata({ params: { solutionId } }: Props) {
+export async function generateMetadata({ params: { solutionId } }: ChallengeSolutionProps) {
const solution = await prisma.sharedSolution.findFirstOrThrow({
where: {
id: Number(solutionId),
diff --git a/apps/web/src/app/challenge/[slug]/solutions/_components/delete/index.tsx b/apps/web/src/app/challenge/[slug]/solutions/_components/delete/index.tsx
index 08d40bfe..c6a0a1bd 100644
--- a/apps/web/src/app/challenge/[slug]/solutions/_components/delete/index.tsx
+++ b/apps/web/src/app/challenge/[slug]/solutions/_components/delete/index.tsx
@@ -41,7 +41,7 @@ export function SolutionDeleteDialog({
queryKey: ['challenge-solutions', slug],
});
router.back();
- } catch (e) {
+ } catch {
toast({
title: 'Uh Oh!',
variant: 'destructive',
diff --git a/apps/web/src/app/challenge/[slug]/solutions/_components/edit-solution.tsx b/apps/web/src/app/challenge/[slug]/solutions/_components/edit-solution.tsx
index 624169f7..ba03fcdf 100644
--- a/apps/web/src/app/challenge/[slug]/solutions/_components/edit-solution.tsx
+++ b/apps/web/src/app/challenge/[slug]/solutions/_components/edit-solution.tsx
@@ -25,12 +25,12 @@ const formSchema = z.object({
export type FormSchema = z.infer<typeof formSchema>;
-interface Props {
+interface EditSolutionProps {
solution: ChallengeSolution;
setIsEditing: (isEditing: boolean) => void;
}
-export function EditSolution({ solution, setIsEditing }: Props) {
+export function EditSolution({ solution, setIsEditing }: EditSolutionProps) {
const { slug } = useParams();
const session = useSession();
const form = useForm<FormSchema>({
@@ -56,7 +56,7 @@ export function EditSolution({ solution, setIsEditing }: Props) {
variant: 'success',
title: 'Your solution has been updated!',
});
- } catch (error) {
+ } catch {
toast({
variant: 'destructive',
title: 'Uh oh! Something went wrong. Please try again.',
diff --git a/apps/web/src/app/challenge/[slug]/solutions/_components/index.tsx b/apps/web/src/app/challenge/[slug]/solutions/_components/index.tsx
index d31bc55b..59467dab 100644
--- a/apps/web/src/app/challenge/[slug]/solutions/_components/index.tsx
+++ b/apps/web/src/app/challenge/[slug]/solutions/_components/index.tsx
@@ -20,7 +20,7 @@ import { useQueryParamState } from './useQueryParamState';
import { useLocalStorage } from '~/utils/useLocalStorage';
import { UserBadge } from '../../../_components/comments/enhanced-user-badge';
-interface Props {
+interface SolutionsProps {
slug: string;
}
@@ -47,7 +47,7 @@ export const SORT_KEYS = [
type View = 'details' | 'editor' | 'list';
-export function Solutions({ slug }: Props) {
+export function Solutions({ slug }: SolutionsProps) {
const [view, setView] = useState<View>('list');
const commentContainerRef = useRef<HTMLDivElement>(null);
const [storageKey, setStorageKey] = useLocalStorage('sortKey', 'newest');
diff --git a/apps/web/src/app/challenge/[slug]/solutions/_components/nosolutions.tsx b/apps/web/src/app/challenge/[slug]/solutions/_components/nosolutions.tsx
index f52657f0..6d01c05b 100644
--- a/apps/web/src/app/challenge/[slug]/solutions/_components/nosolutions.tsx
+++ b/apps/web/src/app/challenge/[slug]/solutions/_components/nosolutions.tsx
@@ -1,12 +1,12 @@
import { SubmitSolution } from './submit-solution';
-interface Props {
+interface NoSolutionsProps {
loggedInUser: boolean;
loggedInUserHasSolution: boolean;
setView: (view: 'editor' | 'list') => void;
}
-export function NoSolutions({ setView, loggedInUser, loggedInUserHasSolution }: Props) {
+export function NoSolutions({ setView, loggedInUser, loggedInUserHasSolution }: NoSolutionsProps) {
return (
<div className="flex h-full items-center justify-center">
<p className="flex flex-col items-center gap-2 text-center text-neutral-500 dark:text-zinc-400">
diff --git a/apps/web/src/app/challenge/[slug]/solutions/_components/solution-detail.tsx b/apps/web/src/app/challenge/[slug]/solutions/_components/solution-detail.tsx
index 5b93858a..6c3a8608 100644
--- a/apps/web/src/app/challenge/[slug]/solutions/_components/solution-detail.tsx
+++ b/apps/web/src/app/challenge/[slug]/solutions/_components/solution-detail.tsx
@@ -25,11 +25,11 @@ import { SolutionDeleteDialog } from './delete';
import { EditSolution } from './edit-solution';
import { useGetQueryString } from './useGetQueryString';
-interface Props {
+interface SolutionDetailsProps {
solution: ChallengeSolution;
}
-export function SolutionDetails({ solution }: Props) {
+export function SolutionDetails({ solution }: SolutionDetailsProps) {
const { slug } = useParams();
const { data: session } = useSession();
const showPin = isAdminOrModerator(session);
diff --git a/apps/web/src/app/challenge/[slug]/solutions/_components/solution-editor.tsx b/apps/web/src/app/challenge/[slug]/solutions/_components/solution-editor.tsx
index 3b6103e8..ca5c498a 100644
--- a/apps/web/src/app/challenge/[slug]/solutions/_components/solution-editor.tsx
+++ b/apps/web/src/app/challenge/[slug]/solutions/_components/solution-editor.tsx
@@ -39,13 +39,13 @@ const formSchema = z.object({
export type FormSchema = z.infer<typeof formSchema>;
-interface Props {
+interface SolutionEditorProps {
challengeId: number;
code?: string;
dismiss: () => void;
}
-export function SolutionEditor({ dismiss, challengeId, code }: Props) {
+export function SolutionEditor({ dismiss, challengeId, code }: SolutionEditorProps) {
const { slug } = useParams();
const queryClient = useQueryClient();
const session = useSession();
@@ -80,7 +80,7 @@ export function SolutionEditor({ dismiss, challengeId, code }: Props) {
queryClient.refetchQueries({
queryKey: ['challenge-solutions', slug],
});
- } catch (error) {
+ } catch {
toast({
variant: 'destructive',
title: 'Uh oh! Something went wrong. Please try again.',
diff --git a/apps/web/src/app/challenge/[slug]/solutions/_components/submit-solution.tsx b/apps/web/src/app/challenge/[slug]/solutions/_components/submit-solution.tsx
index d05ff5f8..97c772f3 100644
--- a/apps/web/src/app/challenge/[slug]/solutions/_components/submit-solution.tsx
+++ b/apps/web/src/app/challenge/[slug]/solutions/_components/submit-solution.tsx
@@ -1,12 +1,12 @@
import { Button } from '@repo/ui/components/button';
import { Plus } from '@repo/ui/icons';
-interface Props {
+interface SubmitSolutionProps {
disabled: boolean;
setView: (view: 'editor' | 'list') => void;
}
-export function SubmitSolution({ disabled, setView }: Props) {
+export function SubmitSolution({ disabled, setView }: SubmitSolutionProps) {
return (
<Button
className="h-8 rounded-lg px-3 py-2"
diff --git a/apps/web/src/app/challenge/[slug]/solutions/page.tsx b/apps/web/src/app/challenge/[slug]/solutions/page.tsx
index b003d585..f011b697 100644
--- a/apps/web/src/app/challenge/[slug]/solutions/page.tsx
+++ b/apps/web/src/app/challenge/[slug]/solutions/page.tsx
@@ -2,13 +2,13 @@ import { buildMetaForDefault } from '~/app/metadata';
import { getChallengeRouteData } from '../getChallengeRouteData';
import { Solutions } from './_components';
-interface Props {
+interface SolutionPageProps {
params: {
slug: string;
};
}
-export async function generateMetadata({ params: { slug } }: Props) {
+export async function generateMetadata({ params: { slug } }: SolutionPageProps) {
const { challenge } = await getChallengeRouteData(slug, null);
return buildMetaForDefault({
title: `Solutions to ${challenge.name} | TypeHero`,
@@ -16,6 +16,6 @@ export async function generateMetadata({ params: { slug } }: Props) {
});
}
-export default async function SolutionPage({ params: { slug } }: Props) {
+export default function SolutionPage({ params: { slug } }: SolutionPageProps) {
return <Solutions slug={slug} />;
}
diff --git a/apps/web/src/app/challenge/[slug]/submissions/[[...catchAll]]/_components/index.tsx b/apps/web/src/app/challenge/[slug]/submissions/[[...catchAll]]/_components/index.tsx
index fd56bbcb..b03142c6 100644
--- a/apps/web/src/app/challenge/[slug]/submissions/[[...catchAll]]/_components/index.tsx
+++ b/apps/web/src/app/challenge/[slug]/submissions/[[...catchAll]]/_components/index.tsx
@@ -10,12 +10,12 @@ import { getRelativeTimeStrict } from '~/utils/relativeTime';
import type { ChallengeSubmissions } from '../page';
import { useParams } from 'next/navigation';
-interface Props {
+interface SubmissionsProps {
submissions: ChallengeSubmissions;
}
type Status = 'accepted' | 'all' | 'rejected';
-export function Submissions({ submissions }: Props) {
+export function Submissions({ submissions }: SubmissionsProps) {
const [selectedStatus, setSelectStatus] = useState<Status>('all');
const filteredSubmissions = useMemo(() => {
diff --git a/apps/web/src/app/challenge/[slug]/submissions/[[...catchAll]]/_components/overview.tsx b/apps/web/src/app/challenge/[slug]/submissions/[[...catchAll]]/_components/overview.tsx
index 3a657172..e8f760ae 100644
--- a/apps/web/src/app/challenge/[slug]/submissions/[[...catchAll]]/_components/overview.tsx
+++ b/apps/web/src/app/challenge/[slug]/submissions/[[...catchAll]]/_components/overview.tsx
@@ -17,7 +17,7 @@ import {
import { Tooltip, TooltipContent, TooltipTrigger } from '@repo/ui/components/tooltip';
import { ShareUrl } from '~/components/share-url';
-interface Props {
+interface SubmissionOverviewProps {
submissionId: string;
}
const codifyForMarkdown = (code: string) => {
@@ -25,7 +25,7 @@ const codifyForMarkdown = (code: string) => {
${code}`;
};
-export function SubmissionOverview({ submissionId }: Props) {
+export function SubmissionOverview({ submissionId }: SubmissionOverviewProps) {
const { slug } = useParams();
const searchParams = useSearchParams();
diff --git a/apps/web/src/app/challenge/[slug]/submissions/[[...catchAll]]/page.tsx b/apps/web/src/app/challenge/[slug]/submissions/[[...catchAll]]/page.tsx
index 9d0b60f1..838b012b 100644
--- a/apps/web/src/app/challenge/[slug]/submissions/[[...catchAll]]/page.tsx
+++ b/apps/web/src/app/challenge/[slug]/submissions/[[...catchAll]]/page.tsx
@@ -6,7 +6,7 @@ import { withUnstableCache } from '~/utils/withUnstableCache';
import { Submissions } from './_components';
import { createChallengeSubmissionCacheKey } from './cache-keys';
-interface Props {
+interface SubmissionPageProps {
params: {
slug: string;
};
@@ -17,7 +17,7 @@ export const metadata = {
description: 'View your submissions to this challenge on TypeHero.',
};
-export default async function SubmissionPage({ params: { slug } }: Props) {
+export default async function SubmissionPage({ params: { slug } }: SubmissionPageProps) {
const session = await auth();
const submissions = await withUnstableCache({
diff --git a/apps/web/src/app/challenge/_components/challenge-layout-wrapper.tsx b/apps/web/src/app/challenge/_components/challenge-layout-wrapper.tsx
index f7199177..8152df8e 100644
--- a/apps/web/src/app/challenge/_components/challenge-layout-wrapper.tsx
+++ b/apps/web/src/app/challenge/_components/challenge-layout-wrapper.tsx
@@ -7,13 +7,17 @@ import { LeftWrapper } from '../[slug]/left-wrapper';
import { RightWrapper } from '../[slug]/right-wrapper';
import { useChallengeRouteData } from '../[slug]/challenge-route-data.hook';
-interface Props {
+interface ChallengeLayoutWrapperProps {
challenge: ChallengeRouteData['challenge'];
track: ChallengeRouteData['track'];
children: ReactNode;
}
-export function ChallengeLayoutWrapper({ challenge, track, children }: Props) {
+export function ChallengeLayoutWrapper({
+ challenge,
+ track,
+ children,
+}: ChallengeLayoutWrapperProps) {
const { setCurrentChallenge } = useChallengeRouteData();
useEffect(() => {
diff --git a/apps/web/src/app/challenge/_components/challenge-layout.tsx b/apps/web/src/app/challenge/_components/challenge-layout.tsx
index 3b91aa34..5c4c7576 100644
--- a/apps/web/src/app/challenge/_components/challenge-layout.tsx
+++ b/apps/web/src/app/challenge/_components/challenge-layout.tsx
@@ -10,12 +10,12 @@ export const DEFAULT_SETTINGS = {
};
type Settings = typeof DEFAULT_SETTINGS;
-interface State {
+interface ChallengeLayoutState {
settings: Settings;
updateSettings: (settings: Settings) => void;
}
-export const useLayoutSettingsStore = create<State>()(
+export const useLayoutSettingsStore = create<ChallengeLayoutState>()(
persist(
(set, get) => ({
settings: DEFAULT_SETTINGS,
@@ -63,7 +63,7 @@ export function ChallengeLayout({
const rightSide = useRef<HTMLDivElement>(null);
const { settings, updateSettings } = useLayoutSettingsStore();
- const { fssettings, updateFSSettings } = useFullscreenSettingsStore();
+ const { fssettings } = useFullscreenSettingsStore();
const [isCollapsed, setIsCollapsed] = useState(false);
const LEFT_PANEL_BREAKPOINT = isDesktop ? 500 : 318;
diff --git a/apps/web/src/app/challenge/_components/challenge-track-navigation.tsx b/apps/web/src/app/challenge/_components/challenge-track-navigation.tsx
index 09b14600..f69c0207 100644
--- a/apps/web/src/app/challenge/_components/challenge-track-navigation.tsx
+++ b/apps/web/src/app/challenge/_components/challenge-track-navigation.tsx
@@ -14,14 +14,19 @@ import { Swords, ChevronLeft, ChevronRight } from '@repo/ui/icons';
import { ChallengeTrackOutline } from './challenge-track-outline';
-interface Props {
+interface ChallengeTrackNavigationProps {
challenge: ChallengeRouteData['challenge'];
track: ChallengeRouteData['track'];
isCollapsed: boolean;
className?: string;
}
-export function ChallengeTrackNavigation({ challenge, track, isCollapsed, className }: Props) {
+export function ChallengeTrackNavigation({
+ challenge,
+ track,
+ isCollapsed,
+ className,
+}: ChallengeTrackNavigationProps) {
const router = useRouter();
const { data: trackDetails, isPending } = useQuery({
diff --git a/apps/web/src/app/challenge/_components/challenge-track-outline.tsx b/apps/web/src/app/challenge/_components/challenge-track-outline.tsx
index 830d4f9d..8b58e1a6 100644
--- a/apps/web/src/app/challenge/_components/challenge-track-outline.tsx
+++ b/apps/web/src/app/challenge/_components/challenge-track-outline.tsx
@@ -19,14 +19,19 @@ import {
import type { Challenge } from '@repo/db/types';
import { ChevronRight } from '@repo/ui/icons';
-interface Props {
+interface ChallengeTrackOutlineProps {
children: ReactNode;
challenge: Challenge;
track: NonNullable<Awaited<ReturnType<typeof getTrackDetails>>>;
asChild?: boolean;
}
-export function ChallengeTrackOutline({ children, challenge, track, asChild = false }: Props) {
+export function ChallengeTrackOutline({
+ children,
+ challenge,
+ track,
+ asChild = false,
+}: ChallengeTrackOutlineProps) {
const router = useRouter();
const trackChallenges = track?.trackChallenges ?? [];
diff --git a/apps/web/src/app/challenge/_components/comments/comment-input.tsx b/apps/web/src/app/challenge/_components/comments/comment-input.tsx
index df102696..18e20eff 100644
--- a/apps/web/src/app/challenge/_components/comments/comment-input.tsx
+++ b/apps/web/src/app/challenge/_components/comments/comment-input.tsx
@@ -16,7 +16,7 @@ import { useForm } from 'react-hook-form';
import { MentionInput } from '~/components/mention/mention-input';
import { singleFieldSchema, type SingleFieldSchema } from '~/utils/zodSingleStringField';
-interface Props {
+interface CommentInputProps {
mode: 'create' | 'edit' | 'reply';
onCancel?: () => void;
placeholder?: string;
@@ -29,8 +29,8 @@ interface CommentInputRefProps {
setInputValue: (value: string) => void;
}
-export const CommentInput = forwardRef<CommentInputRefProps, Props>(
- ({ mode, onCancel, placeholder, onSubmit, defaultValue }: Props, ref) => {
+export const CommentInput = forwardRef<CommentInputRefProps, CommentInputProps>(
+ ({ mode, onCancel, placeholder, onSubmit, defaultValue }: CommentInputProps, ref) => {
const { data: session } = useSession();
const [commentMode, setCommentMode] = useState<'editor' | 'preview'>('editor');
diff --git a/apps/web/src/app/challenge/_components/comments/comment.action.ts b/apps/web/src/app/challenge/_components/comments/comment.action.ts
index 635d9086..4ec69ab5 100644
--- a/apps/web/src/app/challenge/_components/comments/comment.action.ts
+++ b/apps/web/src/app/challenge/_components/comments/comment.action.ts
@@ -187,7 +187,7 @@ export async function replyComment(
export async function updateComment(text: string, id: number) {
const session = await auth();
- if (!session || !session.user) return 'unauthorized';
+ if (!session?.user) return 'unauthorized';
if (text.length === 0) return 'text_is_empty';
const comment = await prisma.comment.findFirstOrThrow({
diff --git a/apps/web/src/app/challenge/_components/comments/comment.tsx b/apps/web/src/app/challenge/_components/comments/comment.tsx
index 7c3adba7..f5355a81 100644
--- a/apps/web/src/app/challenge/_components/comments/comment.tsx
+++ b/apps/web/src/app/challenge/_components/comments/comment.tsx
@@ -22,7 +22,6 @@ import {
import clsx from 'clsx';
import { useParams, useSearchParams } from 'next/navigation';
import { useEffect, useRef, useState } from 'react';
-import { z } from 'zod';
import { ReportDialog } from '~/components/ReportDialog';
import { isAdminOrModerator } from '~/utils/auth-guards';
import { getRelativeTimeStrict } from '~/utils/relativeTime';
@@ -62,26 +61,13 @@ type CommentProps = SingleCommentProps & {
updateComment: (text: string, commentId: number) => Promise<void>;
};
-const commentReportSchema = z
- .object({
- spam: z.boolean().optional(),
- threat: z.boolean().optional(),
- hate_speech: z.boolean().optional(),
- bullying: z.boolean().optional(),
- text: z.string().optional(),
- })
- .refine(
- (obj) => {
- const { spam, threat, hate_speech, bullying, text } = obj;
- return spam || threat || hate_speech || bullying || (text !== undefined && text !== '');
- },
- {
- path: ['text'],
- message: 'Your report should include an issue or a reason.',
- },
- );
-
-export type CommentReportSchemaType = z.infer<typeof commentReportSchema>;
+export interface CommentReportSchemaType {
+ spam: boolean;
+ threat: boolean;
+ hate_speech: boolean;
+ bullying: boolean;
+ text: string;
+}
// million-ignore
export function Comment({
diff --git a/apps/web/src/app/challenge/_components/comments/comments.hooks.tsx b/apps/web/src/app/challenge/_components/comments/comments.hooks.tsx
index 8cb11110..25e49727 100644
--- a/apps/web/src/app/challenge/_components/comments/comments.hooks.tsx
+++ b/apps/web/src/app/challenge/_components/comments/comments.hooks.tsx
@@ -110,7 +110,7 @@ export function useComments(props: UseCommentsProps) {
queryClient.invalidateQueries({
queryKey: getQueryKey({ sort: commentsMeta.sort.value, page: newPage }),
});
- } catch (e) {
+ } catch {
toast({
...commentErrors.unexpected,
variant: 'destructive',
@@ -138,7 +138,7 @@ export function useComments(props: UseCommentsProps) {
queryClient.invalidateQueries({
queryKey: getQueryKey({ sort: commentsMeta.sort.value, page: newPage }),
});
- } catch (e) {
+ } catch {
toast({
...commentErrors.unauthorized,
variant: 'destructive',
@@ -157,7 +157,7 @@ export function useComments(props: UseCommentsProps) {
queryClient.invalidateQueries({
queryKey: getQueryKey({ sort: commentsMeta.sort.value, page: commentsMeta.page }),
});
- } catch (e) {
+ } catch {
toast({
...commentErrors.unauthorized,
variant: 'destructive',
@@ -270,7 +270,7 @@ export function useCommentsReplies({
}
//Invalidate the root query to refetch the comments
queryClient.invalidateQueries({ queryKey: rootQueryKey });
- } catch (e) {
+ } catch {
toast({
...commentErrors.unauthorized,
variant: 'destructive',
@@ -287,7 +287,7 @@ export function useCommentsReplies({
toast(commentErrors.unauthorized);
}
queryClient.invalidateQueries({ queryKey });
- } catch (e) {
+ } catch {
toast({
...commentErrors.unauthorized,
variant: 'destructive',
@@ -309,7 +309,7 @@ export function useCommentsReplies({
}
//Invalidate the root query to refetch the comments
queryClient.invalidateQueries({ queryKey: rootQueryKey });
- } catch (e) {
+ } catch {
toast({
...commentErrors.unexpected,
variant: 'destructive',
diff --git a/apps/web/src/app/challenge/_components/comments/getCommentRouteData.ts b/apps/web/src/app/challenge/_components/comments/getCommentRouteData.ts
index 12a572b0..48618299 100644
--- a/apps/web/src/app/challenge/_components/comments/getCommentRouteData.ts
+++ b/apps/web/src/app/challenge/_components/comments/getCommentRouteData.ts
@@ -62,7 +62,7 @@ export async function getPreselectedSolutionCommentMetadata(
},
});
- if (!solution || !solution.solutionComment) return;
+ if (!solution?.solutionComment) return;
const comments = solution.solutionComment;
const index = comments.findIndex((comment) => comment.id === commentId);
diff --git a/apps/web/src/app/challenge/_components/comments/index.tsx b/apps/web/src/app/challenge/_components/comments/index.tsx
index 36c797da..2a286614 100644
--- a/apps/web/src/app/challenge/_components/comments/index.tsx
+++ b/apps/web/src/app/challenge/_components/comments/index.tsx
@@ -17,7 +17,7 @@ import { useTrackNavigationVisiblity } from '../../[slug]/use-track-visibility.h
import type { ChallengeRouteData } from '../../[slug]/getChallengeRouteData';
import type { SolutionRouteData } from '../../[slug]/solutions/[solutionId]/getSolutionIdRouteData';
-interface Props {
+interface CommentsProps {
preselectedCommentMetadata?: PreselectedCommentMetadata;
expanded?: boolean;
root: ChallengeRouteData['challenge'] | SolutionRouteData;
@@ -25,7 +25,12 @@ interface Props {
}
// million-ignore
-export function Comments({ preselectedCommentMetadata, root, type, expanded = false }: Props) {
+export function Comments({
+ preselectedCommentMetadata,
+ root,
+ type,
+ expanded = false,
+}: CommentsProps) {
const { isTrackTitleVisible } = useTrackNavigationVisiblity();
const [showComments, setShowComments] = useState(expanded);
const commentContainerRef = useRef<HTMLDivElement>(null);
diff --git a/apps/web/src/app/challenge/_components/description/index.tsx b/apps/web/src/app/challenge/_components/description/index.tsx
index a50db216..ad9f9d23 100644
--- a/apps/web/src/app/challenge/_components/description/index.tsx
+++ b/apps/web/src/app/challenge/_components/description/index.tsx
@@ -28,7 +28,7 @@ import { UserBadge } from '../comments/enhanced-user-badge';
import { Vote } from '../vote';
import { Suggestions } from './suggestions';
-interface Props {
+interface DescriptionProps {
challenge: ChallengeRouteData['challenge'];
}
@@ -39,7 +39,7 @@ export interface FormValues {
other: boolean;
}
-export function Description({ challenge }: Props) {
+export function Description({ challenge }: DescriptionProps) {
const [hasBookmarked, setHasBookmarked] = useState(challenge.bookmark.length > 0);
const session = useSession();
diff --git a/apps/web/src/app/challenge/_components/editor-shortcuts/editor-shortcuts-form.tsx b/apps/web/src/app/challenge/_components/editor-shortcuts/editor-shortcuts-form.tsx
index 32d6ae2c..e4946bfa 100644
--- a/apps/web/src/app/challenge/_components/editor-shortcuts/editor-shortcuts-form.tsx
+++ b/apps/web/src/app/challenge/_components/editor-shortcuts/editor-shortcuts-form.tsx
@@ -2,12 +2,12 @@
import type { PropsWithChildren } from 'react';
-interface Props {
+interface EditorShortcutProps {
title: string;
description: React.ReactNode;
}
-function EditorShortcut(props: Props) {
+function EditorShortcut(props: EditorShortcutProps) {
return (
<div className="grid grid-cols-2 gap-2">
<h1>{props.title}</h1>
diff --git a/apps/web/src/app/challenge/_components/explore-drawer.tsx b/apps/web/src/app/challenge/_components/explore-drawer.tsx
index 12dd8e6d..f67aad9c 100644
--- a/apps/web/src/app/challenge/_components/explore-drawer.tsx
+++ b/apps/web/src/app/challenge/_components/explore-drawer.tsx
@@ -2,12 +2,12 @@ import { Sheet, SheetContent, SheetTrigger } from '@repo/ui/components/sheet';
import { ExplorerPanel } from './sheet-content-custom';
import type { ReactNode } from 'react';
-interface Props {
+interface ExploreDrawerProps {
children: ReactNode;
asChild?: boolean;
}
-export function ExploreDrawer({ children, asChild = false }: Props) {
+export function ExploreDrawer({ children, asChild = false }: ExploreDrawerProps) {
return (
<Sheet>
<SheetTrigger asChild={asChild}>{children}</SheetTrigger>
diff --git a/apps/web/src/app/challenge/_components/sort-select.tsx b/apps/web/src/app/challenge/_components/sort-select.tsx
index 3013f5e3..616844f9 100644
--- a/apps/web/src/app/challenge/_components/sort-select.tsx
+++ b/apps/web/src/app/challenge/_components/sort-select.tsx
@@ -13,13 +13,13 @@ interface SortKey {
order: string;
}
-interface Props {
+interface SortSelectProps {
currentSortKey: SortKey;
totalSortKeys: readonly SortKey[];
onValueChange: (value: string) => void;
}
-export function SortSelect({ currentSortKey, totalSortKeys, onValueChange }: Props) {
+export function SortSelect({ currentSortKey, totalSortKeys, onValueChange }: SortSelectProps) {
return (
<div className="flex items-center gap-2 px-3 py-2">
<Select value={currentSortKey.value} defaultValue="newest" onValueChange={onValueChange}>
diff --git a/apps/web/src/app/challenge/_components/swap-panel-button.tsx b/apps/web/src/app/challenge/_components/swap-panel-button.tsx
index 0e5c6558..f121e055 100644
--- a/apps/web/src/app/challenge/_components/swap-panel-button.tsx
+++ b/apps/web/src/app/challenge/_components/swap-panel-button.tsx
@@ -1,11 +1,11 @@
import { ArrowRightLeft } from '@repo/ui/icons';
import { Tooltip, TooltipContent, TooltipTrigger } from '@repo/ui/components/tooltip';
-interface props {
+interface SwapPanelButtonProps {
toggleDirection: () => void;
}
-const SwapPanelButton = ({ toggleDirection }: props) => {
+const SwapPanelButton = ({ toggleDirection }: SwapPanelButtonProps) => {
return (
<Tooltip>
<TooltipTrigger asChild>
diff --git a/apps/web/src/app/explore/[slug]/page.tsx b/apps/web/src/app/explore/[slug]/page.tsx
index bdbb8b2b..24c4dc9c 100644
--- a/apps/web/src/app/explore/[slug]/page.tsx
+++ b/apps/web/src/app/explore/[slug]/page.tsx
@@ -5,7 +5,7 @@ import type { Metadata } from 'next';
export const dynamic = 'force-dynamic';
-interface Props {
+interface PageProps {
params: {
slug: string;
};
@@ -17,7 +17,7 @@ export const metadata: Metadata = {
// accepts both difficulty & tags as slug.
// ex: `/explore/easy`, `explore/popular`
-export default function Page({ params }: Props) {
+export default function Page({ params }: PageProps) {
return (
<Suspense fallback={<ExploreSlugSkeleton />}>
<ExploreSlug slug={params.slug} />
diff --git a/apps/web/src/app/explore/_components/explore-challenges-progress.tsx b/apps/web/src/app/explore/_components/explore-challenges-progress.tsx
index f8ab5804..8af18592 100644
--- a/apps/web/src/app/explore/_components/explore-challenges-progress.tsx
+++ b/apps/web/src/app/explore/_components/explore-challenges-progress.tsx
@@ -7,7 +7,7 @@ interface ExploreChallengesProgressionProps {
const SOLVED = 'Solved';
-export async function ExploreChallengesProgression({
+export function ExploreChallengesProgression({
completed,
total,
}: ExploreChallengesProgressionProps) {
diff --git a/apps/web/src/app/explore/_components/index.tsx b/apps/web/src/app/explore/_components/index.tsx
index a00b094e..1ad82474 100644
--- a/apps/web/src/app/explore/_components/index.tsx
+++ b/apps/web/src/app/explore/_components/index.tsx
@@ -5,7 +5,7 @@ import { ExploreSectionSkeleton } from './explore-section-skeleton';
export const dynamic = 'force-dynamic';
-export async function Explore() {
+export function Explore() {
return (
<>
<div className="flex flex-col gap-8 py-8 md:gap-10">
diff --git a/apps/web/src/app/explore/page.tsx b/apps/web/src/app/explore/page.tsx
index 9451a816..ffbca292 100644
--- a/apps/web/src/app/explore/page.tsx
+++ b/apps/web/src/app/explore/page.tsx
@@ -4,7 +4,7 @@ import { buildMetaForDefault } from '~/app/metadata';
// CI fails without this
export const dynamic = 'force-dynamic';
-export async function generateMetadata(): Promise<Metadata> {
+export function generateMetadata(): Metadata {
return buildMetaForDefault({
title: 'Explore Challenges | TypeHero',
description:
diff --git a/apps/web/src/app/feature-flag-provider.tsx b/apps/web/src/app/feature-flag-provider.tsx
index b6fef412..2516de9a 100644
--- a/apps/web/src/app/feature-flag-provider.tsx
+++ b/apps/web/src/app/feature-flag-provider.tsx
@@ -4,12 +4,12 @@ import { mockFlags } from '~/utils/feature-flags';
export const FeatureFlagContext = createContext<Record<string, boolean>>({});
-interface Props {
+interface FeatureFlagProviderProps {
children: ReactNode;
}
const isProd = process.env.NODE_ENV === 'production';
-export function FeatureFlagProvider({ children }: Props) {
+export function FeatureFlagProvider({ children }: FeatureFlagProviderProps) {
const { data: featureFlags } = useQuery({
queryKey: ['featureFlags'],
queryFn: () => getFeatureFlags(),
diff --git a/apps/web/src/app/login/_components/LoginButton.tsx b/apps/web/src/app/login/_components/LoginButton.tsx
index c07468d3..6bd0beb8 100644
--- a/apps/web/src/app/login/_components/LoginButton.tsx
+++ b/apps/web/src/app/login/_components/LoginButton.tsx
@@ -13,7 +13,7 @@ export function LoginButton({ redirectTo }: { redirectTo: string }) {
try {
setState('pending');
await signIn('github', { callbackUrl: redirectTo });
- } catch (error) {
+ } catch {
setState('error');
}
};
diff --git a/apps/web/src/app/login/page.tsx b/apps/web/src/app/login/page.tsx
index 68375312..79ea4a0e 100644
--- a/apps/web/src/app/login/page.tsx
+++ b/apps/web/src/app/login/page.tsx
@@ -1,7 +1,7 @@
import Link from 'next/link';
import { LoginButton } from './_components/LoginButton';
-export default async function Index({
+export default function Index({
searchParams,
}: {
searchParams: {
diff --git a/apps/web/src/app/metadata.ts b/apps/web/src/app/metadata.ts
index 52522d11..1710bdb3 100644
--- a/apps/web/src/app/metadata.ts
+++ b/apps/web/src/app/metadata.ts
@@ -63,13 +63,13 @@ interface MetaParamsForUser {
dateSince: string;
}
/** Helper to build opengraph metadata for a user, you should call this in generateMetadata() next function */
-export const buildMetaForUser = async ({
+export const buildMetaForUser = ({
title,
description,
username,
dateSince,
avatar,
-}: MetaParamsForUser): Promise<Metadata> => {
+}: MetaParamsForUser): Metadata => {
const params = userParam.toSearchString({
username,
avatar,
@@ -86,13 +86,13 @@ export const buildMetaForUser = async ({
};
/** Helper to build opengraph metadata for a challenge, you should call this in generateMetadata() next function */
-export const buildMetaForChallenge = async ({
+export const buildMetaForChallenge = ({
title,
description,
username,
difficulty,
date,
-}: MetaParamsForChallenge): Promise<Metadata> => {
+}: MetaParamsForChallenge): Metadata => {
const params = challengeParam.toSearchString({
description,
title,
@@ -111,13 +111,13 @@ export const buildMetaForChallenge = async ({
};
/** Helper to build opengraph metadata with defaults, you should call this in generateMetadata() next function */
-export const buildMetaForDefault = async ({
+export const buildMetaForDefault = ({
title,
description,
}: {
title?: string;
description?: string;
-}): Promise<Metadata> => {
+}): Metadata => {
return buildMeta({
ogImageUrl: `${OG_URL}/api/default?cache-bust=${new Date().getDate()}`,
title,
@@ -125,13 +125,13 @@ export const buildMetaForDefault = async ({
});
};
-export const buildMetaForEventPage = async ({
+export const buildMetaForEventPage = ({
title,
description,
}: {
title?: string;
description?: string;
-}): Promise<Metadata> => {
+}): Metadata => {
return buildMeta({
ogImageUrl: `${OG_URL}/api/aot-2023`,
title,
@@ -140,7 +140,7 @@ export const buildMetaForEventPage = async ({
};
/** update the metadata for og */
-const buildMeta = async ({
+const buildMeta = ({
ogImageUrl,
description,
title,
@@ -148,7 +148,7 @@ const buildMeta = async ({
ogImageUrl: string;
description?: string;
title?: string;
-}): Promise<Metadata> => {
+}): Metadata => {
baseMetadata.openGraph!.images = ogImageUrl;
baseMetadata.twitter!.images = ogImageUrl;
diff --git a/apps/web/src/app/page.tsx b/apps/web/src/app/page.tsx
index e8a20475..546126d7 100644
--- a/apps/web/src/app/page.tsx
+++ b/apps/web/src/app/page.tsx
@@ -4,7 +4,7 @@ import { Features } from './_components/features';
import { Hero } from './_components/hero';
import { NewsletterBanner } from './_components/newsletter-banner';
-export default async function Index() {
+export default function Index() {
return (
<>
<Hero />
diff --git a/apps/web/src/app/providers.tsx b/apps/web/src/app/providers.tsx
index c76f538d..4bf48077 100644
--- a/apps/web/src/app/providers.tsx
+++ b/apps/web/src/app/providers.tsx
@@ -9,11 +9,11 @@ import React, { Suspense } from 'react';
import { Toolbar } from '~/components/toolbar';
import { FeatureFlagProvider } from './feature-flag-provider';
-interface Props {
+interface ProvidersProps {
children: React.ReactNode;
}
-export function Providers({ children }: Props) {
+export function Providers({ children }: ProvidersProps) {
const [queryClient] = React.useState(
() =>
new QueryClient({
diff --git a/apps/web/src/app/share/[slug]/page.tsx b/apps/web/src/app/share/[slug]/page.tsx
index 1547928e..8272ad51 100644
--- a/apps/web/src/app/share/[slug]/page.tsx
+++ b/apps/web/src/app/share/[slug]/page.tsx
@@ -2,13 +2,13 @@ import { notFound, permanentRedirect } from 'next/navigation';
import { getLongURL } from '../_actions/get-long-url';
import { updateClick } from '../_actions/update-click-count';
-interface Props {
+interface PageProps {
params: {
slug: string;
};
}
-export default async function Page({ params }: Props) {
+export default async function Page({ params }: PageProps) {
const { slug } = params;
const url = await getLongURL(slug);
diff --git a/apps/web/src/app/share/_components/url-shortener-form.tsx b/apps/web/src/app/share/_components/url-shortener-form.tsx
index 6ebda671..4aa92ebf 100644
--- a/apps/web/src/app/share/_components/url-shortener-form.tsx
+++ b/apps/web/src/app/share/_components/url-shortener-form.tsx
@@ -84,7 +84,7 @@ export function URLShortenerForm() {
variant: 'destructive',
});
}
- } catch (error) {
+ } catch {
toast({
title: 'Something went wrong',
description: 'Error creating short URL',
diff --git a/apps/web/src/app/tracks/[slug]/page.tsx b/apps/web/src/app/tracks/[slug]/page.tsx
index 764c3bdb..07f4f691 100644
--- a/apps/web/src/app/tracks/[slug]/page.tsx
+++ b/apps/web/src/app/tracks/[slug]/page.tsx
@@ -5,19 +5,19 @@ import { getTrackDetails } from '../_components/track.action';
export const dynamic = 'force-dynamic';
-interface Props {
+interface PageProps {
params: {
slug: string;
};
}
-export default async function Page({ params }: Props) {
- const session = await auth();
+export default async function Page({ params }: PageProps) {
+ await auth();
return <TrackDetail slug={params.slug} />;
}
-export async function generateMetadata({ params: { slug } }: Props) {
+export async function generateMetadata({ params: { slug } }: PageProps) {
const track = await getTrackDetails(slug);
if (!track) {
diff --git a/apps/web/src/app/tracks/_components/index.tsx b/apps/web/src/app/tracks/_components/index.tsx
index eafd945a..a6226448 100644
--- a/apps/web/src/app/tracks/_components/index.tsx
+++ b/apps/web/src/app/tracks/_components/index.tsx
@@ -2,7 +2,7 @@ import { EnrolledTrackSection } from './track-enrolled-section';
import { TrackGrid } from './track-grid';
import { Footsies } from '~/components/footsies';
-export async function Tracks() {
+export function Tracks() {
return (
<>
<div className="flex flex-col gap-5 pb-8 md:gap-10 md:py-5">
diff --git a/apps/web/src/app/tracks/page.tsx b/apps/web/src/app/tracks/page.tsx
index f3c9a586..58d23f49 100644
--- a/apps/web/src/app/tracks/page.tsx
+++ b/apps/web/src/app/tracks/page.tsx
@@ -1,7 +1,7 @@
import type { Metadata } from 'next';
import { buildMetaForDefault } from '~/app/metadata';
-export async function generateMetadata(): Promise<Metadata> {
+export function generateMetadata(): Metadata {
return buildMetaForDefault({
title: 'Explore Tracks | TypeHero',
description:
diff --git a/apps/web/src/app/wizard/_components/ChallengeCardEditor.tsx b/apps/web/src/app/wizard/_components/ChallengeCardEditor.tsx
index 2a7cd3e3..79f8b130 100644
--- a/apps/web/src/app/wizard/_components/ChallengeCardEditor.tsx
+++ b/apps/web/src/app/wizard/_components/ChallengeCardEditor.tsx
@@ -16,11 +16,11 @@ import {
} from '@repo/ui/components/select';
import { Input } from '@repo/ui/components/input';
-interface Props {
+interface ChallengeCardEditorProps {
form: WizardForm;
}
-export function ChallengeCardEditor({ form }: Props) {
+export function ChallengeCardEditor({ form }: ChallengeCardEditorProps) {
const difficulty = useWatch({ control: form.control, name: 'difficulty' });
const title = useWatch({ control: form.control, name: 'name' });
const shortDescription = useWatch({ control: form.control, name: 'shortDescription' });
diff --git a/apps/web/src/app/wizard/_components/DescriptionEditor.tsx b/apps/web/src/app/wizard/_components/DescriptionEditor.tsx
index 8a770d63..5c7347de 100644
--- a/apps/web/src/app/wizard/_components/DescriptionEditor.tsx
+++ b/apps/web/src/app/wizard/_components/DescriptionEditor.tsx
@@ -8,11 +8,11 @@ import { useWatch } from 'react-hook-form';
import { useUploadThing } from '~/utils/useUploadthing';
import { type WizardForm } from '.';
-interface Props {
+interface DescriptionEditorProps {
form: WizardForm;
}
-export function DescriptionEditor({ form }: Props) {
+export function DescriptionEditor({ form }: DescriptionEditorProps) {
const description = useWatch({ control: form.control, name: 'description' });
return (
<div className="flex h-full flex-1 flex-col">
diff --git a/apps/web/src/app/wizard/_components/NextBack.tsx b/apps/web/src/app/wizard/_components/NextBack.tsx
index c663f27e..0a39bf15 100644
--- a/apps/web/src/app/wizard/_components/NextBack.tsx
+++ b/apps/web/src/app/wizard/_components/NextBack.tsx
@@ -1,7 +1,7 @@
import { Button } from '@repo/ui/components/button';
import { STEPS } from '.';
-interface Props {
+interface NextBackProps {
current: number;
onChange: (index: number) => void;
onNext: () => void;
@@ -9,7 +9,7 @@ interface Props {
isSubmitting: boolean;
}
-export function NextBack({ current, onChange, onNext, onSubmit, isSubmitting }: Props) {
+export function NextBack({ current, onChange, onNext, onSubmit, isSubmitting }: NextBackProps) {
return (
<div className={`flex justify-center gap-3 ${current === STEPS.Summary && ''}`}>
{current > STEPS.ChallengeCard && (
diff --git a/apps/web/src/app/wizard/_components/Steps.tsx b/apps/web/src/app/wizard/_components/Steps.tsx
index 9cadb98f..8b366821 100644
--- a/apps/web/src/app/wizard/_components/Steps.tsx
+++ b/apps/web/src/app/wizard/_components/Steps.tsx
@@ -2,13 +2,13 @@ import { Check } from '@repo/ui/icons';
import clsx from 'clsx';
import { type Step } from '.';
-interface Props<T extends Step> {
+interface StepsProps<T extends Step> {
current: number;
steps: T[];
onChange: (index: number) => void;
}
-export function Steps<T extends Step>({ steps, current, onChange }: Props<T>) {
+export function Steps<T extends Step>({ steps, current, onChange }: StepsProps<T>) {
return (
<nav aria-label="Progress" className="flex justify-center px-4 lg:-mt-[56px]">
<ol
diff --git a/apps/web/src/app/wizard/_components/Summary.tsx b/apps/web/src/app/wizard/_components/Summary.tsx
index 54c05723..10047a4c 100644
--- a/apps/web/src/app/wizard/_components/Summary.tsx
+++ b/apps/web/src/app/wizard/_components/Summary.tsx
@@ -1,7 +1,7 @@
-interface Props {
+interface SummaryProps {
isUserACreator: boolean;
}
-export function Summary({ isUserACreator }: Props) {
+export function Summary({ isUserACreator }: SummaryProps) {
return (
<div className="flex flex-col items-center justify-center pb-8 pt-12">
<div className="mb-3 max-w-[20ch] text-center text-3xl font-bold text-gray-900 md:text-5xl dark:text-gray-100">
diff --git a/apps/web/src/app/wizard/_components/TestCasesEditor.tsx b/apps/web/src/app/wizard/_components/TestCasesEditor.tsx
index f6913ec6..91f636e8 100644
--- a/apps/web/src/app/wizard/_components/TestCasesEditor.tsx
+++ b/apps/web/src/app/wizard/_components/TestCasesEditor.tsx
@@ -15,13 +15,13 @@ const VimStatusBar = dynamic(() => import('@repo/monaco/vim-mode'), {
ssr: false,
});
-interface Props {
+interface TestCasesEditorProps {
form: Pick<WizardForm, 'control'>;
hasTsErrors: boolean;
setTsErrors: (errors: TsErrors) => void;
}
-export function TestCasesEditor({ form, hasTsErrors, setTsErrors }: Props) {
+export function TestCasesEditor({ form, hasTsErrors, setTsErrors }: TestCasesEditorProps) {
const [editorState, setEditorState] = useState<monaco.editor.IStandaloneCodeEditor>();
const onMount = useCallback<NonNullable<CodeEditorProps['onMount']>>(
diff --git a/apps/web/src/app/wizard/_components/create.action.ts b/apps/web/src/app/wizard/_components/create.action.ts
index 8de69108..014888d1 100644
--- a/apps/web/src/app/wizard/_components/create.action.ts
+++ b/apps/web/src/app/wizard/_components/create.action.ts
@@ -7,7 +7,7 @@ import { type CreateChallengeSchema } from '.';
export async function uploadChallenge(data: CreateChallengeSchema, isUserACreator: boolean) {
const session = await auth();
- if (!session || !session.user) {
+ if (!session?.user) {
throw new Error('Unauthorized');
}
diff --git a/apps/web/src/app/wizard/page.tsx b/apps/web/src/app/wizard/page.tsx
index 3badd694..db1926fe 100644
--- a/apps/web/src/app/wizard/page.tsx
+++ b/apps/web/src/app/wizard/page.tsx
@@ -2,13 +2,13 @@ import type { Metadata } from 'next';
import { buildMetaForDefault } from '~/app/metadata';
import { Wizard } from './_components';
-export async function generateMetadata(): Promise<Metadata> {
+export function generateMetadata(): Metadata {
return buildMetaForDefault({
title: 'Create a Challenge | TypeHero',
description: 'Create a challenge on TypeHero and share it with the world!',
});
}
-export default async function Page() {
+export default function Page() {
return <Wizard />;
}
diff --git a/apps/web/src/components/Navigation/index.tsx b/apps/web/src/components/Navigation/index.tsx
index 8cf88328..58cdcfc5 100644
--- a/apps/web/src/components/Navigation/index.tsx
+++ b/apps/web/src/components/Navigation/index.tsx
@@ -158,7 +158,7 @@ export async function Navigation() {
);
}
-async function LoginButton({
+function LoginButton({
isAdminOrMod,
isAdmin,
session,
diff --git a/apps/web/src/components/Navigation/mobile-nav.tsx b/apps/web/src/components/Navigation/mobile-nav.tsx
index 8303c00d..c76dd1d0 100644
--- a/apps/web/src/components/Navigation/mobile-nav.tsx
+++ b/apps/web/src/components/Navigation/mobile-nav.tsx
@@ -4,11 +4,11 @@ import { motion } from 'framer-motion';
import { usePathname } from 'next/navigation';
import React, { useEffect } from 'react';
-interface Props {
+interface MobileNavProps {
children: React.ReactNode;
}
-export function MobileNav({ children }: Props) {
+export function MobileNav({ children }: MobileNavProps) {
const pathname = usePathname();
const [open, setOpen] = React.useState(false);
const [mounted, setMounted] = React.useState(false);
diff --git a/apps/web/src/components/ReportDialog/index.tsx b/apps/web/src/components/ReportDialog/index.tsx
index 1bbffa3c..9d066e72 100644
--- a/apps/web/src/components/ReportDialog/index.tsx
+++ b/apps/web/src/components/ReportDialog/index.tsx
@@ -59,13 +59,7 @@ export function ReportDialog({
| ReportSolutionDialogProps
| ReportUserDialogProps
>) {
- const {
- handleSubmit,
- formState: { errors },
- register,
- control,
- setValue,
- } = useForm({
+ const { handleSubmit, register, control, setValue } = useForm({
defaultValues: {
derogatory: false,
unclear: false,
@@ -187,7 +181,7 @@ export function ReportDialog({
<FormField
control={control}
name="derogatory"
- render={({ field }) => (
+ render={() => (
<FormItem>
<div className="flex items-center gap-2">
<Checkbox
@@ -203,7 +197,7 @@ export function ReportDialog({
<FormField
control={control}
name="derogatory"
- render={({ field }) => (
+ render={() => (
<FormItem>
<div className="flex items-center gap-2">
<Checkbox
@@ -219,7 +213,7 @@ export function ReportDialog({
<FormField
control={control}
name="hateSpeech"
- render={({ field }) => (
+ render={() => (
<FormItem>
<div className="flex items-center gap-2">
<Checkbox
@@ -235,7 +229,7 @@ export function ReportDialog({
<FormField
control={control}
name="spam"
- render={({ field }) => (
+ render={() => (
<FormItem>
<div className="flex items-center gap-2">
<Checkbox
@@ -251,7 +245,7 @@ export function ReportDialog({
<FormField
control={control}
name="threat"
- render={({ field }) => (
+ render={() => (
<FormItem>
<div className="flex items-center gap-2">
<Checkbox
@@ -268,7 +262,7 @@ export function ReportDialog({
<FormField
control={control}
name="unclear"
- render={({ field }) => (
+ render={() => (
<FormItem>
<div className="flex items-center gap-2">
<Checkbox
@@ -286,7 +280,7 @@ export function ReportDialog({
<FormField
control={control}
name="comments"
- render={({ field }) => (
+ render={() => (
<FormItem className="my-3">
<div className="flex flex-col gap-3">
<div>Other information</div>
diff --git a/apps/web/src/components/carousel.tsx b/apps/web/src/components/carousel.tsx
index 20d8e633..3d393ded 100644
--- a/apps/web/src/components/carousel.tsx
+++ b/apps/web/src/components/carousel.tsx
@@ -5,11 +5,11 @@ import clsx from 'clsx';
import { useEffect, useRef, useState, type ReactNode, useCallback, useId } from 'react';
import { useResizeObserver } from '~/utils/useResizeObserver';
-interface Props {
+interface CarouselProps {
children: ReactNode;
}
-export function Carousel({ children }: Props) {
+export function Carousel({ children }: CarouselProps) {
const id = useId();
const buttonRightSelector = `slideRight-${id}`;
const buttonLeftSelector = `slideLeft-${id}`;
diff --git a/apps/web/src/components/footsies.tsx b/apps/web/src/components/footsies.tsx
index b8ca25ac..c81ec7f9 100644
--- a/apps/web/src/components/footsies.tsx
+++ b/apps/web/src/components/footsies.tsx
@@ -2,7 +2,7 @@ import Link from 'next/link';
import { Binary, Github, Twitter } from '@repo/ui/icons';
import { ThemeButton } from './Navigation/theme-button';
-export async function Footsies() {
+export function Footsies() {
return (
<footer className="flex flex-col items-center gap-2 px-8 pb-12 text-sm font-light sm:px-16 sm:pb-20 sm:pt-6 md:px-0 md:py-12">
<div className="container flex flex-col-reverse justify-between gap-2 md:flex-row md:items-end">
diff --git a/apps/web/src/components/infinite-list.tsx b/apps/web/src/components/infinite-list.tsx
index 38d0f8d6..5aad810a 100644
--- a/apps/web/src/components/infinite-list.tsx
+++ b/apps/web/src/components/infinite-list.tsx
@@ -1,7 +1,7 @@
import type { ReactNode, RefObject } from 'react';
import { useEffect, useRef, useState } from 'react';
-interface Props {
+interface InfiniteListProps {
children: ReactNode;
isLoadingNext: boolean;
next: () => void;
@@ -47,7 +47,13 @@ export function useObserver(ref: RefObject<HTMLDivElement>, options?: Intersecti
return entry;
}
-export default function InfiniteList({ children, hasNext, isLoadingNext, next, loader }: Props) {
+export default function InfiniteList({
+ children,
+ hasNext,
+ isLoadingNext,
+ next,
+ loader,
+}: InfiniteListProps) {
const loaderRef = useRef<HTMLDivElement>(null);
const entry = useObserver(loaderRef);
diff --git a/apps/web/src/components/mention/user-results.tsx b/apps/web/src/components/mention/user-results.tsx
index 36608ec9..d63fd764 100644
--- a/apps/web/src/components/mention/user-results.tsx
+++ b/apps/web/src/components/mention/user-results.tsx
@@ -9,14 +9,14 @@ import { useEffect, useRef, useState } from 'react';
import { Loader } from '../loader';
import { searchUsers } from './actions';
-interface Props {
+interface UserResultsProps {
isOpen: boolean;
query: string;
onFocusOutside: () => void;
onSelectedUser: (user: string) => void;
}
-export function UserResults({ isOpen, onFocusOutside, onSelectedUser, query }: Props) {
+export function UserResults({ isOpen, onFocusOutside, onSelectedUser, query }: UserResultsProps) {
const { toast } = useToast();
const popoverRef = useRef<HTMLDivElement | null>(null);
const [selectedIndex, setSelectedIndex] = useState(0);
diff --git a/apps/web/src/components/search/search-content.tsx b/apps/web/src/components/search/search-content.tsx
index 36139204..3aa0a7a8 100644
--- a/apps/web/src/components/search/search-content.tsx
+++ b/apps/web/src/components/search/search-content.tsx
@@ -11,7 +11,7 @@ import { SearchIcon, Loader2 as LoaderIcon, X as XIcon } from '@repo/ui/icons';
import { ScrollArea, ScrollBar } from '@repo/ui/components/scroll-area';
function useRecentSearches() {
- return useRecentSearchesStorage<Challenge>();
+ return useRecentSearchesStorage();
}
type OnClick = () => void;
@@ -141,7 +141,7 @@ function Topbar() {
function RecentSearches({ onClick }: { onClick: OnClick }) {
const { getItems, onAdd, onRemove } = useRecentSearches();
- const results = getItems();
+ const results = getItems() as Challenge[];
if (results.length === 0) {
return (
diff --git a/apps/web/src/components/search/use-recent-searches-storage.tsx b/apps/web/src/components/search/use-recent-searches-storage.tsx
index 0e7cb608..b60df33b 100644
--- a/apps/web/src/components/search/use-recent-searches-storage.tsx
+++ b/apps/web/src/components/search/use-recent-searches-storage.tsx
@@ -2,13 +2,15 @@ import { useLocalStorage } from '~/utils/useLocalStorage';
const SEARCH_LOCAL_STORAGE_KEY = '__TYPEHERO_SEARCH__';
-interface UseRecentSearchesStorageProps<Item extends { id: number | string }> {
+interface UseRecentSearchesStorageProps {
limit?: number;
}
-export function useRecentSearchesStorage<Item extends { id: number | string }>({
- limit = 5,
-}: UseRecentSearchesStorageProps<Item> = {}) {
+interface Item {
+ id: number | string;
+}
+
+export function useRecentSearchesStorage({ limit = 5 }: UseRecentSearchesStorageProps = {}) {
const [storage, setStorage] = useLocalStorage(SEARCH_LOCAL_STORAGE_KEY, '[]');
const getItems = () => {
diff --git a/apps/web/src/utils/server/get-random-challenge.ts b/apps/web/src/utils/server/get-random-challenge.ts
index 1db1cb42..2a654428 100644
--- a/apps/web/src/utils/server/get-random-challenge.ts
+++ b/apps/web/src/utils/server/get-random-challenge.ts
@@ -1,12 +1,12 @@
'use server';
import { prisma } from '@repo/db';
-interface resultType {
+interface Result {
slug: string;
}
export async function getRandomChallenge() {
- const result: resultType[] =
+ const result: Result[] =
await prisma.$queryRaw`SELECT slug FROM Challenge ORDER BY RAND() LIMIT 1`;
if (result.length > 0 && result[0] && Boolean(result[0].slug)) {
diff --git a/apps/web/src/utils/sorting.ts b/apps/web/src/utils/sorting.ts
index 05ea3d03..a845eb79 100644
--- a/apps/web/src/utils/sorting.ts
+++ b/apps/web/src/utils/sorting.ts
@@ -1,8 +1,5 @@
-const sortingKeys = ['createdAt', 'vote', 'replies', 'solutionComment'] as const;
-const sortingOrders = ['asc', 'desc'] as const;
-
-export type SortKey = (typeof sortingKeys)[number];
-export type SortOrder = (typeof sortingOrders)[number];
+export type SortKey = 'createdAt' | 'replies' | 'solutionComment' | 'vote';
+export type SortOrder = 'asc' | 'desc';
export function orderBy(sortKey: SortKey, sortOrder: SortOrder) {
switch (sortKey) {
diff --git a/apps/web/tests/e2e/authenticated/comment.test.ts b/apps/web/tests/e2e/authenticated/comment.test.ts
index a42e82f9..04b37a3b 100644
--- a/apps/web/tests/e2e/authenticated/comment.test.ts
+++ b/apps/web/tests/e2e/authenticated/comment.test.ts
@@ -105,7 +105,7 @@ test.describe('sharing comments', () => {
const commentNumber = Math.floor(Math.random() * 1000);
const parentComment = `Here is my comment ${commentNumber}`;
- test('share comment and navigate to comment link', async ({ page, context }) => {
+ test('share comment and navigate to comment link', async ({ page }) => {
const comment = await prisma.comment.create({
data: {
rootChallengeId: 3,
diff --git a/packages/auth/src/server.ts b/packages/auth/src/server.ts
index 7ebd74bd..52341699 100644
--- a/packages/auth/src/server.ts
+++ b/packages/auth/src/server.ts
@@ -24,10 +24,6 @@ declare module '@auth/core/adapters' {
}
}
-const useSecureCookies = process.env.VERCEL_ENV === 'production';
-const cookiePrefix = useSecureCookies ? '__Secure-' : '';
-const cookieDomain = useSecureCookies ? 'typehero.dev' : undefined;
-
export const baseNextAuthConfig: Omit<NextAuthConfig, 'providers'> = {
pages: {
signIn: '/login',
@@ -63,7 +59,7 @@ export const baseNextAuthConfig: Omit<NextAuthConfig, 'providers'> = {
},
},
callbacks: {
- session: async (opts) => {
+ session: (opts) => {
if (!('user' in opts)) throw new Error("unreachable, we're not using JWT");
const { session, user } = opts;
diff --git a/packages/db/seed/leaderboard.ts b/packages/db/seed/leaderboard.ts
index 28ec0b39..f7898fb2 100644
--- a/packages/db/seed/leaderboard.ts
+++ b/packages/db/seed/leaderboard.ts
@@ -12,7 +12,7 @@ async function generateMockUsers() {
try {
await prisma.user.createMany({ data: users });
console.log('Generated 200 mock users');
- } catch (e) {
+ } catch {
console.log('mock users already generated');
}
}
diff --git a/packages/db/seed/prod.ts b/packages/db/seed/prod.ts
index da696581..801ff3bc 100644
--- a/packages/db/seed/prod.ts
+++ b/packages/db/seed/prod.ts
@@ -56,7 +56,7 @@ try {
})),
});
await prisma.challenge.createMany({
- data: challengesToCreate.map(({ author, ...challenge }) => ({
+ data: challengesToCreate.map(({ author: _, ...challenge }) => ({
...challenge,
userId: typeHeroUser.id,
})),
diff --git a/packages/monaco/src/settings-store.ts b/packages/monaco/src/settings-store.ts
index 424d1a2a..892f17d5 100644
--- a/packages/monaco/src/settings-store.ts
+++ b/packages/monaco/src/settings-store.ts
@@ -21,12 +21,12 @@ nmap gcc :M<Space>editor.action.commentLine`,
type Settings = typeof DEFAULT_SETTINGS;
-interface State {
+interface EditorSettingsState {
settings: Settings;
updateSettings: (settings: Settings) => void;
}
-export const useEditorSettingsStore = create<State>()(
+export const useEditorSettingsStore = create<EditorSettingsState>()(
persist(
(set, get) => ({
settings: DEFAULT_SETTINGS,
diff --git a/packages/monaco/src/split-editor.tsx b/packages/monaco/src/split-editor.tsx
index cf0d10c3..608178b0 100644
--- a/packages/monaco/src/split-editor.tsx
+++ b/packages/monaco/src/split-editor.tsx
@@ -101,8 +101,7 @@ export default function SplitEditor({
if (
(e.ctrlKey || e.metaKey) &&
e.code === 'KeyS' &&
- wrapper.current &&
- wrapper.current.contains(document.activeElement)
+ wrapper.current?.contains(document.activeElement)
) {
e.preventDefault();
editorRef.current?.getAction('editor.action.formatDocument')?.run();
@@ -429,7 +428,7 @@ export default function SplitEditor({
defaultValue={userCode}
value={userCode}
onValidate={onValidate?.user}
- onChange={async (value, changeEvent) => {
+ onChange={(value, changeEvent) => {
const code = value ?? '';
debouncedUserCodeAta(code);
if (hasImports(code)) {
@@ -489,7 +488,7 @@ export default function SplitEditor({
renderValidationDecorations: 'on',
readOnly: isTestsReadonly,
}}
- onMount={async (editor, monaco) => {
+ onMount={(editor, monaco) => {
// this just does the typechecking so the UI can update
onMount?.tests?.(editor, monaco);
const testModel = monaco.editor.getModel(monaco.Uri.parse(TESTS_PATH))!;
@@ -514,7 +513,7 @@ export default function SplitEditor({
defaultPath={TESTS_PATH}
value={tests}
defaultValue={tests}
- onChange={async (editor, changeEvent) => {
+ onChange={(editor, changeEvent) => {
const code = editor ?? '';
debouncedTestCodeAta(code);
if (hasImports(code)) {
diff --git a/packages/monaco/src/twoslash/helpers.ts b/packages/monaco/src/twoslash/helpers.ts
index 09e67a8a..d516fb21 100644
--- a/packages/monaco/src/twoslash/helpers.ts
+++ b/packages/monaco/src/twoslash/helpers.ts
@@ -22,8 +22,8 @@ export async function quickInfoRequest({
};
}
-export async function createInlayHint({ hint, monaco, position }: InlayHintInfo) {
- if (!hint || !hint.displayParts) return;
+export function createInlayHint({ hint, monaco, position }: InlayHintInfo) {
+ if (!hint?.displayParts) return;
// Make a one-liner
let text = hint.displayParts
.map((d: { text: string }) => d.text)
@@ -68,7 +68,7 @@ export async function getLeftMostHintOfLine({
worker,
});
- if (!hint || !hint.displayParts) {
+ if (!hint?.displayParts) {
continue;
}
diff --git a/packages/monaco/src/twoslash/queries.ts b/packages/monaco/src/twoslash/queries.ts
index e5b04ecc..4be2f565 100644
--- a/packages/monaco/src/twoslash/queries.ts
+++ b/packages/monaco/src/twoslash/queries.ts
@@ -53,7 +53,7 @@ export async function checkTwoslashQuery({
offset: inspectionOff,
worker,
});
- const inlayHint = await createInlayHint({
+ const inlayHint = createInlayHint({
hint,
monaco,
position: endPos,
@@ -105,7 +105,7 @@ export async function checkInlineTwoslashQuery({
monaco,
});
- const inlayHint = await createInlayHint({
+ const inlayHint = createInlayHint({
hint,
monaco,
position: endPos,
diff --git a/packages/og-utils/src/zodParams.ts b/packages/og-utils/src/zodParams.ts
index d6979e88..4d34194a 100644
--- a/packages/og-utils/src/zodParams.ts
+++ b/packages/og-utils/src/zodParams.ts
@@ -6,7 +6,7 @@ type JsonValue = JsonValue[] | Primitives | { [key: string]: JsonValue };
const jsonStr = z.string().transform((str, ctx) => {
try {
return JSON.parse(str) as JsonValue;
- } catch (error) {
+ } catch {
ctx.addIssue({ code: 'custom', message: 'Needs to be JSON' });
}
});
diff --git a/packages/ui/src/components/alert-dialog.tsx b/packages/ui/src/components/alert-dialog.tsx
index f1b87dc1..5334d48b 100644
--- a/packages/ui/src/components/alert-dialog.tsx
+++ b/packages/ui/src/components/alert-dialog.tsx
@@ -21,7 +21,7 @@ AlertDialogPortal.displayName = AlertDialogPrimitive.Portal.displayName;
const AlertDialogOverlay = React.forwardRef<
React.ElementRef<typeof AlertDialogPrimitive.Overlay>,
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Overlay>
->(({ className, children, ...props }, ref) => (
+>(({ className, children: _, ...props }, ref) => (
<AlertDialogPrimitive.Overlay
className={cn(
'bg-background/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 backdrop-blur-sm',
diff --git a/packages/ui/src/components/badge.tsx b/packages/ui/src/components/badge.tsx
index e38fdd3c..e46e1b30 100644
--- a/packages/ui/src/components/badge.tsx
+++ b/packages/ui/src/components/badge.tsx
@@ -31,10 +31,8 @@ export interface BadgeProps
extends React.HTMLAttributes<HTMLDivElement>,
VariantProps<typeof badgeVariants> {}
-const Badge = React.forwardRef<HTMLDivElement, BadgeProps>(
- ({ variant, className, ...props }, ref) => (
- <div className={cn(badgeVariants({ variant }), className)} {...props} />
- ),
-);
+const Badge = React.forwardRef<HTMLDivElement, BadgeProps>(({ variant, className, ...props }) => (
+ <div className={cn(badgeVariants({ variant }), className)} {...props} />
+));
export { Badge, badgeVariants };
diff --git a/packages/ui/src/components/difficulty-badge.tsx b/packages/ui/src/components/difficulty-badge.tsx
index ceb84293..7e031561 100644
--- a/packages/ui/src/components/difficulty-badge.tsx
+++ b/packages/ui/src/components/difficulty-badge.tsx
@@ -2,7 +2,7 @@ import { type Difficulty } from '@repo/db/types';
import { Badge } from './badge';
import { cn } from '../cn';
-interface Props {
+interface DifficultyBadgeProps {
difficulty: Difficulty;
className?: string;
}
@@ -17,7 +17,7 @@ const COLORS_BY_DIFFICULTY = {
EVENT: 'dark:bg-difficulty-extreme-dark bg-difficulty-extreme',
};
-export function DifficultyBadge({ className, difficulty }: Props) {
+export function DifficultyBadge({ className, difficulty }: DifficultyBadgeProps) {
return (
<Badge
className={cn(
diff --git a/packages/ui/src/components/paragraph.tsx b/packages/ui/src/components/paragraph.tsx
index 706fbaca..d1683ee9 100644
--- a/packages/ui/src/components/paragraph.tsx
+++ b/packages/ui/src/components/paragraph.tsx
@@ -1,7 +1,7 @@
'use client';
-interface Props {
+interface TypographyPProps {
children: React.ReactNode;
}
-export function TypographyP({ children }: Props) {
+export function TypographyP({ children }: TypographyPProps) {
return <p className="leading-7 [&:not(:first-child)]:mt-4">{children}</p>;
}
diff --git a/packages/ui/src/components/radio-group.tsx b/packages/ui/src/components/radio-group.tsx
index 0b908c47..ff801da3 100644
--- a/packages/ui/src/components/radio-group.tsx
+++ b/packages/ui/src/components/radio-group.tsx
@@ -17,7 +17,7 @@ RadioGroup.displayName = RadioGroupPrimitive.Root.displayName;
const RadioGroupItem = React.forwardRef<
React.ElementRef<typeof RadioGroupPrimitive.Item>,
React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Item>
->(({ className, children, ...props }, ref) => {
+>(({ className, children: _, ...props }, ref) => {
return (
<RadioGroupPrimitive.Item
ref={ref}
diff --git a/packages/ui/src/components/rich-markdown-editor.tsx b/packages/ui/src/components/rich-markdown-editor.tsx
index fe4503df..53e39f8f 100644
--- a/packages/ui/src/components/rich-markdown-editor.tsx
+++ b/packages/ui/src/components/rich-markdown-editor.tsx
@@ -73,7 +73,7 @@ export function RichMarkdownEditor({
/>
</svg>
),
- execute: async () => {
+ execute: () => {
const ref = fileInputRef.current!;
if (!ref) return;
diff --git a/packages/ui/src/components/typography/h1.tsx b/packages/ui/src/components/typography/h1.tsx
index c8a4105d..077041db 100644
--- a/packages/ui/src/components/typography/h1.tsx
+++ b/packages/ui/src/components/typography/h1.tsx
@@ -1,10 +1,10 @@
import { cn } from '../../cn';
-interface Props extends React.HTMLAttributes<HTMLHeadingElement> {
+interface TypographyH1Props extends React.HTMLAttributes<HTMLHeadingElement> {
children: React.ReactNode;
}
-export function TypographyH1({ children, className, ...props }: Props) {
+export function TypographyH1({ children, className, ...props }: TypographyH1Props) {
return (
<h1 className={cn('scroll-m-20 font-bold tracking-tight lg:text-5xl', className)} {...props}>
{children}
diff --git a/packages/ui/src/components/typography/h2.tsx b/packages/ui/src/components/typography/h2.tsx
index 7273521c..40e2081d 100644
--- a/packages/ui/src/components/typography/h2.tsx
+++ b/packages/ui/src/components/typography/h2.tsx
@@ -1,10 +1,10 @@
import { cn } from '../../cn';
-interface Props extends React.HTMLAttributes<HTMLHeadingElement> {
+interface TypographyH2Props extends React.HTMLAttributes<HTMLHeadingElement> {
children: React.ReactNode;
}
-export function TypographyH2({ children, className, ...props }: Props) {
+export function TypographyH2({ children, className, ...props }: TypographyH2Props) {
return (
<h2
className={cn(
diff --git a/packages/ui/src/components/typography/h3.tsx b/packages/ui/src/components/typography/h3.tsx
index cb7d244d..3c7d487b 100644
--- a/packages/ui/src/components/typography/h3.tsx
+++ b/packages/ui/src/components/typography/h3.tsx
@@ -1,10 +1,10 @@
import { cn } from '../../cn';
-interface Props extends React.HTMLAttributes<HTMLHeadingElement> {
+interface TypographyH3Props extends React.HTMLAttributes<HTMLHeadingElement> {
children: React.ReactNode;
}
-export function TypographyH3({ children, className, ...props }: Props) {
+export function TypographyH3({ children, className, ...props }: TypographyH3Props) {
return (
<h3 className={cn('scroll-m-20 text-2xl font-semibold tracking-tight', className)} {...props}>
{children}
diff --git a/packages/ui/src/components/typography/large.tsx b/packages/ui/src/components/typography/large.tsx
index 45458abc..3addf430 100644
--- a/packages/ui/src/components/typography/large.tsx
+++ b/packages/ui/src/components/typography/large.tsx
@@ -1,6 +1,6 @@
-interface Props {
+interface TypographyLargeProps {
children: React.ReactNode;
}
-export function TypographyLarge({ children }: Props) {
+export function TypographyLarge({ children }: TypographyLargeProps) {
return <div className="text-lg font-semibold">{children}</div>;
}
diff --git a/packages/ui/src/components/use-toast.ts b/packages/ui/src/components/use-toast.ts
index 8a60b982..eb996363 100644
--- a/packages/ui/src/components/use-toast.ts
+++ b/packages/ui/src/components/use-toast.ts
@@ -14,12 +14,12 @@ type ToasterToast = ToastProps & {
action?: ToastActionElement;
};
-const actionTypes = {
- ADD_TOAST: 'ADD_TOAST',
- UPDATE_TOAST: 'UPDATE_TOAST',
- DISMISS_TOAST: 'DISMISS_TOAST',
- REMOVE_TOAST: 'REMOVE_TOAST',
-} as const;
+interface ActionType {
+ ADD_TOAST: 'ADD_TOAST';
+ UPDATE_TOAST: 'UPDATE_TOAST';
+ DISMISS_TOAST: 'DISMISS_TOAST';
+ REMOVE_TOAST: 'REMOVE_TOAST';
+}
let count = 0;
@@ -28,8 +28,6 @@ function genId() {
return count.toString();
}
-type ActionType = typeof actionTypes;
-
type Action =
| {
type: ActionType['ADD_TOAST'];
@@ -48,7 +46,7 @@ type Action =
toast: Partial<ToasterToast>;
};
-interface State {
+interface ToastState {
toasts: ToasterToast[];
}
@@ -70,7 +68,7 @@ const addToRemoveQueue = (toastId: string) => {
toastTimeouts.set(toastId, timeout);
};
-export const reducer = (state: State, action: Action): State => {
+export const reducer = (state: ToastState, action: Action): ToastState => {
switch (action.type) {
case 'ADD_TOAST':
return {
@@ -123,9 +121,9 @@ export const reducer = (state: State, action: Action): State => {
}
};
-const listeners: ((state: State) => void)[] = [];
+const listeners: ((state: ToastState) => void)[] = [];
-let memoryState: State = { toasts: [] };
+let memoryState: ToastState = { toasts: [] };
function dispatch(action: Action) {
memoryState = reducer(memoryState, action);
@@ -166,7 +164,7 @@ function toast({ ...props }: Toast) {
}
function useToast() {
- const [state, setState] = useState<State>(memoryState);
+ const [state, setState] = useState<ToastState>(memoryState);
useEffect(() => {
listeners.push(setState);
diff --git a/packages/ui/src/components/user-avatar.tsx b/packages/ui/src/components/user-avatar.tsx
index 5ddd6e8d..d2a14ae9 100644
--- a/packages/ui/src/components/user-avatar.tsx
+++ b/packages/ui/src/components/user-avatar.tsx
@@ -1,11 +1,11 @@
import { cn } from '../cn';
import { Avatar, AvatarFallback, AvatarImage, DefaultAvatar } from './avatar';
-interface Props {
+interface UserAvatarProps {
src: string;
className?: string;
}
-export function UserAvatar(props: Props) {
+export function UserAvatar(props: UserAvatarProps) {
return (
<Avatar className={cn('h-7 w-7', props.className)}>
<AvatarImage src={props.src} alt="user avatar" />
diff --git a/tooling/config-eslint/utils/rules.js b/tooling/config-eslint/utils/rules.js
index 6a322bfa..ca62df95 100644
--- a/tooling/config-eslint/utils/rules.js
+++ b/tooling/config-eslint/utils/rules.js
@@ -49,7 +49,6 @@ module.exports = {
eqeqeq: 'off',
'no-control-regex': 'off',
'no-return-await': 'off',
- '@typescript-eslint/require-await': 'off',
// Best practice/readability
// Some of these might be opinions.
@@ -57,12 +56,9 @@ module.exports = {
'prefer-named-capture-group': 'off',
'prefer-regex-literals': 'off',
'@typescript-eslint/consistent-indexed-object-style': 'off',
- '@typescript-eslint/naming-convention': 'off',
'@typescript-eslint/prefer-nullish-coalescing': 'off',
'import/no-default-export': 'off',
- '@typescript-eslint/no-unused-vars': 'off',
'@typescript-eslint/no-unnecessary-condition': 'off',
- '@typescript-eslint/prefer-optional-chain': 'off',
'react/jsx-no-useless-fragment': 'off',
'no-nested-ternary': 'off',
'react/jsx-sort-props': 'off',