feat: enable type-aware linting and type checking - #3
Open
fengmk2 wants to merge 2 commits into
Open
Conversation
Turn on lint.options.typeAware and typeCheck in vite.config.ts and fix everything they surfaced: - void 58 floating promises across web routes and stores; restructure destructures flagged by unbound-method - retype useState<any> and redundant any unions with real DTO types - narrow unknown values before stringification in the mongo migration script and the moderation scan decoder - give package tsconfigs explicit rootDir (or noEmit for @cnode/db) so tsgolint can type-check each project; apps/api keeps its existing nested dist layout - declare *.css modules for side-effect imports in apps/web - upgrade TypeScript to 7.0.2 and @types/node to 24 to match Node 24 Typing @cnode/db's DB export (currently any) surfaces ~40 more type errors in @cnode/api, including likely real bugs in message rendering (topic.author does not exist on the row type); left as a follow-up, see the TODO in packages/db/src/client.ts.
Type-aware lint reads apps/web/.react-router/types, which only existed after running typecheck or dev. CI runs pnpm verify (lint first) on a fresh checkout, so vp lint failed with 15 missing-module errors. Run react-router typegen as apps/web postinstall so the generated types exist right after pnpm install.
fengmk2
force-pushed
the
enable-type-aware-lint
branch
from
August 5, 2026 07:55
85d1c79 to
bc30e2e
Compare
fengmk2
marked this pull request as ready for review
August 5, 2026 08:35
thonatos
reviewed
Aug 5, 2026
thonatos
left a comment
Member
There was a problem hiding this comment.
Review: 功能正确,有一处回归需处理
开启 typeAware/typeCheck 并修掉 ~70 处历史问题(void 浮空 promise、类型化 state),TS 5.9→7.0.2,工作到位。
需处理
apps/api/tsconfig.json 新增 rootDir: "../.." 后,tsc 产物从 dist/index.js 变为 dist/apps/api/src/index.js(已本地实证),导致 start: node dist/index.js 失效;且 packages/db|shared 源码(经 paths 引入)也会被发射进 dist。Docker 不受影响(走 tsx src/index.ts),但本地 prod 模式跑不起来。建议同步更新 start 路径或调整 emit 布局。
备注
AuthVars.user 在此 PR 去掉 | null(因 DB=any),#5 恢复——属堆叠中间态,合并时 #5 需随之落地。
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.
Summary
OpenSpec
<!-- change name -->Verification
pnpm verifypassed.<!-- commands -->because<!-- reason -->.Impact Checklist
apps/,packages/)apps/api/src/routes/*.tszod-openapi declarations,api/openapi.jsonviapnpm gen:openapi)packages/db)deployment/)README.md,docs/,wiki/).github/workflows/,scripts/,package.json).env, tokens, cookies, private keys, database URLs, or user data committed.Migration / Deployment Notes