Skip to content

fix(ci): run lint and build in CI; fix setState-in-effect lint error - #38

Merged
merlik787-droi merged 1 commit into
mainfrom
fix/lint-and-ci-gates
Oct 9, 2026
Merged

merlik787-droi merged 1 commit into
mainfrom
fix/lint-and-ci-gates

Conversation

@merlik787-droi

Copy link
Copy Markdown
Contributor

Closes #37

Problem

CI only ran npm ci, the asset-size check and npm test, so ESLint and TypeScript/build errors were ungated — main had a live lint error and a broken tsc -b.

Changes

src/components/gameplay/QuestionContainer.tsx

Replaced the "reset state when the question changes" useEffect (which called setState synchronously and violated react-hooks/set-state-in-effect) with React's documented adjust-state-during-render pattern. A composite questionText\u0000timeLimit key 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.yml

  • Added a Lint step (npm run lint).
  • Added a Build step (npm run build), which runs tsc -b, the asset budget and vite build. This replaces the standalone check:assets step (still covered), so no extra work is duplicated.

Verification

npm run lint   → 0 problems
npm test       → 19 files, 84 tests passed
npm run build  → tsc -b clean, vite build succeeds

- 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)
@merlik787-droi
merlik787-droi merged commit f30098d into main Oct 9, 2026
@merlik787-droi
merlik787-droi deleted the fix/lint-and-ci-gates branch October 9, 2026 11:43
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.

CI only runs tests: lint and type-check/build regressions reach main

2 participants