From 03425cd6efc89baceef5268719ddf6bacde87216 Mon Sep 17 00:00:00 2001 From: haotool Date: Wed, 14 Jan 2026 02:29:02 +0800 Subject: [PATCH] =?UTF-8?q?fix(quake-school):=20=E4=BF=AE=E5=BE=A9=20TypeS?= =?UTF-8?q?cript=20=E9=A1=9E=E5=9E=8B=E9=8C=AF=E8=AA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 移除 tsconfig.json 中過度限制的 `types` 配置 - 讓 TypeScript 自動包含 node_modules/@types 下的所有類型 - 根因:`types: ["node", "vitest/globals"]` 阻止了 @types/react 的識別 驗證:pnpm -r typecheck 4 個應用全部通過 [context7:/websites/typescriptlang:2026-01-14] --- apps/quake-school/tsconfig.json | 3 +-- docs/dev/002_development_reward_penalty_log.md | 5 +++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/quake-school/tsconfig.json b/apps/quake-school/tsconfig.json index e80cf9d3..ead60ef8 100644 --- a/apps/quake-school/tsconfig.json +++ b/apps/quake-school/tsconfig.json @@ -19,8 +19,7 @@ "baseUrl": ".", "paths": { "@app/quake-school/*": ["./src/*"] - }, - "types": ["node", "vitest/globals"] + } }, "include": ["src"], "references": [{ "path": "./tsconfig.node.json" }] diff --git a/docs/dev/002_development_reward_penalty_log.md b/docs/dev/002_development_reward_penalty_log.md index 7d297030..7a952628 100644 --- a/docs/dev/002_development_reward_penalty_log.md +++ b/docs/dev/002_development_reward_penalty_log.md @@ -1,7 +1,7 @@ # 開發獎懲與決策記錄 (2025) -> **最後更新**: 2026-01-14T02:15:13+08:00 -> **當前總分**: 784 (初始分: 100) +> **最後更新**: 2026-01-14T02:30:00+08:00 +> **當前總分**: 786 (初始分: 100) > **目標**: >120 (優秀) | <80 (警示) --- @@ -23,6 +23,7 @@ | 類型 | 摘要 | 採取行動 | 依據 | 分數 | 時間 | | ------- | ----------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---- | ---------- | +| ✅ 成功 | 修復 quake-school TypeScript 類型錯誤 | 1) **問題分析**: quake-school tsconfig.json 的 `types` 配置過於限制,只包含 ["node", "vitest/globals"],導致 @types/react 類型無法被識別 2) **解決方案**: 移除 `types` 配置,讓 TypeScript 自動包含 node_modules/@types 下的所有類型 3) **驗證**: `pnpm -r typecheck` 4 個應用全部通過 4) **Linus 三問**: 真實問題(CI typecheck 失敗)、最簡方案(移除不必要的 types 限制)、破壞評估(所有 typecheck 通過) | [context7:/websites/typescriptlang:2026-01-14 types compilerOptions] | +2 | 2026-01-14 | | ✅ 成功 | 緊急修復:Service Worker clientsClaim 缺失導致離線功能失效 | 1) **問題分析**: 用戶滑掉 app 後重新打開無法使用離線功能,Service Worker 不會重新控制頁面 2) **根因**: sw.ts 只有 `skipWaiting()` 缺少 `clientsClaim()`,SW 激活後不會立即控制所有 Client 3) **解決方案**: 從 workbox-core 導入 clientsClaim,在 skipWaiting() 後調用 clientsClaim(),確保 iOS Safari PWA 重啟後立即獲得 SW 控制 4) **依賴添加**: workbox-core ^7.4.0 devDependency 5) **驗證**: 15 個 PWA E2E 測試全通過、1069/1070 單元測試通過、typecheck ✅、lint ✅、build ✅ 6) **Linus 三問**: 真實問題(用戶離線功能失效)、最簡方案(添加 clientsClaim)、破壞評估(測試全通過) | [context7:/googlechrome/workbox:2026-01-14 skipWaiting + clientsClaim][context7:/vite-pwa/vite-plugin-pwa:2026-01-14 autoUpdate behavior][Apple Developer Forums:iOS Safari PWA service worker killed after app close] | +5 | 2026-01-14 | | ✅ 成功 | PR#97 Design Token 無障礙性對比度修復 + SEO Audit 權限修復 | 1) **E2E 無障礙性修復**: FAQ 摘要和 MultiConverter 提示文字從 `text-neutral-text-muted` 改為 `text-neutral-text-secondary`,確保 WCAG 2.1 AA 4.5:1 對比度 2) **SEO Audit 權限修復**: 新增 `pull-requests: write` 權限解決 `Resource not accessible by integration` 錯誤 3) **Design Token 對齊**: 恢復 `defaultTheme.text-muted` 為 `slate[400]` 對齊 main 分支 4) **useTheme 測試簡化**: 改用功能行為測試替代直接 localStorage.setItem mock,提升跨環境兼容性 5) **驗證**: 1040 tests ✅、E2E ✅、SEO Audit ✅、Lighthouse ✅、Quality Checks ✅ 6) **Linus 三問**: 真實問題(E2E 無障礙測試失敗)、最簡方案(使用對比度更高的語義色彩)、破壞評估(CI 11/12 通過,僅 Docker Build 網絡問題) | [WCAG 2.1 AA color contrast 4.5:1][GitHub Actions permissions documentation] | +4 | 2026-01-13 | | ✅ 成功 | Phase 2 CSS Variables 升級 - 動態主題切換架構 | 1) **升級 design-tokens.ts v2.0.0**: 從硬編碼 Tailwind colors 改為 CSS Variables 格式 `rgb(var(--color-*) / )` 2) **建立 index.css 主題系統**: 定義 light/dark 兩套完整 CSS Variables (130+ 行,40+ tokens) 3) **建立 useTheme Hook**: localStorage 持久化 + SSR 安全 + 系統偏好檢測 (prefers-color-scheme) 4) **建立 ThemeToggle 組件**: 用戶友好的主題切換介面 (含 ThemeToggle 和 ThemeToggleCompact 兩版本) 5) **測試更新**: 修復 theme-consistency.test.ts (8 test cases) 驗證 CSS Variables 與 defaultTheme 一致性 6) **驗證**: 1037/1038 tests passed ✅、typecheck ✅、lint ✅ 7) **Linus 三問**: 真實問題(需要運行時主題切換)、最簡方案(CSS Variables + data-theme attribute)、破壞評估(100% 向後相容,0 個既有組件改動) | [context7:/tailwindlabs/tailwindcss.com:CSS Variables best practices][Tailwind CSS v3+ theme customization][React 19 useSyncExternalStore pattern] | +8 | 2026-01-13 |