Uh oh!
There was an error while loading. Please reload this page.
docs(agents): 补一条 prettier 假红护栏 —— 全局 prettier 经 PATH 兜底,删依赖不足以闭合 (#3682) - #3684
Merged
Merged
Conversation
删掉未接线的 prettier devDependency(#3657 / PR #3681)并不能消灭假红陷阱: 容器镜像预装了全局 prettier(3.8.1),仓内解析不到时 pnpm exec 沿 PATH 兜底,依然按 prettier 默认配置对未改动内容报 exit=1。仓内现在已 grep 不到 prettier,陷阱反而更隐蔽。 在 §9「测试纪律」补一条(与相邻的 stale-install 假红条目同类),写明: 本仓没有格式化门禁、命令为什么仍跑得通、归因是「默认配置 != 本仓约定」 而非「main 没格式化」、禁止据此 --write、正确动作是什么。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GTRjn8xBqp75dk7kFupVRt
The latest updates on your projects. Learn more about Vercel for GitHub. |
yinlianghui
marked this pull request as ready for review
August 7, 2026 20:48
Uh oh!
There was an error while loading. Please reload this page.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes#3682
补上 #3657 / PR #3681 缺的另一半:PR #3681 删掉的是「仓库声明了一条没人用的依赖」,陷阱本身没消失 ——
pnpm exec prettier仍会沿 PATH 落到容器镜像自带的全局 prettier 上,依然对未改动内容报exit=1。而且仓里现在已经 grep 不到 prettier,撞上的人更难顺藤摸瓜找到解释,所以只剩文档护栏这一条路能真正闭合。改动是 AGENTS.md 一行(
1 file changed, 1 insertion(+),零删除、零重排),插在 §9「测试纪律」小节末尾 —— 紧接同属「本地假红 + 误归因」类的 stale-install 条目,与它同一形态。一、护栏全文(新增行,逐字)
二、断言实测表(全部在本 worktree 复测,基线
origin/main@f953b5884= PR #3681 已落 main).editorconfigfind . -path ./node_modules -prune -o \( -iname '.prettierrc*' -o -iname 'prettier.config.*' -o -iname '.prettierignore' -o -iname '.editorconfig' \) -printgrep -rn -i prettier .github/eslint.config.js(113 行)+grep -rnE "quotes|semi|indent|stylistic|max-len|comma-dangle" eslint.config.js eslint-rules/*.jsjs.configs.recommended+tseslint.configs.recommended+react-hooks/react-refresh+ 四条object-ui/*ratchet;无eslint-config-prettier/eslint-plugin-prettiergrep -i prettier package.json= 0;46 个package.json全部 0;git grep -i prettier -- . ':(exclude)pnpm-lock.yaml'packages/app-shell/src/views/metadata-admin/previews/ValidationPreview.tsx:194(“not a prettier view of a rule…”),与工具无关grep -n 'prettier@' pnpm-lock.yamlprettier@2.8.8(changesets 的传递依赖),两处;无prettier@3command -v prettier/ls -l/opt/node22/bin/prettier -> ../lib/node_modules/prettier/bin/prettier.cjs,Mar 31 装的,--version= 3.8.1pnpm exec沿 PATH 兜底pnpm exec prettier --version(worktree 内无node_modules,仓内根本无可解析项)exit=1git diff --stat origin/main -- scripts/check-doc-links.mjs(空)后pnpm exec prettier --check[warn] scripts/check-doc-links.mjs/exit=1scripts/下全部 35 个跟踪的.mjs/.ts跑--checkgit show origin/main:F | prettier --stdin-filepath F | diff - <(git show origin/main:F) | wc -lgit grep -hE "^import .* from '"vs",限*.ts/*.tsxprintf "const a = 'x';" | prettier --stdin-filepath probe.tsconst a = "x";if (cleanHref === … || cleanHref.startsWith(…)) {(89 列)被拆成 4 行;原文件最长行 145 列三、归因措辞(遵 #3656 的规矩,不复植失真特征词)
护栏把根因钉在「默认配置 ≠ 本仓约定」,并显式否掉两个诱人的错误归因:「
main没格式化」和「是你改坏了」。前者会把一个「工具默认值与本仓风格不同」的事实,曲解成「仓库代码处于未格式化的待修状态」—— 那正是会诱发全仓--write的那句话。一处必须报告的措辞订正:派发单里给的是「本仓不用 prettier(格式由 eslint 承担)」。后半句在树上不成立 —— 见断言 3:
eslint.config.js里一条格式规则都没有,它管的是正确性与 ratchet。若照抄,等于在共享根文档里新种一条假断言(而且会让人以为跑pnpm lint能查格式)。故护栏写的是实测版本:「本仓没有格式化门禁」,并把pnpm lint/pnpm test/check:*只描述为「真接了线的检查」,不声称它们覆盖格式。四、门禁
node scripts/check-control-bytes.mjsgrep -naP '[\x00-\x08\x0b\x0c\x0e-\x1f]' AGENTS.mdnode scripts/check-doc-links.mjsLinks are valid across 7 scan roots.—— 但AGENTS.md不在扫描面内:SCAN_ROOTS只有content/docs、examples、README.md、CONTRIBUTING.md、ROADMAP.md、docs、packages/*/README.md。所以这个绿不构成对本改动的证据;好在新增行不含任何 markdown 链接(issue 号按邻居惯例写作纯文本objectui#3657),本就没有可失效的链接pnpm lint/pnpm testgit grep AGENTS -- '*.ts' '*.mjs' '*.js'的命中全是注释与错误文案,无任何测试从磁盘解析该文件五、changeset
无。
AGENTS.md是仓根的 agent 指令文档,不在任何包目录下、不进任何包的files(46 个package.json全查,0 个包含),39 个包的产物与 API 零变化,零用户可见影响。按 AGENTS.md「功能改进需 changeset、纯 bug 修复不需要」的口径,此项两者皆非且零发布影响,故不写。六、范围
只动
AGENTS.md一行。没有采纳 issue 里的二号方案(全量.prettierignore/ 机械拦截):加一份只用于「拒绝」的 prettier 文件,会让下一个读者以为本仓在用 prettier,语义上比现状更糊涂 —— issue 作者自己也是这么判的。三号方案(不处理)被本 PR 取代。🤖 Generated with Claude Code
https://claude.ai/code/session_01GTRjn8xBqp75dk7kFupVRt
Generated by Claude Code