Skip to content

Enable react-hooks/rules-of-hooks as an error - #5243

Open
tomsmith8 wants to merge 1 commit into
masterfrom
claude/relaxed-davinci-4c8457
Open

Enable react-hooks/rules-of-hooks as an error#5243
tomsmith8 wants to merge 1 commit into
masterfrom
claude/relaxed-davinci-4c8457

Conversation

@tomsmith8

Copy link
Copy Markdown
Collaborator

Summary

react-hooks/rules-of-hooks was set to "off" in eslint.config.mjs, which let a conditional useMemo ship in RecursionBox (since fixed). This turns the rule back on as an error and fixes the 12 existing violations so npm run lint passes.

Changes

  • eslint.config.mjs: flip react-hooks/rules-of-hooks from off to error in the global rules block. The test-file override that disables the rule for __tests__ and *.test.* is unchanged.
  • ScreenshotModal: move the keyboard-navigation useEffect and its derived index values above the if (!screenshot) return null guard. The effect now bails when there is no screenshot, matching the previous behaviour.
  • ClarifyingQuestionsPreview: move the answers and showReview state, the submit-button ref, and its focus effect above the empty-questions early return.
  • WorkflowVersionList: move the version grouping and expandedGroups state above the empty-list early return. groupWorkflowVersions already handles an empty array.
  • LineComponent: rename the inner _LineComponent to LineComponentBase. The leading underscore made the rule treat it as a plain function rather than a component. displayName and the memo export are unchanged.

Verification

  • npm run lint: 0 errors (265 pre-existing warnings, unchanged).
  • npx tsc --noEmit: no errors in the touched files.

Hoist hooks above early returns in ScreenshotModal, ClarifyingQuestionsPreview
and WorkflowVersionList, and rename the memo-wrapped LineComponent inner
function so the rule recognises it as a component.
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.

1 participant