From 150eb1ff63278e1b428307fe04ad185fbeb3f86d Mon Sep 17 00:00:00 2001 From: Dayuan Jiang <34411969+DayuanJiang@users.noreply.github.com> Date: Sat, 6 Dec 2025 12:46:40 +0900 Subject: [PATCH] chore: add Biome for formatting and linting (#116) - Add Biome as formatter and linter (replaces Prettier) - Configure Husky + lint-staged for pre-commit hooks - Add VS Code settings for format on save - Ignore components/ui/ (shadcn generated code) - Remove semicolons, use 4-space indent - Reformat all files to new style --- .eslintrc.json | 5 +- .husky/pre-commit | 1 + .vscode/settings.json | 23 + app/about/cn/page.tsx | 227 +++++-- app/about/ja/page.tsx | 254 ++++++-- app/about/page.tsx | 276 ++++++-- app/api/chat/route.ts | 507 ++++++++------- app/api/config/route.ts | 13 +- app/api/log-feedback/route.ts | 201 +++--- app/api/log-save/route.ts | 122 ++-- app/globals.css | 350 +++++----- app/layout.tsx | 68 +- app/page.tsx | 97 +-- app/robots.ts | 10 +- app/sitemap.ts | 10 +- biome.json | 59 ++ components.json | 40 +- components/button-with-tooltip.tsx | 20 +- components/chat-example-panel.tsx | 55 +- components/chat-input.tsx | 315 +++++---- components/chat-message-display.tsx | 575 +++++++++++------ components/chat-panel.tsx | 331 +++++----- components/code-block.tsx | 32 +- components/error-toast.tsx | 23 +- components/file-preview-list.tsx | 36 +- components/history-dialog.tsx | 39 +- components/reset-warning-modal.tsx | 14 +- components/save-dialog.tsx | 73 ++- components/settings-dialog.tsx | 53 +- contexts/diagram-context.tsx | 204 +++--- instrumentation.ts | 62 +- lib/ai-providers.ts | 398 ++++++------ lib/cached-responses.ts | 62 +- lib/langfuse.ts | 132 ++-- lib/system-prompts.ts | 39 +- lib/utils.ts | 959 +++++++++++++++------------- next.config.ts | 10 +- package-lock.json | 610 ++++++++++++++++++ package.json | 14 +- postcss.config.mjs | 6 +- tsconfig.json | 68 +- 41 files changed, 3992 insertions(+), 2401 deletions(-) create mode 100644 .husky/pre-commit create mode 100644 .vscode/settings.json create mode 100644 biome.json diff --git a/.eslintrc.json b/.eslintrc.json index 6b10a5b..98ef693 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,6 +1,3 @@ { - "extends": [ - "next/core-web-vitals", - "next/typescript" - ] + "extends": ["next/core-web-vitals", "next/typescript"] } diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100644 index 0000000..2312dc5 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1 @@ +npx lint-staged diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..c1c5363 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,23 @@ +{ + "editor.formatOnSave": true, + "editor.defaultFormatter": "biomejs.biome", + "editor.codeActionsOnSave": { + "source.fixAll.biome": "explicit", + "source.organizeImports.biome": "explicit" + }, + "[javascript]": { + "editor.defaultFormatter": "biomejs.biome" + }, + "[typescript]": { + "editor.defaultFormatter": "biomejs.biome" + }, + "[javascriptreact]": { + "editor.defaultFormatter": "biomejs.biome" + }, + "[typescriptreact]": { + "editor.defaultFormatter": "biomejs.biome" + }, + "[json]": { + "editor.defaultFormatter": "biomejs.biome" + } +} diff --git a/app/about/cn/page.tsx b/app/about/cn/page.tsx index 3ff30a0..4d0534e 100644 --- a/app/about/cn/page.tsx +++ b/app/about/cn/page.tsx @@ -1,13 +1,14 @@ -import type { Metadata } from "next"; -import Link from "next/link"; -import { FaGithub } from "react-icons/fa"; -import Image from "next/image"; +import type { Metadata } from "next" +import Image from "next/image" +import Link from "next/link" +import { FaGithub } from "react-icons/fa" export const metadata: Metadata = { title: "关于 - Next AI Draw.io", - description: "AI驱动的图表创建工具 - 对话、绘制、可视化。使用自然语言创建AWS、GCP和Azure架构图。", + description: + "AI驱动的图表创建工具 - 对话、绘制、可视化。使用自然语言创建AWS、GCP和Azure架构图。", keywords: ["AI图表", "draw.io", "AWS架构", "GCP图表", "Azure图表", "LLM"], -}; +} export default function AboutCN() { return ( @@ -16,14 +17,23 @@ export default function AboutCN() {
- + Next AI Draw.io