fix(pre-commit): type-check with tsc -b so build errors are caught#33
Merged
Conversation
The root frontend/tsconfig.json is solution-style (files: [], only project references), so the pre-commit hook's plain tsc --noEmit resolved to it and type-checked zero files under src/. A build-breaking type error could pass the gate locally and in CI, only surfacing in the real build (tsc -b && vite build). Switch the hook to tsc -b --noEmit (project-reference build mode, no emit), matching what the build actually checks.
✅ Deploy Preview for climate-ref canceled.
|
📝 WalkthroughWalkthroughThe pre-commit ChangesPre-commit hook update
Metadata
Suggested labels: none suggested Suggested reviewers: none suggested 🐰 A tiny flag, a build so bright, 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 951382b8-2a57-4d1a-8b20-6c6f8741c72e
📒 Files selected for processing (2)
.pre-commit-config.yamlchangelog/33.trivial.md
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
The pre-commit
TypeScript typecheckhook rantsc --noEmit, but the rootfrontend/tsconfig.jsonis solution-style ("files": [], only projectreferences). Plaintsc --noEmitresolves to that root config and type-checks zero files undersrc/, so a build-breaking type error passes the gate — locally and in CI — and only surfaces in the real build (tsc -b && vite build).This switches the hook to
tsc -b --noEmit(project-reference build mode, no emit), which descends into the referenced projects (tsconfig.app.json/tsconfig.node.json) exactly as the build does.Verification
Ran in
frontend/(with deps installed) using a throwawaysrc/probe with astring | null | undefined→string | undefinedmismatch:tsc --noEmit(old)tsc -b --noEmit(new)error TS2322: Type 'null' is not assignable to type 'string | undefined'Probe removed afterward; clean tree passes again. TypeScript is 5.8.3, so
-b --noEmitis supported (added in 5.6).Summary by CodeRabbit
Bug Fixes
Chores