Fix use-before-define, unpin eslint-plugin-react-hooks#144
Merged
Conversation
eslint-plugin-react-hooks 7.1.x adds a 'use-before-define' rule that flagged two pre-existing patterns: - connectors/store/page.tsx: useEffect referenced handleImportClick before the function was declared. - settings/license/page.tsx: useEffect referenced loadStatus before the function was declared. Both cases were temporally safe at runtime (the useEffect only runs during render, by which point the function exists), but the rule is correct that the order is hostile to readers and to React Compiler's analysis. Moving the function declarations above the useEffects satisfies the rule. Removes the temporary 7.0.1 pin from the root overrides — the rxjs override is enough to keep the workspace deduped, and react-hooks is now free to follow upstream.
f8beb27 to
8929276
Compare
Merged
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
Closes the technical debt left by PR #142 (the temporary
eslint-plugin-react-hooks: 7.0.1pin in root overrides).What changed
packages/frontend/src/app/connectors/store/page.tsx: moved `handleImportClick` and `doImport` declarations above the `useEffect` that references `handleImportClick`.packages/frontend/src/app/settings/license/page.tsx: moved `loadStatus` declaration above the `useEffect` that references it.package.json: removed the `eslint-plugin-react-hooks: 7.0.1` override. The plugin now follows upstream (resolved to 7.1.x via eslint-config-next).Why
`eslint-plugin-react-hooks` 7.1.x added a `react-hooks/use-before-define` rule. Both patterns were temporally safe at runtime (effects run after the function exists in scope), but the rule is correct that the order is hostile to readers and prevents React Compiler from analyzing the dependency graph cleanly.
Test plan