From bd519e7082d64f3c4c5bbeb50e3f642061e90177 Mon Sep 17 00:00:00 2001 From: Jose Selesan Date: Thu, 15 Oct 2026 15:30:22 -0300 Subject: [PATCH] chore: replace oxlint with biome for linting --- .prettierignore | 2 + AGENTS.md | 12 +- README.md | 26 +- apps/api/.oxlintrc.json | 9 - apps/api/package.json | 5 +- apps/api/src/lib/validate.ts | 5 +- apps/web/.oxlintrc.json | 8 - apps/web/package.json | 3 +- apps/web/src/components/ui/alert.tsx | 39 +-- apps/web/src/components/ui/avatar.tsx | 64 ++-- apps/web/src/components/ui/badge.tsx | 36 +-- apps/web/src/components/ui/breadcrumb.tsx | 64 ++-- apps/web/src/components/ui/button.tsx | 48 +-- apps/web/src/components/ui/card.tsx | 59 ++-- apps/web/src/components/ui/checkbox.tsx | 22 +- apps/web/src/components/ui/dropdown-menu.tsx | 89 +++--- apps/web/src/components/ui/field.tsx | 116 +++---- apps/web/src/components/ui/input.tsx | 10 +- apps/web/src/components/ui/label.tsx | 15 +- apps/web/src/components/ui/select.tsx | 67 ++-- apps/web/src/components/ui/separator.tsx | 14 +- apps/web/src/components/ui/sheet.tsx | 65 ++-- apps/web/src/components/ui/sidebar.tsx | 293 ++++++++---------- apps/web/src/components/ui/skeleton.tsx | 6 +- apps/web/src/components/ui/sonner.tsx | 46 ++- apps/web/src/components/ui/switch.tsx | 16 +- apps/web/src/components/ui/table.tsx | 73 ++--- apps/web/src/components/ui/tabs.tsx | 50 ++- apps/web/src/components/ui/textarea.tsx | 10 +- apps/web/src/components/ui/tooltip.tsx | 18 +- apps/web/src/hooks/use-mobile.ts | 6 +- apps/web/src/lib/utils.ts | 2 +- apps/web/src/routes/(auth)/sign-in.tsx | 8 +- apps/web/src/routes/_authenticated/index.tsx | 11 +- .../src/routes/_authenticated/settings.tsx | 7 +- apps/web/src/routes/_authenticated/tasks.tsx | 11 +- apps/web/tsconfig.json | 5 +- biome.json | 49 +++ bun.lockb | Bin 334672 -> 329728 bytes package.json | 5 +- packages/shared/.oxlintrc.json | 9 - packages/shared/package.json | 5 +- packages/shared/src/problem-details.ts | 18 +- 43 files changed, 633 insertions(+), 793 deletions(-) delete mode 100644 apps/api/.oxlintrc.json delete mode 100644 apps/web/.oxlintrc.json create mode 100644 biome.json delete mode 100644 packages/shared/.oxlintrc.json diff --git a/.prettierignore b/.prettierignore index ec573b6..f47e836 100644 --- a/.prettierignore +++ b/.prettierignore @@ -3,4 +3,6 @@ dist coverage .turbo bun.lock +bun.lockb apps/web/src/routeTree.gen.ts +apps/api/src/generated diff --git a/AGENTS.md b/AGENTS.md index 8f0b063..d72c7cd 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -25,7 +25,12 @@ No CI, no database migrations and no product features yet. - Verification commands, run from the repo root: - `bun run build` - `bun run lint` → `bun run typecheck` → `bun run test` (in that order) -- Format with `bun run format` (Prettier). Linting uses **oxlint** in both apps. +- **Lint with Biome** (`biome.json` at the repo root, one config for every workspace): `bun run lint` + (per-package via turbo), `bun run lint:fix` (apply safe fixes), `bun run lint:ci` (whole repo, for CI). +- **Format with Prettier** (`bun run format`). Biome's formatter and assist are deliberately disabled in + `biome.json` so the two tools never fight each other. +- `apps/web/src/components/ui/**` is excluded from Biome's recommended preset through an `overrides` entry: + those files are vendored shadcn/ui source and get regenerated by the CLI. - Generated files are gitignored and must never be edited by hand: `apps/web/src/routeTree.gen.ts`, `apps/api/src/generated/`. @@ -119,8 +124,9 @@ apps/web/src/ `cd apps/web && ../../node_modules/.bin/shadcn add ` (this registry needs the `@shadcn/` prefix for some items, e.g. `@shadcn/field`). - `cn` comes from the `cn` package; `src/lib/utils.ts` re-exports it for local imports. -- Prefer small feature components over one large route file. Route files export the `Route` object (which is why - oxlint reports a fast-refresh warning on them — that warning is expected there). +- Prefer small feature components over one large route file. +- Biome does not flag the `Route` export of route files, so route files stay clean; only the vendored + `components/ui` files are exempted from the recommended preset. diff --git a/README.md b/README.md index 8907b66..34d6dfa 100644 --- a/README.md +++ b/README.md @@ -2,11 +2,11 @@ Monorepo with a Bun + Hono API and a React + Vite admin app. -| Workspace | What it is | -| ------------------ | ---------------------------------------------------------------------- | -| `apps/api` | Bun + Hono backend, Prisma (Postgres), Zod validation, Pino logging | -| `apps/web` | React + Vite + TypeScript frontend, shadcn/ui, TanStack Router + Query | -| `packages/shared` | `@superlist/shared` — Result pattern and RFC 9457 Problem Details types | +| Workspace | What it is | +| ----------------- | ----------------------------------------------------------------------- | +| `apps/api` | Bun + Hono backend, Prisma (Postgres), Zod validation, Pino logging | +| `apps/web` | React + Vite + TypeScript frontend, shadcn/ui, TanStack Router + Query | +| `packages/shared` | `@superlist/shared` — Result pattern and RFC 9457 Problem Details types | See `STACK.md` for the stack and `AGENTS.md` for the architecture conventions. @@ -41,19 +41,21 @@ Or a single workspace: `bun run dev --filter=@superlist/web`. ```bash bun run build # turbo run build -bun run lint # oxlint +bun run lint # biome check (per package) bun run typecheck # tsc bun run test # bun test (api) / vitest (web, shared) ``` ## Useful scripts -| Command | Effect | -| --------------------- | ------------------------------------------------------------- | -| `bun run db:generate` | Regenerate the Prisma client into `apps/api/src/generated` | -| `bun run db:migrate` | Create and apply a migration (development) | -| `bun run db:studio` | Open Prisma Studio | -| `bun run format` | Format the repo with Prettier | +| Command | Effect | +| --------------------- | ---------------------------------------------------------- | +| `bun run lint:fix` | Apply Biome's safe fixes across the repo | +| `bun run lint:ci` | `biome ci` — lint the whole repo exactly as CI would | +| `bun run format` | Format the repo with Prettier | +| `bun run db:generate` | Regenerate the Prisma client into `apps/api/src/generated` | +| `bun run db:migrate` | Create and apply a migration (development) | +| `bun run db:studio` | Open Prisma Studio | ## Auth diff --git a/apps/api/.oxlintrc.json b/apps/api/.oxlintrc.json deleted file mode 100644 index 6291a13..0000000 --- a/apps/api/.oxlintrc.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "$schema": "./node_modules/oxlint/configuration_schema.json", - "plugins": ["typescript", "oxc"], - "categories": { - "correctness": "error", - "suspicious": "warn" - }, - "ignorePatterns": ["src/generated"] -} diff --git a/apps/api/package.json b/apps/api/package.json index d9565fa..b9ee11e 100644 --- a/apps/api/package.json +++ b/apps/api/package.json @@ -7,7 +7,7 @@ "dev": "bun run --watch src/index.ts", "build": "bun build src/index.ts --target bun --outdir dist", "start": "bun run dist/index.js", - "lint": "oxlint", + "lint": "biome check .", "typecheck": "tsc --noEmit", "test": "bun test", "db:generate": "prisma generate", @@ -32,7 +32,6 @@ "@types/pg": "^8.23.1", "dotenv": "^18.0.7", "prisma": "^7.10.0", - "typescript": "~6.0.2", - "oxlint": "^1.81.0" + "typescript": "~6.0.2" } } diff --git a/apps/api/src/lib/validate.ts b/apps/api/src/lib/validate.ts index eb33196..bdb002e 100644 --- a/apps/api/src/lib/validate.ts +++ b/apps/api/src/lib/validate.ts @@ -14,7 +14,10 @@ const onInvalid: Hook = (result, c: Context) => { for (const issue of (result.error as ZodError).issues) { const path = issue.path.length > 0 ? issue.path.map(String).join('.') : '_root' - ;(fieldErrors[path] ??= []).push(issue.message) + const messages = fieldErrors[path] ?? [] + + messages.push(issue.message) + fieldErrors[path] = messages } return c.body(JSON.stringify(problems.validation(fieldErrors)), 422, { diff --git a/apps/web/.oxlintrc.json b/apps/web/.oxlintrc.json deleted file mode 100644 index 6fa991d..0000000 --- a/apps/web/.oxlintrc.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "$schema": "./node_modules/oxlint/configuration_schema.json", - "plugins": ["react", "typescript", "oxc"], - "rules": { - "react/rules-of-hooks": "error", - "react/only-export-components": ["warn", { "allowConstantExport": true }] - } -} diff --git a/apps/web/package.json b/apps/web/package.json index 94b92bd..0628d1a 100644 --- a/apps/web/package.json +++ b/apps/web/package.json @@ -8,7 +8,7 @@ "dev": "tsr generate && vite", "build": "tsr generate && tsc -b && vite build", "preview": "vite preview", - "lint": "oxlint", + "lint": "biome check .", "typecheck": "tsr generate && tsc -b", "test": "vitest run --passWithNoTests" }, @@ -44,7 +44,6 @@ "@types/react": "^19.2.18", "@types/react-dom": "^19.2.7", "@vitejs/plugin-react": "^6.1.1", - "oxlint": "^1.81.0", "shadcn": "^4.21.4", "tailwindcss": "^4.3.3", "tw-animate-css": "^1.4.0", diff --git a/apps/web/src/components/ui/alert.tsx b/apps/web/src/components/ui/alert.tsx index 17ba728..b232628 100644 --- a/apps/web/src/components/ui/alert.tsx +++ b/apps/web/src/components/ui/alert.tsx @@ -1,28 +1,28 @@ -import * as React from "react" -import { cva, type VariantProps } from "class-variance-authority" -import { cn } from "cn" +import * as React from 'react' +import { cva, type VariantProps } from 'class-variance-authority' +import { cn } from 'cn' const alertVariants = cva( "group/alert relative grid w-full gap-0.5 rounded-lg border px-2.5 py-2 text-left text-sm has-data-[slot=alert-action]:relative has-data-[slot=alert-action]:pr-18 has-[>svg]:grid-cols-[auto_1fr] has-[>svg]:gap-x-2 *:[svg]:row-span-2 *:[svg]:translate-y-0.5 *:[svg]:text-current *:[svg:not([class*='size-'])]:size-4", { variants: { variant: { - default: "bg-card text-card-foreground", + default: 'bg-card text-card-foreground', destructive: - "bg-card text-destructive *:data-[slot=alert-description]:text-destructive/90 *:[svg]:text-current", + 'bg-card text-destructive *:data-[slot=alert-description]:text-destructive/90 *:[svg]:text-current', }, }, defaultVariants: { - variant: "default", + variant: 'default', }, - } + }, ) function Alert({ className, variant, ...props -}: React.ComponentProps<"div"> & VariantProps) { +}: React.ComponentProps<'div'> & VariantProps) { return (
) { +function AlertTitle({ className, ...props }: React.ComponentProps<'div'>) { return (
svg]/alert:col-start-2 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground", - className + 'font-medium group-has-[>svg]/alert:col-start-2 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground', + className, )} {...props} /> ) } -function AlertDescription({ - className, - ...props -}: React.ComponentProps<"div">) { +function AlertDescription({ className, ...props }: React.ComponentProps<'div'>) { return (
) } -function AlertAction({ className, ...props }: React.ComponentProps<"div">) { +function AlertAction({ className, ...props }: React.ComponentProps<'div'>) { return ( -
+
) } diff --git a/apps/web/src/components/ui/avatar.tsx b/apps/web/src/components/ui/avatar.tsx index 89328b4..5a3cf8f 100644 --- a/apps/web/src/components/ui/avatar.tsx +++ b/apps/web/src/components/ui/avatar.tsx @@ -1,38 +1,32 @@ -import * as React from "react" -import { cn } from "cn" -import { Avatar as AvatarPrimitive } from "radix-ui" +import * as React from 'react' +import { cn } from 'cn' +import { Avatar as AvatarPrimitive } from 'radix-ui' function Avatar({ className, - size = "default", + size = 'default', ...props }: React.ComponentProps & { - size?: "default" | "sm" | "lg" + size?: 'default' | 'sm' | 'lg' }) { return ( ) } -function AvatarImage({ - className, - ...props -}: React.ComponentProps) { +function AvatarImage({ className, ...props }: React.ComponentProps) { return ( ) @@ -46,64 +40,54 @@ function AvatarFallback({ ) } -function AvatarBadge({ className, ...props }: React.ComponentProps<"span">) { +function AvatarBadge({ className, ...props }: React.ComponentProps<'span'>) { return ( svg]:hidden", - "group-data-[size=default]/avatar:size-2.5 group-data-[size=default]/avatar:[&>svg]:size-2", - "group-data-[size=lg]/avatar:size-3 group-data-[size=lg]/avatar:[&>svg]:size-2", - className + 'absolute right-0 bottom-0 z-10 inline-flex items-center justify-center rounded-full bg-primary text-primary-foreground bg-blend-color ring-2 ring-background select-none', + 'group-data-[size=sm]/avatar:size-2 group-data-[size=sm]/avatar:[&>svg]:hidden', + 'group-data-[size=default]/avatar:size-2.5 group-data-[size=default]/avatar:[&>svg]:size-2', + 'group-data-[size=lg]/avatar:size-3 group-data-[size=lg]/avatar:[&>svg]:size-2', + className, )} {...props} /> ) } -function AvatarGroup({ className, ...props }: React.ComponentProps<"div">) { +function AvatarGroup({ className, ...props }: React.ComponentProps<'div'>) { return (
) } -function AvatarGroupCount({ - className, - ...props -}: React.ComponentProps<"div">) { +function AvatarGroupCount({ className, ...props }: React.ComponentProps<'div'>) { return (
svg]:size-4 group-has-data-[size=lg]/avatar-group:[&>svg]:size-5 group-has-data-[size=sm]/avatar-group:[&>svg]:size-3", - className + 'relative flex size-8 shrink-0 items-center justify-center rounded-full bg-muted text-sm text-muted-foreground ring-2 ring-background group-has-data-[size=lg]/avatar-group:size-10 group-has-data-[size=sm]/avatar-group:size-6 [&>svg]:size-4 group-has-data-[size=lg]/avatar-group:[&>svg]:size-5 group-has-data-[size=sm]/avatar-group:[&>svg]:size-3', + className, )} {...props} /> ) } -export { - Avatar, - AvatarImage, - AvatarFallback, - AvatarGroup, - AvatarGroupCount, - AvatarBadge, -} +export { Avatar, AvatarImage, AvatarFallback, AvatarGroup, AvatarGroupCount, AvatarBadge } diff --git a/apps/web/src/components/ui/badge.tsx b/apps/web/src/components/ui/badge.tsx index 837196c..bae30bb 100644 --- a/apps/web/src/components/ui/badge.tsx +++ b/apps/web/src/components/ui/badge.tsx @@ -1,39 +1,35 @@ -import * as React from "react" -import { cva, type VariantProps } from "class-variance-authority" -import { cn } from "cn" -import { Slot } from "radix-ui" +import * as React from 'react' +import { cva, type VariantProps } from 'class-variance-authority' +import { cn } from 'cn' +import { Slot } from 'radix-ui' const badgeVariants = cva( - "group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!", + 'group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!', { variants: { variant: { - default: "bg-primary text-primary-foreground [a]:hover:bg-primary/80", - secondary: - "bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80", + default: 'bg-primary text-primary-foreground [a]:hover:bg-primary/80', + secondary: 'bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80', destructive: - "bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20", - outline: - "border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground", - ghost: - "hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50", - link: "text-primary underline-offset-4 hover:underline", + 'bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20', + outline: 'border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground', + ghost: 'hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50', + link: 'text-primary underline-offset-4 hover:underline', }, }, defaultVariants: { - variant: "default", + variant: 'default', }, - } + }, ) function Badge({ className, - variant = "default", + variant = 'default', asChild = false, ...props -}: React.ComponentProps<"span"> & - VariantProps & { asChild?: boolean }) { - const Comp = asChild ? Slot.Root : "span" +}: React.ComponentProps<'span'> & VariantProps & { asChild?: boolean }) { + const Comp = asChild ? Slot.Root : 'span' return ( ) { - return ( -