From 431eb919b5183cb3b9cf8857baef81ecb32a6f84 Mon Sep 17 00:00:00 2001 From: josh <144584931+dancer@users.noreply.github.com> Date: Mon, 8 Sep 2025 21:02:06 +0100 Subject: [PATCH] fix: lint workflow (#1167) --- .github/workflows/lint.yml | 1 - app/(auth)/login/page.tsx | 2 +- app/(auth)/register/page.tsx | 2 +- app/(chat)/api/chat/route.ts | 2 +- components/chat.tsx | 2 +- components/elements/branch.tsx | 7 +++++-- components/elements/image.tsx | 1 + components/elements/message.tsx | 2 +- components/elements/source.tsx | 4 ++-- components/elements/web-preview.tsx | 2 +- components/message.tsx | 2 +- components/messages.tsx | 4 ++-- components/multimodal-input.tsx | 4 ++-- components/preview-attachment.tsx | 13 ++++++++----- lib/ai/models.mock.ts | 2 +- 15 files changed, 28 insertions(+), 22 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index e24fc77..1d57a67 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -23,4 +23,3 @@ jobs: run: pnpm install - name: Run lint run: pnpm lint -1 \ No newline at end of file diff --git a/app/(auth)/login/page.tsx b/app/(auth)/login/page.tsx index 33e9e82..e5be52a 100644 --- a/app/(auth)/login/page.tsx +++ b/app/(auth)/login/page.tsx @@ -42,7 +42,7 @@ export default function Page() { updateSession(); router.refresh(); } - }, [state.status]); + }, [state.status, router, updateSession]); const handleSubmit = (formData: FormData) => { setEmail(formData.get('email') as string); diff --git a/app/(auth)/register/page.tsx b/app/(auth)/register/page.tsx index ab2ee82..ce3e0c4 100644 --- a/app/(auth)/register/page.tsx +++ b/app/(auth)/register/page.tsx @@ -43,7 +43,7 @@ export default function Page() { updateSession(); router.refresh(); } - }, [state]); + }, [state, router, updateSession]); const handleSubmit = (formData: FormData) => { setEmail(formData.get('email') as string); diff --git a/app/(chat)/api/chat/route.ts b/app/(chat)/api/chat/route.ts index 002b9a4..9c6a84f 100644 --- a/app/(chat)/api/chat/route.ts +++ b/app/(chat)/api/chat/route.ts @@ -2,7 +2,7 @@ import { convertToModelMessages, createUIMessageStream, JsonToSseTransformStream, - LanguageModelUsage, + type LanguageModelUsage, smoothStream, stepCountIs, streamText, diff --git a/components/chat.tsx b/components/chat.tsx index 7c36512..711616f 100644 --- a/components/chat.tsx +++ b/components/chat.tsx @@ -1,6 +1,6 @@ 'use client'; -import { DefaultChatTransport, LanguageModelUsage } from 'ai'; +import { DefaultChatTransport, type LanguageModelUsage } from 'ai'; import { useChat } from '@ai-sdk/react'; import { useEffect, useState } from 'react'; import useSWR, { useSWRConfig } from 'swr'; diff --git a/components/elements/branch.tsx b/components/elements/branch.tsx index dbb8f64..b730e18 100644 --- a/components/elements/branch.tsx +++ b/components/elements/branch.tsx @@ -5,7 +5,7 @@ import { cn } from '@/lib/utils'; import type { UIMessage } from 'ai'; import { ChevronLeftIcon, ChevronRightIcon } from 'lucide-react'; import type { ComponentProps, HTMLAttributes, ReactElement } from 'react'; -import { createContext, useContext, useEffect, useState } from 'react'; +import { createContext, useContext, useEffect, useState, useMemo } from 'react'; type BranchContextType = { currentBranch: number; @@ -82,7 +82,10 @@ export type BranchMessagesProps = HTMLAttributes; export const BranchMessages = ({ children, ...props }: BranchMessagesProps) => { const { currentBranch, setBranches, branches } = useBranch(); - const childrenArray = Array.isArray(children) ? children : [children]; + const childrenArray = useMemo(() => + Array.isArray(children) ? children : [children], + [children] + ); // Use useEffect to update branches when they change useEffect(() => { diff --git a/components/elements/image.tsx b/components/elements/image.tsx index 011fdf5..cff42cf 100644 --- a/components/elements/image.tsx +++ b/components/elements/image.tsx @@ -12,6 +12,7 @@ export const Image = ({ mediaType, ...props }: ImageProps) => ( + // eslint-disable-next-line @next/next/no-img-element {props.alt} ( - + {name?.slice(0, 2) || 'ME'} ); diff --git a/components/elements/source.tsx b/components/elements/source.tsx index 4fdad35..4165e10 100644 --- a/components/elements/source.tsx +++ b/components/elements/source.tsx @@ -32,7 +32,7 @@ export const SourcesTrigger = ({ {children ?? ( <>

Used {count} sources

- + )} @@ -66,7 +66,7 @@ export const Source = ({ href, title, children, ...props }: SourceProps) => ( > {children ?? ( <> - + {title} )} diff --git a/components/elements/web-preview.tsx b/components/elements/web-preview.tsx index 6b5e8f3..a4bcf5b 100644 --- a/components/elements/web-preview.tsx +++ b/components/elements/web-preview.tsx @@ -107,7 +107,7 @@ export const WebPreviewNavigationButton = ({ )} -
+
{name}
diff --git a/lib/ai/models.mock.ts b/lib/ai/models.mock.ts index 97ce212..a849cb5 100644 --- a/lib/ai/models.mock.ts +++ b/lib/ai/models.mock.ts @@ -1,4 +1,4 @@ -import { type LanguageModel } from 'ai'; +import type { LanguageModel } from 'ai'; const createMockModel = (): LanguageModel => { return {