From 9324ec69454d8ed663af481c784ea37e12b32eb4 Mon Sep 17 00:00:00 2001 From: Jared Palmer Date: Fri, 15 Nov 2024 12:45:51 -0500 Subject: [PATCH 1/2] Switch to vercel's biome setuo --- app/(auth)/actions.ts | 4 +- app/(auth)/auth.ts | 5 +- app/(auth)/login/page.tsx | 2 +- app/(auth)/register/page.tsx | 2 +- app/(chat)/actions.ts | 2 +- app/(chat)/api/chat/route.ts | 4 +- app/(chat)/api/files/upload/route.ts | 4 +- app/(chat)/chat/[id]/page.tsx | 2 +- app/layout.tsx | 1 - biome.json | 58 ------------ biome.jsonc | 131 +++++++++++++++++++++++++++ components/app-sidebar.tsx | 9 +- components/block-stream-handler.tsx | 2 +- components/block.tsx | 20 ++-- components/chat.tsx | 2 +- components/diffview.tsx | 4 +- components/editor.tsx | 12 +-- components/markdown.tsx | 2 +- components/message-actions.tsx | 8 +- components/message.tsx | 4 +- components/model-selector.tsx | 4 +- components/multimodal-input.tsx | 12 +-- components/sidebar-history.tsx | 2 +- components/sidebar-toggle.tsx | 1 - components/suggestion.tsx | 5 +- components/toolbar.tsx | 11 +-- components/ui/alert-dialog.tsx | 10 +- components/ui/button.tsx | 4 +- components/ui/card.tsx | 4 +- components/ui/dropdown-menu.tsx | 14 +-- components/ui/input.tsx | 4 +- components/ui/label.tsx | 2 +- components/ui/select.tsx | 12 +-- components/ui/separator.tsx | 6 +- components/ui/sheet.tsx | 8 +- components/ui/sidebar.tsx | 54 ++++++----- components/ui/textarea.tsx | 4 +- components/ui/tooltip.tsx | 2 +- components/version-footer.tsx | 12 +-- components/weather.tsx | 16 ++-- drizzle.config.ts | 1 + hooks/use-mobile.tsx | 2 +- lib/db/queries.ts | 10 +- lib/db/schema.ts | 6 +- lib/editor/config.ts | 2 +- lib/editor/diff.js | 42 ++++----- lib/editor/functions.tsx | 10 +- lib/editor/suggestions.tsx | 8 +- lib/utils.ts | 18 ++-- package.json | 2 +- 50 files changed, 324 insertions(+), 242 deletions(-) delete mode 100644 biome.json create mode 100644 biome.jsonc diff --git a/app/(auth)/actions.ts b/app/(auth)/actions.ts index c2a5afe74..84f8ffde4 100644 --- a/app/(auth)/actions.ts +++ b/app/(auth)/actions.ts @@ -17,7 +17,7 @@ export interface LoginActionState { export const login = async ( _: LoginActionState, - formData: FormData + formData: FormData, ): Promise => { try { const validatedData = authFormSchema.parse({ @@ -53,7 +53,7 @@ export interface RegisterActionState { export const register = async ( _: RegisterActionState, - formData: FormData + formData: FormData, ): Promise => { try { const validatedData = authFormSchema.parse({ diff --git a/app/(auth)/auth.ts b/app/(auth)/auth.ts index 3d8e738e9..d8a436988 100644 --- a/app/(auth)/auth.ts +++ b/app/(auth)/auth.ts @@ -20,12 +20,12 @@ export const { providers: [ Credentials({ credentials: {}, - // biome-ignore lint/suspicious/noExplicitAny: TODO async authorize({ email, password }: any) { const users = await getUser(email); if (users.length === 0) return null; + // biome-ignore lint: Forbidden non-null assertion. const passwordsMatch = await compare(password, users[0].password!); - // biome-ignore lint/suspicious/noExplicitAny: TODO + if (!passwordsMatch) return null; return users[0] as any; }, }), @@ -43,7 +43,6 @@ export const { token, }: { session: ExtendedSession; - // biome-ignore lint/suspicious/noExplicitAny: TODO token: any; }) { if (session.user) { diff --git a/app/(auth)/login/page.tsx b/app/(auth)/login/page.tsx index e1577dc92..7ff4c73e0 100644 --- a/app/(auth)/login/page.tsx +++ b/app/(auth)/login/page.tsx @@ -20,7 +20,7 @@ export default function Page() { login, { status: 'idle', - } + }, ); useEffect(() => { diff --git a/app/(auth)/register/page.tsx b/app/(auth)/register/page.tsx index df8258350..69e079b5f 100644 --- a/app/(auth)/register/page.tsx +++ b/app/(auth)/register/page.tsx @@ -20,7 +20,7 @@ export default function Page() { register, { status: 'idle', - } + }, ); useEffect(() => { diff --git a/app/(chat)/actions.ts b/app/(chat)/actions.ts index 2b19fc982..0d4b2c996 100644 --- a/app/(chat)/actions.ts +++ b/app/(chat)/actions.ts @@ -1,6 +1,6 @@ 'use server'; -import { CoreMessage, type CoreUserMessage, generateText } from 'ai'; +import { type CoreUserMessage, generateText } from 'ai'; import { cookies } from 'next/headers'; import { customModel } from '@/lib/ai'; diff --git a/app/(chat)/api/chat/route.ts b/app/(chat)/api/chat/route.ts index bf5c5bc1a..2e66effe0 100644 --- a/app/(chat)/api/chat/route.ts +++ b/app/(chat)/api/chat/route.ts @@ -104,7 +104,7 @@ export async function POST(request: Request) { }), execute: async ({ latitude, longitude }) => { const response = await fetch( - `https://api.open-meteo.com/v1/forecast?latitude=${latitude}&longitude=${longitude}¤t=temperature_2m&hourly=temperature_2m&daily=sunrise,sunset&timezone=auto` + `https://api.open-meteo.com/v1/forecast?latitude=${latitude}&longitude=${longitude}¤t=temperature_2m&hourly=temperature_2m&daily=sunrise,sunset&timezone=auto`, ); const weatherData = await response.json(); @@ -350,7 +350,7 @@ export async function POST(request: Request) { content: message.content, createdAt: new Date(), }; - } + }, ), }); } catch (error) { diff --git a/app/(chat)/api/files/upload/route.ts b/app/(chat)/api/files/upload/route.ts index b753750e5..8da795db3 100644 --- a/app/(chat)/api/files/upload/route.ts +++ b/app/(chat)/api/files/upload/route.ts @@ -16,7 +16,7 @@ const FileSchema = z.object({ ['image/jpeg', 'image/png', 'application/pdf'].includes(file.type), { message: 'File type should be JPEG, PNG, or PDF', - } + }, ), }); @@ -65,7 +65,7 @@ export async function POST(request: Request) { } catch (error) { return NextResponse.json( { error: 'Failed to process request' }, - { status: 500 } + { status: 500 }, ); } } diff --git a/app/(chat)/chat/[id]/page.tsx b/app/(chat)/chat/[id]/page.tsx index 839bc7d16..5d5b06208 100644 --- a/app/(chat)/chat/[id]/page.tsx +++ b/app/(chat)/chat/[id]/page.tsx @@ -1,4 +1,4 @@ -import { CoreMessage } from 'ai'; + import { cookies } from 'next/headers'; import { notFound } from 'next/navigation'; diff --git a/app/layout.tsx b/app/layout.tsx index d0d4c4577..287847fb3 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -51,7 +51,6 @@ export default async function RootLayout({ >