Repository navigation
fix(ci): run lint and build in CI; fix setState-in-effect lint error - #38
Merged
Merged
Conversation
- QuestionContainer: replace the reset-in-useEffect with React's adjust-during-render pattern for prop-driven state resets, resolving the react-hooks/set-state-in-effect error without changing behavior - ci.yml: add `npm run lint` and `npm run build` steps so formatting, lint and type errors fail the build (build also runs the asset budget, replacing the standalone check:assets step)
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.
Closes #37
Problem
CI only ran
npm ci, the asset-size check andnpm test, so ESLint and TypeScript/build errors were ungated —mainhad a live lint error and a brokentsc -b.Changes
src/components/gameplay/QuestionContainer.tsxReplaced the "reset state when the question changes"
useEffect(which calledsetStatesynchronously and violatedreact-hooks/set-state-in-effect) with React's documented adjust-state-during-render pattern. A compositequestionText\u0000timeLimitkey detects prop changes and resets in render. Behavior is unchanged: selecting a question still clears the answer, submission flag and timer; the other two effects are untouched..github/workflows/ci.ymlnpm run lint).npm run build), which runstsc -b, the asset budget andvite build. This replaces the standalonecheck:assetsstep (still covered), so no extra work is duplicated.Verification