Skip to content

chore(deps): 删除未接线的 prettier devDependency (#3657) - #3681

Merged
yinlianghui merged 1 commit into
mainfrom
claude/issue-3657-remove-unwired-prettier
Aug 7, 2026
Merged

chore(deps): 删除未接线的 prettier devDependency (#3657)#3681
yinlianghui merged 1 commit into
mainfrom
claude/issue-3657-remove-unwired-prettier

Conversation

@yinlianghui

Copy link
Copy Markdown
Collaborator

Fixes #3657

按 issue 分诊裁决走 enforce-or-remove → remove:删掉根 package.json 里那条从未接线的 prettier@^3.9.6

一、四类接线复测(基线 origin/main @ 278f57c36,全部零命中)

复测在全新 worktree、pnpm install 之前执行,树里还没有 node_modules,所以下面每条 grep 天然不含依赖噪声。

# 接线面 复测命令 结果
1 配置文件 find . -iname '.prettierrc*' -o -iname 'prettier.config.*' -o -iname '.prettierignore' -o -iname '.editorconfig' 0(仓根与任意子目录均无)
2 workflow grep -rn -i prettier .github/ 0(覆盖全部 16 个 workflow)
3 eslint grep -n -i prettier eslint.config.js + grep -rn -i prettier eslint-rules/ 0(无 eslint-config-prettier / eslint-plugin-prettier)
4 package.json 全仓 46 个 package.json 逐个 grep -n -i prettier 仅 1 处:根 package.json:95 依赖声明本身。无 prettier 配置键,无任何 script 调用

补测了 issue 未列举的相邻接线面,同样为空:.vscode/settings.json.vscode/extensions.json.husky/lint-staged / husky / simple-git-hooks / pre-commit 键,以及 pnpm-workspace.yamlturbo.json。根 scripts 里也没有 format 一类的入口。

全仓 grep 的一处订正:排除 node_modulespnpm-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:

$ git diff --stat origin/main -- scripts/check-doc-links.mjs
(空 —— 与 origin/main 逐字节相同)

$ pnpm exec prettier --check scripts/check-doc-links.mjs
Checking formatting...
[warn] scripts/check-doc-links.mjs
[warn] Code style issues found in the above file. Run Prettier with --write to fix.
exit=1

零改动的树上 exit=1。因为没有配置,用的是 prettier 默认值(双引号、printWidth: 80),而本仓是单引号、行宽更宽。--write 会把它改成:

- import { readdirSync, readFileSync, statSync } from 'node:fs';
+ import { readdirSync, readFileSync, statSync } from "node:fs";
- const DOCS_ROUTE_PREFIX = '/docs';
+ const DOCS_ROUTE_PREFIX = "/docs";

规模复核(issue 报的 389 / 1646 逐字复现):

文件 diff | wc -l(issue 口径) 仅计变更行
scripts/check-doc-links.mjs 389 287
scripts/__tests__/check-doc-links.test.ts 1646 1198

两个数字的差别只是口径(前者含 --- 分隔行与 NNNcNNN 块头),不是 main 漂移;issue 的测量可原样复现。

三、lockfile diff 摘要

pnpm installPackages: -1 / devDependencies: - prettier 3.9.6。lockfile 净删 11 行、增 0 行,三个 hunk 全部是 prettier@3.9.6:

  1. importers 根条目(specifier + version),-3 行
  2. packages:prettier@3.9.6 解析块,-5 行
  3. 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:

$ command -v prettier
/opt/node22/bin/prettier          ->  /opt/node22/lib/node_modules/prettier/bin/prettier.cjs (3.8.1)

仓内这一份确实删干净了,证据是版本号变了:删除前 pnpm exec prettier --version3.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=2 18 files / 337 tests passed(含读取根 package.jsonpackage-files-existworkspace-peer-dependency-edges,证明无隐藏依赖)
pnpm run check:control-bytes OK(3680 个跟踪文本文件)
改动文件控制字符自扫 clean

六、若将来要重新引入 prettier(enforce 路)

本次走 remove 的依据是「测量已死」:四类接线全零、文档零提及、零 CI 影响。日后要装回来,不能只加回依赖 —— 那样只会把同一个假红再放一遍。enforce 路必须三件套一次到位:

  1. 配置:与现有风格一致的 .prettierrc(singleQuote: true 等)+ .prettierignore;
  2. 接线:挂进 lint 脚本与 CI workflow,让它真的会红/会拦;
  3. 一次性全仓格式化基线:单独一个 PR 把全仓格式化到位,与任何功能改动隔离,之后的 diff 才干净。

三者缺一都会退回今天这个状态:一条装不上用场的依赖 + 一个会骗人的 --check

七、changeset

无。纯工具链 devDependency 移除,不进任何发布物,39 个包的产物与 API 零变化;按 AGENTS.md「功能改进需 changeset、纯修复不需要」的口径,此项两者皆非且零发布影响,故不写。


Generated by Claude Code

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
@vercel

vercel Bot commented Aug 7, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
objectui Ignored Ignored Aug 7, 2026 8:33pm

Request Review

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

✅ Console Performance Budget

Metric Value Budget
Main entry (gzip) 28.1 KB 350 KB
Entry file index-COzuxrX6.js
Status PASS

📦 Bundle Size Report

Package Size Gzipped
app-shell (index.js) 8.66KB 3.13KB
app-shell (runtime-config.js) 7.42KB 2.32KB
app-shell (types.js) 0.01KB 0.04KB
app-shell (urlParams.js) 7.57KB 2.97KB
auth (AuthContext.js) 0.31KB 0.24KB
auth (AuthGuard.js) 1.17KB 0.53KB
auth (AuthProvider.js) 22.10KB 4.37KB
auth (AuthShell.js) 3.49KB 1.40KB
auth (ForgotPasswordForm.js) 12.21KB 3.45KB
auth (LoginForm.js) 18.13KB 5.39KB
auth (PreviewBanner.js) 0.90KB 0.50KB
auth (RegisterForm.js) 6.64KB 2.21KB
auth (SocialSignInButtons.js) 9.60KB 3.89KB
auth (UserMenu.js) 3.40KB 1.22KB
auth (auth-gate-events.js) 1.29KB 0.66KB
auth (authStyles.js) 5.04KB 1.72KB
auth (createAuthClient.js) 35.76KB 9.11KB
auth (createAuthenticatedFetch.js) 4.37KB 1.69KB
auth (index.js) 2.35KB 1.07KB
auth (org-roles.js) 6.66KB 2.78KB
auth (phone-identifier.js) 1.11KB 0.66KB
auth (types.js) 0.59KB 0.35KB
auth (useAuth.js) 4.91KB 0.87KB
auth (useIsWorkspaceAdmin.js) 1.61KB 0.85KB
collaboration (CommentThread.js) 26.07KB 7.56KB
collaboration (LiveCursors.js) 3.17KB 1.27KB
collaboration (PresenceAvatars.js) 6.49KB 2.64KB
collaboration (PresenceProvider.js) 2.79KB 1.13KB
collaboration (index.js) 1.65KB 0.73KB
collaboration (useCollaborationTranslation.js) 6.05KB 2.52KB
collaboration (useCommentSearch.js) 1.98KB 0.88KB
collaboration (useConflictResolution.js) 7.75KB 1.86KB
collaboration (useMentionNotifications.js) 1.81KB 0.68KB
collaboration (usePresence.js) 6.33KB 1.84KB
collaboration (useRealtimeSubscription.js) 7.91KB 2.01KB
components (index.js) 480.72KB 105.64KB
core (index.js) 2.96KB 1.13KB
create-plugin (index.js) 9.28KB 2.98KB
data-objectstack (index.js) 137.51KB 35.11KB
fields (index.js) 230.87KB 56.83KB
i18n (LocalizationContext.js) 1.76KB 0.96KB
i18n (currency.js) 1.22KB 0.64KB
i18n (i18n.js) 4.32KB 1.77KB
i18n (index.js) 2.65KB 1.06KB
i18n (pickLocalized.js) 1.70KB 0.83KB
i18n (provider.js) 9.48KB 3.27KB
i18n (useObjectLabel.js) 26.14KB 6.07KB
i18n (useSafeTranslation.js) 4.52KB 1.96KB
layout (index.js) 38.53KB 10.71KB
mobile (MobileProvider.js) 0.92KB 0.49KB
mobile (ResponsiveContainer.js) 0.94KB 0.38KB
mobile (breakpoints.js) 1.51KB 0.70KB
mobile (createOfflineDataSource.js) 5.61KB 1.74KB
mobile (index.js) 1.50KB 0.62KB
mobile (offlineQueue.js) 3.91KB 1.35KB
mobile (pwa.js) 0.97KB 0.49KB
mobile (serviceWorker.js) 1.48KB 0.62KB
mobile (serviceWorkerSource.js) 3.41KB 1.48KB
mobile (useBreakpoint.js) 1.54KB 0.65KB
mobile (useGesture.js) 6.96KB 1.98KB
mobile (useOfflineSync.js) 1.99KB 0.72KB
mobile (usePullToRefresh.js) 2.53KB 0.85KB
mobile (useResponsive.js) 0.71KB 0.42KB
mobile (useResponsiveConfig.js) 1.36KB 0.63KB
mobile (useSpecGesture.js) 4.32KB 1.64KB
mobile (useTouchTarget.js) 1.01KB 0.54KB
permissions (MePermissionsProvider.js) 8.75KB 3.06KB
permissions (PermissionContext.js) 0.31KB 0.25KB
permissions (PermissionGuard.js) 0.89KB 0.45KB
permissions (PermissionProvider.js) 3.67KB 1.12KB
permissions (evaluator.js) 4.41KB 1.44KB
permissions (index.js) 0.91KB 0.41KB
permissions (store.js) 0.91KB 0.42KB
permissions (useFieldPermissions.js) 1.28KB 0.52KB
permissions (usePermissions.js) 1.55KB 0.71KB
plugin-ai (index.js) 15.71KB 3.79KB
plugin-calendar (index.js) 44.98KB 12.37KB
plugin-charts (index.js) 61.04KB 17.31KB
plugin-chatbot (index.js) 180.09KB 42.72KB
plugin-dashboard (index.js) 115.50KB 29.96KB
plugin-designer (index.js) 210.51KB 42.51KB
plugin-detail (index.js) 232.79KB 57.42KB
plugin-editor (index.js) 2.46KB 1.10KB
plugin-form (index.js) 112.10KB 27.10KB
plugin-gantt (index.js) 162.55KB 39.57KB
plugin-grid (index.js) 186.61KB 49.34KB
plugin-kanban (index.js) 48.30KB 13.28KB
plugin-list (index.js) 105.12KB 25.48KB
plugin-map (index.js) 16.81KB 5.24KB
plugin-markdown (index.js) 13.72KB 4.69KB
plugin-report (index.js) 40.58KB 10.58KB
plugin-timeline (index.js) 25.76KB 7.33KB
plugin-tree (index.js) 8.50KB 2.88KB
plugin-view (index.js) 84.03KB 20.55KB
providers (DataSourceProvider.js) 0.75KB 0.39KB
providers (MetadataProvider.js) 1.37KB 0.59KB
providers (ThemeProvider.js) 1.90KB 0.85KB
providers (UploadProvider.js) 11.71KB 3.53KB
providers (index.js) 0.44KB 0.22KB
providers (types.js) 0.01KB 0.04KB
react-runtime (index.js) 5.67KB 2.37KB
react (LazyPluginLoader.js) 3.77KB 1.33KB
react (SchemaRenderer.js) 19.28KB 6.38KB
react (data-invalidation.js) 5.05KB 2.08KB
react (index.js) 1.02KB 0.55KB
react (spec-input.js) 0.20KB 0.18KB
sdui-parser (codegen.js) 4.09KB 1.74KB
sdui-parser (index.js) 4.47KB 2.03KB
sdui-parser (parse.js) 10.04KB 2.82KB
sdui-parser (types.js) 0.29KB 0.24KB
sdui-parser (validate.js) 4.69KB 1.48KB
types (ai.js) 0.20KB 0.17KB
types (api-types.js) 0.20KB 0.18KB
types (app.js) 2.87KB 0.99KB
types (base.js) 0.20KB 0.18KB
types (blocks.js) 0.20KB 0.18KB
types (complex.js) 0.20KB 0.18KB
types (crud.js) 0.20KB 0.18KB
types (data-display.js) 0.20KB 0.18KB
types (data-protocol.js) 0.20KB 0.19KB
types (data.js) 0.20KB 0.18KB
types (designer.js) 1.87KB 0.85KB
types (disclosure.js) 0.20KB 0.18KB
types (error-code.js) 1.54KB 0.88KB
types (feedback.js) 0.20KB 0.18KB
types (field-types.js) 0.20KB 0.18KB
types (form.js) 0.20KB 0.18KB
types (http-retry.js) 4.32KB 2.02KB
types (index.js) 2.71KB 1.34KB
types (layout.js) 0.20KB 0.18KB
types (managed-by.js) 0.19KB 0.18KB
types (mobile.js) 2.59KB 1.31KB
types (navigation.js) 0.20KB 0.18KB
types (objectql.js) 0.20KB 0.18KB
types (overlay.js) 0.20KB 0.18KB
types (permissions.js) 0.20KB 0.18KB
types (plugin-scope.js) 0.20KB 0.18KB
types (record-components.js) 0.20KB 0.19KB
types (record-semantics.js) 1.28KB 0.67KB
types (registry.js) 0.20KB 0.18KB
types (reports.js) 0.20KB 0.18KB
types (spec-report.js) 5.05KB 1.93KB
types (system-fields.js) 3.33KB 1.54KB
types (theme.js) 0.20KB 0.18KB
types (ui-action.js) 3.40KB 1.71KB
types (views.js) 0.20KB 0.18KB
types (widget.js) 0.20KB 0.18KB

Size Limits

  • ✅ Core packages should be < 50KB gzipped
  • ✅ Component packages should be < 100KB gzipped
  • ⚠️ Plugin packages should be < 150KB gzipped

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

prettier 是未接线的 devDependency:无配置、无 lint 集成、无工作流,prettier --check 对全仓假红

2 participants