Skip to content

第 2 周:代码质量门禁 + 测试 + Next.js 全栈路由 ​

所属阶段:企业级前端 + Node 全栈底座(第 1–4 周)

本周目标 ​

建立"提交即校验"的代码质量门禁(ESLint / Prettier / Husky / Vitest),并用 Next.js 15 App Router 完成 Server Components 与 Server Actions 的全栈路由开发。

本周日程 ​

天学习内容动手任务当日产出
Day 1ESLint + Prettier 配置在 monorepo 根目录配置 eslint.config.js 和 .prettierrc,两个 app 共享统一 lint/format 配置
Day 2Husky + lint-staged + commitlint配置 pre-commit 自动 lint、commit-msg 校验 Conventional Commits提交即校验的 git hook
Day 3Vitest 基础:describe/it/expect、mock为 packages/shared 里的工具函数写 5 个单元测试测试全绿
Day 4Next.js 15 App Router:文件路由、layout、page、loading在 apps/web 中创建 /dashboard 路由,含 loading 和 error 边界可访问的 dashboard 页面
Day 5Server Components vs Client Components写一个 Server Component 获取数据 + 一个 Client Component 处理交互,组合使用两种组件协作的页面
Day 6Server Actions:表单提交、数据变更用 Server Action 实现一个简单的“创建待办”表单无 API 路由的完整 CRUD 交互
Day 7周复盘 + 整理整理 lint/format/test 配置到 README,写周记README + 周记

教程进度 ​

本周参考 ​

Next.js 全栈路线图指出 App Router + Server Components 是 Next.js 15 的核心。