chore(deps): 删除未接线的 prettier devDependency (#3657) - #3681
Merged
Conversation
prettier@^3.9.6 sat in the root devDependencies with nothing behind it: no .prettierrc/prettier.config.*, no `prettier` key in any of the 46 package.json files, no .prettierignore, no .editorconfig, zero mentions across .github/ (16 workflows), zero mentions in eslint.config.js or eslint-rules/, and zero package scripts invoking it. Its only live effect was a false red. With no config, `prettier --check` falls back to prettier's defaults (double quotes, printWidth 80) while this repo writes single quotes and wider lines, so it reports untouched files as unformatted. Measured on unmodified origin/main content: scripts/check-doc-links.mjs 389 diff lines, its test 1646. An agent running --check as a finishing step sees its own files warn and reaches for --write, which would reformat thousands of unrelated lines into a style this repo does not use. Formatting stays with eslint. Reintroducing prettier is an enforce-path change and needs all three parts together: a config matching the current style, CI/lint wiring, and a one-shot repo-wide formatting baseline. No changeset: toolchain-only devDependency, no published artifact changes. 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. |
Contributor
✅ Console Performance Budget
📦 Bundle Size Report
Size Limits
|
yinlianghui
marked this pull request as ready for review
August 7, 2026 20:37
This was referenced Aug 7, 2026
Closed
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 free
to 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 #3657
按 issue 分诊裁决走 enforce-or-remove → remove:删掉根
package.json里那条从未接线的prettier@^3.9.6。一、四类接线复测(基线
origin/main@278f57c36,全部零命中)复测在全新 worktree、
pnpm install之前执行,树里还没有node_modules,所以下面每条 grep 天然不含依赖噪声。find . -iname '.prettierrc*' -o -iname 'prettier.config.*' -o -iname '.prettierignore' -o -iname '.editorconfig'grep -rn -i prettier .github/grep -n -i prettier eslint.config.js+grep -rn -i prettier eslint-rules/eslint-config-prettier/eslint-plugin-prettier)package.json逐个grep -n -i prettierpackage.json:95依赖声明本身。无prettier配置键,无任何 script 调用补测了 issue 未列举的相邻接线面,同样为空:
.vscode/settings.json、.vscode/extensions.json、.husky/、lint-staged/husky/simple-git-hooks/pre-commit键,以及pnpm-workspace.yaml、turbo.json。根 scripts 里也没有format一类的入口。全仓 grep 的一处订正:排除
node_modules与pnpm-lock.yaml后,提到 prettier 的文件其实是两个而非一个 —— 除依赖声明外,还有packages/app-shell/src/views/metadata-admin/previews/ValidationPreview.tsx:194。那里是英文形容词(“not a prettier view of a rule that cannot be saved”),与工具无关,不构成接线。结论:四类接线全零,remove 的前提成立。
二、陷阱现场(未改动树上复现)
先证明文件与
origin/main逐字节相同,再跑--check:零改动的树上
exit=1。因为没有配置,用的是 prettier 默认值(双引号、printWidth: 80),而本仓是单引号、行宽更宽。--write会把它改成:规模复核(issue 报的 389 / 1646 逐字复现):
diff | wc -l(issue 口径)scripts/check-doc-links.mjsscripts/__tests__/check-doc-links.test.ts两个数字的差别只是口径(前者含
---分隔行与NNNcNNN块头),不是 main 漂移;issue 的测量可原样复现。三、lockfile diff 摘要
pnpm install报Packages: -1/devDependencies: - prettier 3.9.6。lockfile 净删 11 行、增 0 行,三个 hunk 全部是prettier@3.9.6:importers根条目(specifier + version),-3 行packages:的prettier@3.9.6解析块,-5 行snapshots:的prettier@3.9.6: {},-2 行prettier@2.8.8原样保留(它是@changesets/write与@changesets/apply-release-plan的传递依赖 —— changesets 自带一份 prettier 用来格式化 changeset 文件,与本仓格式化无关)。除此之外无任何解析漂移。四、逆向验证:预测被推翻,如实记录
预测:删除后
pnpm exec prettier --version应失败(不可解析)。实测:没有失败,反而成功并报
3.8.1。原因是
pnpm exec在仓内找不到时会继续沿 PATH 兜底,而本容器镜像里装了一份全局 prettier:仓内这一份确实删干净了,证据是版本号变了:删除前
pnpm exec prettier --version答3.9.6(即被删的那条),删除后答3.8.1(镜像全局那份);同时node_modules/.bin/prettier已不存在,lockfile 里grep 'prettier@3'零命中。由此得到一个必须写明的残留结论:在装有全局 prettier 的环境里,光删依赖并不能消灭这个假红陷阱 ——
pnpm exec prettier --check依然会落到全局那份上,依然对未改动内容报exit=1(已实测复现)。本 PR 达成的是「仓库不再声明一条没人用的依赖」,而不是「陷阱物理消失」。补上 issue 里的三号方案(在 AGENTS.md 写明本仓不以 prettier 做格式门禁)才能真正闭合;已另开 finding 记录,不在本 PR 文件面内。五、门禁
pnpm exec vitest run --project unit scripts/ --maxWorkers=2package.json的package-files-exist、workspace-peer-dependency-edges,证明无隐藏依赖)pnpm run check:control-bytes六、若将来要重新引入 prettier(enforce 路)
本次走 remove 的依据是「测量已死」:四类接线全零、文档零提及、零 CI 影响。日后要装回来,不能只加回依赖 —— 那样只会把同一个假红再放一遍。enforce 路必须三件套一次到位:
.prettierrc(singleQuote: true等)+.prettierignore;lint脚本与 CI workflow,让它真的会红/会拦;三者缺一都会退回今天这个状态:一条装不上用场的依赖 + 一个会骗人的
--check。七、changeset
无。纯工具链 devDependency 移除,不进任何发布物,39 个包的产物与 API 零变化;按 AGENTS.md「功能改进需 changeset、纯修复不需要」的口径,此项两者皆非且零发布影响,故不写。
Generated by Claude Code