From 7d08c59a7138a761aea224268f6826be2ef0ba9b Mon Sep 17 00:00:00 2001 From: InnerDesires Date: Thu, 6 Aug 2026 18:52:35 +0300 Subject: [PATCH] chore: prune non-critical comments across src Comment lines in src/ drop from 785 to 333 (-58%) across 112 files. The bar for keeping a comment: a reader would be confused, or likely break something, without it. Removed: - JSX section markers ({/* Top bar */}, {/* stats */}, {/* certificates */}) - Step/narration comments that restate the next statement - JSDoc that only repeats the symbol name, including the /** Locale-aware base path ... */ prop doc duplicated across four components - Payload/Next template boilerplate: the 27-line ImageMedia loader essay, @param blocks on deepMerge/getMediaUrl/formatAuthors, defaultPopulate notes, the shadcn preamble in ui.ts, and a stale note in Media.ts claiming uploads land in public/media (they go to Vercel Blob) - ~10 near-identical "session-free so it stays in the ISR cache" headers; kept one authoritative copy on getCatalogData.ts plus the two documenting a specific trap (generateStaticParams, useSearchParams) - Commented-out code in VideoMedia. That left a useEffect registering an empty 'suspend' listener, so the dead effect and its useEffect import went too -- the only non-comment change in the diff, and provably inert. Kept: security invariants (collection access rationale, role-escalation warning, FK delete ordering), framework workarounds (Payload's empty-array minRows loophole, the cyrillicSlugify NULL-vs-'' unique-constraint fix, better-auth's #fragment rejection, plugin-search per-locale writes), magic number provenance (certificate PDF coordinates, rate-limit thresholds), CSS tricks (StepsList minmax(0,1fr), the -50% ticker keyframe), and all functional directives (eslint-disable, @ts-expect-error, @ts-nocheck, empty-catch markers). About 20 surviving multi-line headers were shortened to their load-bearing sentence rather than deleted outright. tsc --noEmit and eslint are clean on all changed files. Prettier's failing-file set is unchanged from HEAD (40 files were already failing). --- src/Header/Nav/index.tsx | 1 - src/HomeCalendar/config.ts | 2 -- src/actions/commentsAndLikes.ts | 2 -- src/actions/xp.ts | 2 -- .../[locale]/courses/[slug]/loading.tsx | 1 - .../[locale]/courses/[slug]/page.tsx | 3 -- .../courses/[slug]/steps/[stepIndex]/page.tsx | 5 ---- .../(frontend)/[locale]/courses/actions.ts | 14 ++------- .../[locale]/courses/category/[slug]/page.tsx | 4 --- src/app/(frontend)/[locale]/courses/page.tsx | 2 -- .../(frontend)/[locale]/leaderboard/page.tsx | 2 -- src/app/(frontend)/[locale]/login/page.tsx | 1 - src/app/(frontend)/[locale]/page.tsx | 5 ++-- .../[locale]/posts/[slug]/loading.tsx | 1 - .../(frontend)/[locale]/posts/[slug]/page.tsx | 2 -- src/app/(frontend)/[locale]/profile/page.tsx | 7 ----- src/app/(frontend)/[locale]/register/page.tsx | 1 - .../(frontend)/[locale]/users/[id]/page.tsx | 6 ---- src/app/(frontend)/next/preview/route.ts | 2 -- src/app/api/auth/verify-registration/route.ts | 4 --- src/app/api/courses/[id]/completions/route.ts | 6 ++-- src/app/api/dev-login/route.ts | 14 --------- src/blocks/Form/Component.tsx | 1 - src/collections/Courses.ts | 1 - src/collections/Media.ts | 1 - src/collections/Pages/hooks/revalidatePage.ts | 1 - src/collections/Pages/index.ts | 5 ---- .../Posts/hooks/populateAuthors.ts | 2 -- src/collections/Posts/hooks/revalidatePost.ts | 1 - src/collections/Posts/index.ts | 8 ----- src/collections/XpEvents.ts | 10 ++----- src/components/AccountSettings/AvatarForm.tsx | 19 ++++-------- .../AccountSettings/ConnectedProviders.tsx | 1 - src/components/AdminBar/index.tsx | 5 ---- src/components/Auth/ForgotPasswordForm.tsx | 3 -- src/components/Auth/PasswordInput.tsx | 2 -- src/components/Auth/RegisterForm.tsx | 5 ---- src/components/BeforeDashboard/index.tsx | 1 - src/components/Card/index.tsx | 2 -- src/components/CollectionArchive/index.tsx | 1 - .../CommentsAndLikes/CommentItem.tsx | 1 - .../CommentsAndLikes/CommentsSection.tsx | 2 -- .../CommentsAndLikes/InteractionClient.tsx | 6 ---- .../CommentsAndLikes/InteractionSection.tsx | 6 ---- .../CommentsAndLikes/LikeButton.tsx | 2 -- src/components/Courses/CategoryCarousels.tsx | 6 ---- src/components/Courses/CategoryFilter.tsx | 3 -- src/components/Courses/CompleteStepButton.tsx | 4 --- src/components/Courses/CompletedByTicker.tsx | 5 ---- src/components/Courses/CourseCard.tsx | 2 -- src/components/Courses/CourseCatalog.tsx | 2 -- src/components/Courses/CourseGrid.tsx | 4 --- src/components/Courses/CourseUserState.tsx | 7 ----- src/components/Courses/FileEmbed.tsx | 1 - src/components/Courses/LoginPromptDialog.tsx | 4 --- src/components/Courses/QuizAttemptHistory.tsx | 1 - src/components/Courses/StepsList.tsx | 1 - src/components/Courses/useMyCourseStatuses.ts | 5 ---- src/components/Home/CoursesServer.tsx | 1 - src/components/Home/FadeIn.tsx | 8 ++--- src/components/Home/Hero.tsx | 3 -- src/components/Home/News.tsx | 1 - src/components/Home/Stats.tsx | 5 ---- src/components/Home/content.ts | 3 -- src/components/Home/index.tsx | 1 - src/components/Link/index.tsx | 11 ++----- src/components/Logo/Brand.tsx | 4 --- src/components/Logo/Logo.tsx | 1 - src/components/Media/ImageMedia/index.tsx | 30 ------------------- src/components/Media/VideoMedia/index.tsx | 13 +------- src/components/Media/types.ts | 12 ++++---- src/components/PayloadRedirects/index.tsx | 1 - .../Profile/ProfileLatestComments.tsx | 6 ---- src/components/RichText/WithArchive.tsx | 9 ++---- src/components/RichText/index.tsx | 1 - src/components/ShareButtons.tsx | 1 - src/components/UserMenu/index.tsx | 6 ---- src/components/YouTubeEmbed.tsx | 4 --- .../admin/InviteUserButton/index.tsx | 5 ---- src/components/admin/graphics/Icon.tsx | 1 - src/components/admin/graphics/Logo.tsx | 7 ++--- src/components/brand/index.tsx | 11 ------- src/endpoints/seed/home-static.ts | 1 - src/environment.d.ts | 2 -- src/hooks/rateLimitCreate.ts | 11 ++----- src/hooks/revalidateCourse.ts | 11 ++----- src/hooks/syncCourseCompletions.ts | 9 ++---- src/lib/auth/dev-credentials.ts | 9 ++---- src/lib/auth/options.ts | 1 - src/lib/auth/pre-verified.ts | 5 ++-- src/lib/auth/seed-dev-admin.ts | 14 ++------- src/lib/courses/getCatalogData.ts | 9 ++---- src/lib/email/admin-invite.ts | 1 - src/lib/rate-limit.ts | 22 +++++--------- src/payload.config.ts | 22 ++------------ src/plugins/ukrainianAdmin.ts | 13 ++------ src/search/localeSync.ts | 1 - src/utilities/contentCounts.ts | 14 ++------- src/utilities/courseCompletion.ts | 9 ++---- src/utilities/deepMerge.ts | 10 ------- src/utilities/formatAuthors.ts | 11 ------- src/utilities/formatDateTime.ts | 1 - src/utilities/generatePreviewPath.ts | 2 -- src/utilities/getDocument.ts | 3 -- src/utilities/getMediaUrl.ts | 8 ----- src/utilities/getRedirects.ts | 5 ---- src/utilities/leaderboard.ts | 13 ++------ src/utilities/myXpCache.ts | 6 ---- src/utilities/plural.ts | 7 ++--- src/utilities/safeRedirect.ts | 6 ++-- src/utilities/ui.ts | 6 ---- src/utilities/xp.ts | 14 ++------- 112 files changed, 75 insertions(+), 534 deletions(-) diff --git a/src/Header/Nav/index.tsx b/src/Header/Nav/index.tsx index 1352914..1435f9c 100644 --- a/src/Header/Nav/index.tsx +++ b/src/Header/Nav/index.tsx @@ -78,7 +78,6 @@ export const HeaderNav: React.FC<{ data: HeaderType; locale: SiteLocale }> = ({ return (