Skip to content

拆分超长前端样式并增加 500 行门禁 - #167

Merged
makewheels merged 2 commits into
masterfrom
refactor-split-web-styles
Aug 23, 2026
Merged

makewheels merged 2 commits into
masterfrom
refactor-split-web-styles

Conversation

@makewheels

Copy link
Copy Markdown
Owner

变更

  • 将 3237 行 App.css 按原始级联顺序拆成 8 个文件,最大 495 物理行
  • App.css 只保留有序 @import,后写覆盖顺序不变
  • 新增 CSS 物理行数检查,递归覆盖 web/src/**/*.css,501 行即失败
  • 将门禁接入 pnpm run lint 和现有 CI
  • 新增行数计算、递归扫描和超限识别测试

等价性证据

  • 机械切片完成时,8 个文件顺序拼接 SHA-256 与原 App.css 完全一致
  • 后续只中性化一条旧注释,CSS 规则和顺序不变
  • Vite 生产构建仍生成同名 CSS 资源 index-Pn-Zo3qW.css

验证

  • CSS 门禁:11 个 CSS 文件全部不超过 500 行
  • pnpm test:26 个文件、282 项通过
  • pnpm run test:coverage:Statements 88.03%、Branches 81.86%、Functions 86.11%、Lines 91.66%
  • pnpm run lint:0 error,23 个既存 warning
  • pnpm run build:通过
  • git diff --check:通过

范围说明

本 PR 只解决用户指出的超长 CSS 并建立 CSS 物理行门禁。JS/JSX 仍沿用 ESLint 的 500 有效行规则;仓库现有 3 个物理行超过 500 的 JS/JSX 文件若要改成严格物理行口径,将另开 PR 拆分,避免与纯样式机械迁移混在一起。

@makewheels
makewheels merged commit 649f9f6 into master Aug 23, 2026
3 checks passed
@makewheels
makewheels deleted the refactor-split-web-styles branch August 23, 2026 12:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant