Loading...
Loading...
Compare original and translation side by side
reference/compiler-driven-principles.mdreference/compiler-driven-principles.mdtsc --noEmittsc --noEmit| 检查 | 命中时路由到 |
|---|---|
| 用户想同时改行为(加功能 / 修 bug / 调样式出效果) | 走 feature(cs-feat)或 issue(cs-issue) |
| 代码量 > 800 行单文件 或 > 3 个文件同时要动 | 劝用户先缩范围到一个 SFC / 一个 composable |
| 项目没配 TypeScript + Volar,纯 JS Vue 项目 | 告警:编译器驱动的保证会弱一大截,改动要靠 |
| 用户没决定改动范围就说"你看着办" | 反问"这次是只拆 X 组件,还是顺带它依赖的也一起?"——范围定了再进诊断 |
| Check | Route to when hit |
|---|---|
| User wants to change behavior at the same time (add features / fix bugs / adjust styles for effects) | Follow feature (cs-feat) or issue (cs-issue) process |
| Code size > 800 lines per single file or > 3 files need to be modified simultaneously | Advise the user to narrow the scope to one SFC / one composable first |
| Project is not configured with TypeScript + Volar, pure JS Vue project | Warning: Compiler-driven guarantees will be significantly weakened; changes rely on |
| User says "You decide" without determining the scope of changes | Ask back: "Are we only splitting component X this time, or including its dependencies as well?" — enter diagnosis only after the scope is confirmed |
<script setup>reference/recipe-outward-move.md<script setup>reference/recipe-outward-move.md<template>fetch / axios / useQuery / store.dispatchrouter.push / localStorage / window.xxxreference/recipe-humble-controller.md<template>fetch / axios / useQuery / store.dispatchrouter.push / localStorage / window.xxxreference/recipe-humble-controller.mdref / watch / computedmountmock reactivitylib/reference/recipe-thin-composable.mdref / watch / computedmountmock reactivitylib/reference/recipe-thin-composable.md1. 定位一个「语义单元」(一簇变量 / 一块模板 / 一段纯逻辑)
2. 新建目标位置(空文件 / 空 composable / 空子组件的 stub),保持编译绿
3. 把第一个成员搬过去(通常是一个字段 / 一个 prop / 一个函数签名)
↓
编译必然报错:原位置引用它的地方全断了
↓
**把这些错当成待办清单**——编译器告诉你的就是所有调用点
4. 逐个消错:要么把引用指向新位置,要么把依赖它的方法也一起搬过去
5. 这一步所有错消完 → 提交 / 标记可回滚点
6. 回到 1,搬下一个成员
7. 当原位置清空或只剩 re-export / delegate 时,做最后一次删除1. Locate a "semantic unit" (a cluster of variables / a template block / a section of pure logic)
2. Create the target location (empty file / empty composable / stub of empty child component), keep the compiler green
3. Move the first member over (usually a field / a prop / a function signature)
↓
The compiler will definitely throw errors: all references to it in the original location are broken
↓
**Treat these errors as a to-do list** — the compiler tells you all the call points
4. Fix errors one by one: either point the reference to the new location, or move the dependent methods over together
5. After all errors in this step are fixed → Commit / mark a rollback point
6. Return to step 1, move the next member
7. When the original location is empty or only has re-export / delegate, perform the final deletionuseXxxabc123useXxxabc123Rename SymbolwatchwatchEffect<script setup>thisRename SymbolwatchwatchEffect<script setup>thisreference/compiler-driven-principles.mdreference/recipe-outward-move.mdreference/recipe-humble-controller.mdreference/recipe-thin-composable.md