From 468781e311025d5c888453b7d741a1809a43c089 Mon Sep 17 00:00:00 2001 From: Ahmet Kilinc Date: Sat, 20 Dec 2025 12:07:05 +0000 Subject: [PATCH] linting --- app/(auth)/layout.tsx | 8 +-- app/(auth)/register/page.tsx | 19 ++---- .../[repo]/commits/[[...branch]]/page.tsx | 16 ++++- .../[username]/[repo]/settings/page.tsx | 59 +++++-------------- .../[username]/[repo]/tree/[...path]/page.tsx | 2 +- app/(main)/[username]/page.tsx | 10 +--- app/(main)/layout.tsx | 7 +-- app/(main)/page.tsx | 48 ++++----------- app/(main)/settings/page.tsx | 14 +---- app/api/auth/[...all]/route.ts | 1 - app/api/avatar/[filename]/route.ts | 12 ++-- app/not-found.tsx | 8 +-- lib/query-client.tsx | 5 +- lib/r2-git-sync.ts | 54 ++++++++--------- lib/r2.ts | 1 - public/file.svg | 1 - public/globe.svg | 1 - public/next.svg | 1 - public/vercel.svg | 1 - public/window.svg | 1 - 20 files changed, 84 insertions(+), 185 deletions(-) delete mode 100644 public/file.svg delete mode 100644 public/globe.svg delete mode 100644 public/next.svg delete mode 100644 public/vercel.svg delete mode 100644 public/window.svg diff --git a/app/(auth)/layout.tsx b/app/(auth)/layout.tsx index f839b3d..cb0d758 100644 --- a/app/(auth)/layout.tsx +++ b/app/(auth)/layout.tsx @@ -1,14 +1,10 @@ import { GitBranch } from "lucide-react"; import Link from "next/link"; -export default function AuthLayout({ - children, -}: { - children: React.ReactNode; -}) { +export default function AuthLayout({ children }: { children: React.ReactNode }) { return (
-
+
diff --git a/app/(auth)/register/page.tsx b/app/(auth)/register/page.tsx index 4272298..a23eb23 100644 --- a/app/(auth)/register/page.tsx +++ b/app/(auth)/register/page.tsx @@ -89,9 +89,7 @@ export default function RegisterPage() { required className="bg-input/50 h-11" /> -

- This will be your unique identifier on gitbruv -

+

This will be your unique identifier on gitbruv

@@ -117,15 +115,9 @@ export default function RegisterPage() { minLength={8} className="bg-input/50 h-11" /> -

- Must be at least 8 characters -

+

Must be at least 8 characters

- @@ -175,9 +169,7 @@ export default function RepoSettingsPage({
@@ -236,17 +222,13 @@ export default function RepoSettingsPage({ Danger Zone - - Irreversible actions that can affect your repository - + Irreversible actions that can affect your repository

Delete this repository

-

- Once deleted, it cannot be recovered -

+

Once deleted, it cannot be recovered

@@ -260,33 +242,23 @@ export default function RepoSettingsPage({ Delete repository This action cannot be undone. This will permanently delete the{" "} - {username}/{repo.name} repository and all of its contents. + + {username}/{repo.name} + {" "} + repository and all of its contents.
- setDeleteConfirm(e.target.value)} - placeholder={repo.name} - /> + setDeleteConfirm(e.target.value)} placeholder={repo.name} />
- - @@ -299,4 +271,3 @@ export default function RepoSettingsPage({
); } - diff --git a/app/(main)/[username]/[repo]/tree/[...path]/page.tsx b/app/(main)/[username]/[repo]/tree/[...path]/page.tsx index 2e7020a..6f12afc 100644 --- a/app/(main)/[username]/[repo]/tree/[...path]/page.tsx +++ b/app/(main)/[username]/[repo]/tree/[...path]/page.tsx @@ -5,7 +5,7 @@ import { getRepository, getRepoFileTree, getRepoBranches } from "@/actions/repos import { FileTree } from "@/components/file-tree"; import { BranchSelector } from "@/components/branch-selector"; import { Badge } from "@/components/ui/badge"; -import { Lock, Globe, ChevronRight, Home, Loader2 } from "lucide-react"; +import { Lock, Globe, ChevronRight, Home } from "lucide-react"; async function TreeContent({ username, repoName, branch, dirPath }: { username: string; repoName: string; branch: string; dirPath: string }) { const fileTree = await getRepoFileTree(username, repoName, branch, dirPath); diff --git a/app/(main)/[username]/page.tsx b/app/(main)/[username]/page.tsx index 7404ecb..4930cef 100644 --- a/app/(main)/[username]/page.tsx +++ b/app/(main)/[username]/page.tsx @@ -7,7 +7,7 @@ import { getUserRepositoriesWithStars, getUserStarredRepos } from "@/actions/rep import { RepoList } from "@/components/repo-list"; import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"; import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"; -import { CalendarDays, GitBranch, MapPin, Link as LinkIcon, Loader2, Star, BookOpen } from "lucide-react"; +import { CalendarDays, GitBranch, MapPin, Link as LinkIcon, Star, BookOpen } from "lucide-react"; import { format } from "date-fns"; import Link from "next/link"; import { GithubIcon, XIcon, LinkedInIcon } from "@/components/icons"; @@ -61,13 +61,7 @@ function TabSkeleton() { ); } -export default async function ProfilePage({ - params, - searchParams, -}: { - params: Promise<{ username: string }>; - searchParams: Promise<{ tab?: string }>; -}) { +export default async function ProfilePage({ params, searchParams }: { params: Promise<{ username: string }>; searchParams: Promise<{ tab?: string }> }) { const { username } = await params; const { tab } = await searchParams; diff --git a/app/(main)/layout.tsx b/app/(main)/layout.tsx index 7edc72b..f8f5a7f 100644 --- a/app/(main)/layout.tsx +++ b/app/(main)/layout.tsx @@ -1,11 +1,7 @@ import { Header } from "@/components/header"; import { QueryProvider } from "@/lib/query-client"; -export default function MainLayout({ - children, -}: { - children: React.ReactNode; -}) { +export default function MainLayout({ children }: { children: React.ReactNode }) { return (
@@ -15,4 +11,3 @@ export default function MainLayout({ ); } - diff --git a/app/(main)/page.tsx b/app/(main)/page.tsx index 457abe8..a47c660 100644 --- a/app/(main)/page.tsx +++ b/app/(main)/page.tsx @@ -28,12 +28,9 @@ export default async function HomePage() {

@{username}

- +

No repositories yet

-

- Create your first repository to start building something awesome -

+

Create your first repository to start building something awesome

); } - diff --git a/lib/query-client.tsx b/lib/query-client.tsx index 7af5e91..d741aa3 100644 --- a/lib/query-client.tsx +++ b/lib/query-client.tsx @@ -16,8 +16,5 @@ export function QueryProvider({ children }: { children: React.ReactNode }) { }) ); - return ( - {children} - ); + return {children}; } - diff --git a/lib/r2-git-sync.ts b/lib/r2-git-sync.ts index c99ec6a..ff900ee 100644 --- a/lib/r2-git-sync.ts +++ b/lib/r2-git-sync.ts @@ -7,66 +7,69 @@ import os from "os"; export async function syncR2ToLocal(userId: string, repoName: string): Promise { const repoPrefix = getRepoPrefix(userId, `${repoName}.git`); const tempDir = await fs.mkdtemp(path.join(os.tmpdir(), "gitbruv-")); - + const keys = await r2List(repoPrefix); - + for (const key of keys) { const relativePath = key.slice(repoPrefix.length + 1); if (!relativePath) continue; - + const localPath = path.join(tempDir, relativePath); const localDir = path.dirname(localPath); - + await fs.mkdir(localDir, { recursive: true }); - + const data = await r2Get(key); if (data) { await fs.writeFile(localPath, data); } } - + await fs.mkdir(path.join(tempDir, "objects"), { recursive: true }); await fs.mkdir(path.join(tempDir, "objects/info"), { recursive: true }); await fs.mkdir(path.join(tempDir, "objects/pack"), { recursive: true }); await fs.mkdir(path.join(tempDir, "refs"), { recursive: true }); await fs.mkdir(path.join(tempDir, "refs/heads"), { recursive: true }); await fs.mkdir(path.join(tempDir, "refs/tags"), { recursive: true }); - + const headPath = path.join(tempDir, "HEAD"); try { await fs.access(headPath); } catch { await fs.writeFile(headPath, "ref: refs/heads/main\n"); } - + const configPath = path.join(tempDir, "config"); try { await fs.access(configPath); } catch { - await fs.writeFile(configPath, `[core] + await fs.writeFile( + configPath, + `[core] \trepositoryformatversion = 0 \tfilemode = true \tbare = true -`); +` + ); } - + return tempDir; } export async function syncLocalToR2(localDir: string, userId: string, repoName: string): Promise { const repoPrefix = getRepoPrefix(userId, `${repoName}.git`); - + const existingKeys = await r2List(repoPrefix); const existingSet = new Set(existingKeys); const newKeys = new Set(); - + async function uploadDir(dirPath: string, r2Prefix: string) { const entries = await fs.readdir(dirPath, { withFileTypes: true }); - + for (const entry of entries) { const localPath = path.join(dirPath, entry.name); const r2Key = `${r2Prefix}/${entry.name}`; - + if (entry.isDirectory()) { await uploadDir(localPath, r2Key); } else if (entry.isFile()) { @@ -76,9 +79,9 @@ export async function syncLocalToR2(localDir: string, userId: string, repoName: } } } - + await uploadDir(localDir, repoPrefix); - + for (const key of existingSet) { if (!newKeys.has(key)) { await r2Delete(key); @@ -89,28 +92,21 @@ export async function syncLocalToR2(localDir: string, userId: string, repoName: export async function cleanupTempDir(tempDir: string): Promise { try { await fs.rm(tempDir, { recursive: true, force: true }); - } catch { - } + } catch {} } -export async function withTempRepo( - userId: string, - repoName: string, - operation: (tempDir: string) => Promise, - syncBack: boolean = false -): Promise { +export async function withTempRepo(userId: string, repoName: string, operation: (tempDir: string) => Promise, syncBack: boolean = false): Promise { const tempDir = await syncR2ToLocal(userId, repoName); - + try { const result = await operation(tempDir); - + if (syncBack) { await syncLocalToR2(tempDir, userId, repoName); } - + return result; } finally { await cleanupTempDir(tempDir); } } - diff --git a/lib/r2.ts b/lib/r2.ts index e515fa7..2359408 100644 --- a/lib/r2.ts +++ b/lib/r2.ts @@ -95,4 +95,3 @@ export async function r2DeletePrefix(prefix: string): Promise { await r2Delete(key); } } - diff --git a/public/file.svg b/public/file.svg deleted file mode 100644 index 004145c..0000000 --- a/public/file.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/public/globe.svg b/public/globe.svg deleted file mode 100644 index 567f17b..0000000 --- a/public/globe.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/public/next.svg b/public/next.svg deleted file mode 100644 index 5174b28..0000000 --- a/public/next.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/public/vercel.svg b/public/vercel.svg deleted file mode 100644 index 7705396..0000000 --- a/public/vercel.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/public/window.svg b/public/window.svg deleted file mode 100644 index b2b2a44..0000000 --- a/public/window.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file