diff --git a/src/index.spec.ts b/src/index.spec.ts index 7266449..eda72ef 100644 --- a/src/index.spec.ts +++ b/src/index.spec.ts @@ -1,16 +1,16 @@ import { DrizzleD1Database } from "drizzle-orm/d1"; import { beforeEach, describe, expect, it, vi } from "vitest"; import app from "./index"; -import { +import type { getMessagesByRoomId, insertMessage, } from "./repositories/message-repository"; import { getAllRooms, - getRoom, - insertRoom, + type getRoom, + type insertRoom, } from "./repositories/room-repository"; -import { fetchCompletion } from "./utils/openai-client"; +import type { fetchCompletion } from "./utils/openai-client"; const MOCK_BINDINGS = { USERNAME: "test", diff --git a/src/index.tsx b/src/index.tsx index 2099d00..54d2396 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -14,7 +14,7 @@ import { insertRoom, updateRoom, } from "./repositories/room-repository"; -import { Messages } from "./schema"; +import type { Messages } from "./schema"; import type { AppEnv } from "./types"; import { parseMarkdown } from "./utils/markdown"; import { fetchCompletion } from "./utils/openai-client"; diff --git a/src/middleware/basic-auth.ts b/src/middleware/basic-auth.ts index 48a0824..8aee77f 100644 --- a/src/middleware/basic-auth.ts +++ b/src/middleware/basic-auth.ts @@ -1,7 +1,7 @@ import { basicAuth } from "hono/basic-auth"; import { createMiddleware } from "hono/factory"; -import { AppEnv } from "../types"; +import type { AppEnv } from "../types"; export const BasicAuthMiddleware = createMiddleware(async (c, next) => { const auth = basicAuth({ diff --git a/src/middleware/openai.ts b/src/middleware/openai.ts index c5faf4f..0a33b17 100644 --- a/src/middleware/openai.ts +++ b/src/middleware/openai.ts @@ -1,6 +1,6 @@ import { createMiddleware } from "hono/factory"; import OpenAI from "openai"; -import { AppEnv } from "../types"; +import type { AppEnv } from "../types"; export const OpenaiMiddleware = createMiddleware(async (c, next) => { const client = new OpenAI({ diff --git a/src/repositories/message-repository.ts b/src/repositories/message-repository.ts index 2e47566..f310702 100644 --- a/src/repositories/message-repository.ts +++ b/src/repositories/message-repository.ts @@ -1,5 +1,5 @@ import { eq } from "drizzle-orm"; -import { DrizzleD1Database } from "drizzle-orm/d1"; +import type { DrizzleD1Database } from "drizzle-orm/d1"; import { Messages } from "../schema"; export const insertMessage = async ( diff --git a/src/repositories/room-repository.ts b/src/repositories/room-repository.ts index db60d55..1281e90 100644 --- a/src/repositories/room-repository.ts +++ b/src/repositories/room-repository.ts @@ -1,5 +1,5 @@ import { desc, eq } from "drizzle-orm"; -import { DrizzleD1Database } from "drizzle-orm/d1"; +import type { DrizzleD1Database } from "drizzle-orm/d1"; import { Rooms } from "../schema"; export const insertRoom = async (db: DrizzleD1Database, roomId: string) => { diff --git a/src/types/index.d.ts b/src/types/index.d.ts index c53a0a1..e2b32d0 100644 --- a/src/types/index.d.ts +++ b/src/types/index.d.ts @@ -1,4 +1,4 @@ -import OpenAI from "openai"; +import type OpenAI from "openai"; export type Bindings = { USERNAME: string; diff --git a/src/utils/format-tilte.spec.ts b/src/utils/format-tilte.spec.ts index a06373c..126c1f6 100644 --- a/src/utils/format-tilte.spec.ts +++ b/src/utils/format-tilte.spec.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "vitest"; -import { Rooms } from "../schema"; +import type { Rooms } from "../schema"; import { formatTitle } from "./format-tilte"; describe("formatTitle", () => { diff --git a/src/utils/format-tilte.ts b/src/utils/format-tilte.ts index a58e608..f52c49c 100644 --- a/src/utils/format-tilte.ts +++ b/src/utils/format-tilte.ts @@ -1,4 +1,4 @@ -import { Rooms } from "../schema"; +import type { Rooms } from "../schema"; export const formatTitle = (room: typeof Rooms.$inferSelect, len = 20) => { if (!room.roomTitle) { diff --git a/src/utils/openai-client.ts b/src/utils/openai-client.ts index 479c325..959fc6d 100644 --- a/src/utils/openai-client.ts +++ b/src/utils/openai-client.ts @@ -1,4 +1,4 @@ -import OpenAI from "openai"; +import type OpenAI from "openai"; import type { ChatCompletionMessageParam } from "openai/resources"; export const fetchCompletion = async ( diff --git a/src/views/Layout.tsx b/src/views/Layout.tsx index 0dfd1e5..b443d0c 100644 --- a/src/views/Layout.tsx +++ b/src/views/Layout.tsx @@ -1,4 +1,4 @@ -import { FC } from "hono/dist/types/jsx"; +import type { FC } from "hono/dist/types/jsx"; export const Layout: FC = ({ children }) => ( diff --git a/src/views/NotFound.tsx b/src/views/NotFound.tsx index f9b969b..592daca 100644 --- a/src/views/NotFound.tsx +++ b/src/views/NotFound.tsx @@ -1,4 +1,4 @@ -import { FC } from "hono/dist/types/jsx"; +import type { FC } from "hono/dist/types/jsx"; type Props = { message?: string }; diff --git a/src/views/Room.tsx b/src/views/Room.tsx index 6cf06ec..f06f441 100644 --- a/src/views/Room.tsx +++ b/src/views/Room.tsx @@ -1,5 +1,5 @@ -import { FC } from "hono/dist/types/jsx"; -import { Messages, Rooms } from "../schema"; +import type { FC } from "hono/dist/types/jsx"; +import type { Messages, Rooms } from "../schema"; import { formatTitle } from "../utils/format-tilte"; type Props = { @@ -30,7 +30,7 @@ export const Room: FC<{ props: Props }> = ({ props }) => (
{props.message.length === 0 &&

No messages.

} {props.message.map((message) => ( -
+

{message.messageCreated}

{message.sender}

{/* biome-ignore lint: lint/security/noDangerouslySetInnerHtml */} diff --git a/src/views/RoomList.tsx b/src/views/RoomList.tsx index 30d6bd0..ba56673 100644 --- a/src/views/RoomList.tsx +++ b/src/views/RoomList.tsx @@ -1,5 +1,5 @@ -import { FC } from "hono/dist/types/jsx"; -import { Rooms } from "../schema"; +import type { FC } from "hono/dist/types/jsx"; +import type { Rooms } from "../schema"; import { formatTitle } from "../utils/format-tilte"; type Props = { @@ -21,7 +21,7 @@ export const RoomList: FC<{ props: Props }> = ({ props }) => ( {props.rooms.map((room) => ( - + {formatTitle(room)} {room.roomCreated} {room.roomUpdated} diff --git a/src/views/Top.tsx b/src/views/Top.tsx index c7e6bc6..c5c8c7c 100644 --- a/src/views/Top.tsx +++ b/src/views/Top.tsx @@ -1,4 +1,4 @@ -import { FC } from "hono/dist/types/jsx"; +import type { FC } from "hono/dist/types/jsx"; export const Top: FC = () => ( <>