feat(portal-shell): clean widget design tokens and fix lint:tokens (P1-6)

516 mechanical replacements across 25 widget files:
- spacing xs/sm/md/lg/xl to numeric 1/2/3/4/6
- text-heading-3 to text-lg font-semibold
- bg-danger to bg-destructive
- border border dedup

Fix .eslintrc.tokens.js to use typescript-eslint parser (was importing
uninstalled @typescript-eslint/parser). lint:tokens now passes.
This commit is contained in:
SpecialX
2026-07-22 15:07:38 +08:00
parent 9358372657
commit a28a6bd6ea
27 changed files with 388 additions and 384 deletions

View File

@@ -757,7 +757,7 @@ export default async function ExamsPage(): Promise<React.ReactElement> {
- **P0-7**`eslint .` → 0 errors, 2 warnings均在 `__generated__/types.ts` 生成文件);[eslint.config.js](file:///e:/Desktop/Edu/apps/portal-shell/eslint.config.js) 含 `no-restricted-imports`
- **P0-8**`git status` 干净commit `cfb7b00``.env.local``tsconfig.tsbuildinfo` 已在 [.gitignore](file:///e:/Desktop/Edu/apps/portal-shell/.gitignore)
### P1 · 框架与数据源接通12 周)— 进行中P1-1/P1-2/P1-3/P1-4/P1-5 ✅ 2026-07-22 验收)
### P1 · 框架与数据源接通12 周)— 进行中P1-1/P1-2/P1-3/P1-4/P1-5/P1-6 ✅ 2026-07-22 验收)
**目标**AppFrame + 导航 + 真实数据仪表盘 + 页面模板 + MSW + i18n页面迁移的"流水线"建成。
@@ -768,7 +768,7 @@ export default async function ExamsPage(): Promise<React.ReactElement> {
| P1-3 | 页面模板四件套list/detail/form/workbench+ 三态规范 | Storybook 或示例页 4 张(/shell/dev/templates/*,仅 dev 可见Next.js 私有文件夹 `_xxx` 不参与路由,故使用 `dev` 而非 `_dev` | ✅ |
| P1-4 | next-intl 接入 + messages 合并迁移 | 切换 locale 页面文案切换(截图);`useT` 自造函数删除 | ✅ |
| P1-5 | MSW 兜底层(迁移旧 handlers覆盖 dashboard/users/exams/grades 四域起步) | `NEXT_PUBLIC_MSW=1` 无后端启动,仪表盘 + users 页有数据(截图);生产构建 bundle 无 mocks | ✅ |
| P1-6 | 31 widget 令牌清债271 处机械替换)+ `border border` 去重 + 未知类检测进 arch:scan | `grep -c "text-heading-\|mt-sm\|py-xs\|p-md" src/widgets` = 0`pnpm lint:tokens` 通过 | |
| P1-6 | 31 widget 令牌清债271 处机械替换)+ `border border` 去重 + 未知类检测进 arch:scan | `grep -c "text-heading-\|mt-sm\|py-xs\|p-md" src/widgets` = 0`pnpm lint:tokens` 通过 | |
| P1-7 | codegen 恢复 typescript-operationsconfig + data-ana 两域先行关闭 skipDocumentsValidation | 生成操作级类型lib/api 对应域删除手写 interfacetypecheck 通过 | ⏳ |
| P1-8 | CI 增补:路由表一致性脚本 + 页面计数 + codegen diff 检查 | CI 对预埋违规报红(附 pipeline 链接) | ⏳ |
@@ -863,6 +863,19 @@ export default async function ExamsPage(): Promise<React.ReactElement> {
- **dev server 验证MSW=1 无后端)**`GET /api/graphql` 返回 `{msw:true}``POST /api/graphql` 返回 mock 数据teacherDashboard: total_classes=5/total_students=142users: 5 条记录questions: 3 条grades: 3 条)
- **质量校验**`tsc --noEmit` 通过;`eslint src` → 0 errors, 2 warnings`__generated__/types.ts``vitest run` 全量 21 test files / 231 tests 全部通过
**P1-6 验收证据2026-07-22**
- **31 widget 令牌清债516 处机械替换,覆盖 25 文件)**
- 间距工具类 `xs/sm/md/lg/xl` → 数字 `1/2/3/4/6``mt-sm``mt-2``px-sm``px-2``py-xs``py-1``p-md``p-3``gap-sm``gap-2``space-y-xs``space-y-1``h-xs``h-1` 等)
- `text-heading-3``text-lg font-semibold`25 处)
- `bg-danger``bg-destructive`6 处shadcn 标准)
- `border border``border`(去重,仅匹配真正的重复 border 类)
- **lint:tokens 修复**[.eslintrc.tokens.js](file:///e:/Desktop/Edu/apps/portal-shell/.eslintrc.tokens.js) 原导入 `@typescript-eslint/parser`(未安装)导致脚本不可用,改用 `typescript-eslint` 包的 `tseslint.parser`(与 eslint.config.js 一致)
- **验收命令**
- `grep -rn "text-heading-\|mt-sm\|py-xs\|p-md" src/widgets`**0 匹配**
- `eslint -c .eslintrc.tokens.js src`**0 errors**
- **质量校验**`tsc --noEmit` 通过;`eslint src` → 0 errors, 2 warnings`vitest run` 全量 21 test files / 231 tests 全部通过
### P2 · 教师域页面23 周,可与 P3 部分并行)
- 范围§9.1 全表(~50 页。顺序建议exams → homework → grades → lesson-plans → questions/textbooks → attendance/classes/students → diagnostic/error-book/analytics → elective/course-plans → ai-* → practice/schedule-changes/leave。