From 530e1a3d5da1df1070591115a03173d907930196 Mon Sep 17 00:00:00 2001 From: yuetsh <517252939@qq.com> Date: Mon, 26 Oct 2026 13:45:53 +0800 Subject: [PATCH] =?UTF-8?q?chore(=E6=A0=BC=E5=BC=8F=E5=8C=96):=20=E6=94=B9?= =?UTF-8?q?=E7=94=A8=20Bun=20=E8=87=AA=E5=B8=A6=E7=9A=84=20bun=20fmt?= =?UTF-8?q?=EF=BC=8C=E6=A0=BC=E5=BC=8F=E6=A3=80=E6=9F=A5=E4=BB=8E=202.7=20?= =?UTF-8?q?=E7=A7=92=E9=99=8D=E5=88=B0=200.1=20=E7=A7=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 5.5 --- CLAUDE.md | 12 +++++++----- apps/web/public/style.css | 14 ++------------ package.json | 4 ++-- vite.config.ts | 7 +++++-- 4 files changed, 16 insertions(+), 21 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index a1f48ec..906e788 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -48,8 +48,8 @@ bun run dev # api(3000) + worker + web(5173) 一起起 ```bash bunx vp run verify # 下面这些一次跑完,带缓存(没改过的直接跳过) -bun run check # 格式 + lint(vp check),不含类型检查 -bun run fmt # 格式化(Oxfmt),全仓一把 +bun run check # 格式检查 + lint,不含类型检查 +bun run fmt # 格式化(bun fmt),全仓一把 bun run lint # lint(Oxlint),有一条 warning 就算失败 bun run --filter '@oj2/api' typecheck # 后端类型检查 bun run --filter '@oj2/api' check:routes # 路由遮蔽检查,加完路由跑一下 @@ -58,9 +58,11 @@ cd apps/web && bun run type-check # 前端类型检查 cd apps/web && bun run build # 前端构建(不在 verify 里) ``` -**格式化、lint、任务编排都走 Vite+**(`vite-plus`,`vp` 命令),配置只有根目录的 -`vite.config.ts` 一份:`fmt` 块(Oxfmt,`semi: false`,行宽用默认的 100)、`lint` 块 -(Oxlint,`denyWarnings`)、`run.tasks`(`verify` 和它依赖的四个检查)。前端自己的构建 +**lint 和任务编排走 Vite+**(`vite-plus`,`vp` 命令),**格式化走 Bun 自带的 `bun fmt`**, +配置都只在根目录的 `vite.config.ts` 一份:`fmt` 块(Oxfmt 的写法,`bun fmt` 直接读它; +`semi: false`,行宽用默认的 100)、`lint` 块(Oxlint,`denyWarnings`)、`run.tasks` +(`verify` 和它依赖的四个检查)。**别用 `vp fmt` / `vp check`**:Oxfmt 和 `bun fmt` 只在 +长 CSS 值列表的折行上不一样,混着跑会把 `apps/web/public/style.css` 来回改。前端自己的构建 配置在 `apps/web/vite.config.ts`,和根目录那份无关。 - 格式化只管代码:`.md` / `.yml` / `.json` / `.toml` 在 `fmt.ignorePatterns` 里排掉了 diff --git a/apps/web/public/style.css b/apps/web/public/style.css index 6a41847..ce0a740 100644 --- a/apps/web/public/style.css +++ b/apps/web/public/style.css @@ -315,18 +315,8 @@ Naive UI 的 body 规则是运行时插进来的,晚于这份文件,所以这里用 html body 提一级优先级 */ html body { font-family: - "OJ Emoji Lead", - v-sans, - system-ui, - -apple-system, - BlinkMacSystemFont, - "Segoe UI", - sans-serif, - "Apple Color Emoji", - "Noto Color Emoji", - "OJ Emoji", - "Segoe UI Emoji", - "Segoe UI Symbol"; + "OJ Emoji Lead", v-sans, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif, + "Apple Color Emoji", "Noto Color Emoji", "OJ Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; } .md-editor-preview .md-editor-code .md-editor-code-head { diff --git a/package.json b/package.json index c97e333..ee727f2 100644 --- a/package.json +++ b/package.json @@ -15,8 +15,8 @@ "db:migrate": "bun run --filter '@oj2/api' db:migrate", "db:down": "docker compose -f docker/compose.dev.yml down", "lint": "vp lint", - "fmt": "vp fmt", - "check": "vp check" + "fmt": "bun fmt", + "check": "bun fmt --check && vp lint" }, "devDependencies": { "@types/bun": "1.4.4", diff --git a/vite.config.ts b/vite.config.ts index 7988951..cbe35d7 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,8 +1,11 @@ import { defineConfig } from "vite-plus" /** - * 全仓的格式化(Oxfmt)、lint(Oxlint)和任务编排(vp run)都在这一份里。 + * 全仓的格式化、lint(Oxlint)和任务编排(vp run)都在这一份里。 * 前端自己的构建配置在 apps/web/vite.config.ts,和这里无关。 + * + * 格式化由 `bun fmt` 来跑,它直接读下面的 fmt 块(Oxfmt 的写法)。别再用 `vp fmt`: + * 两边只在长的 CSS 值列表怎么折行上不一样,混着跑会来回改 apps/web/public/style.css。 */ export default defineConfig({ fmt: { @@ -49,7 +52,7 @@ export default defineConfig({ "check:ast": { command: "bun run check:ast", cwd: "apps/api" }, // 提交前、CI 里跑这一条:格式 + lint + 两边类型检查 + 路由遮蔽 + AST 节点 verify: { - command: "vp check", + command: "bun run check", dependsOn: ["typecheck:api", "typecheck:web", "check:routes", "check:ast"], }, },