Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

📎 Add reactCompiler option for useExhaustiveDependencies #5293

Open
arendjr opened this issue Mar 7, 2025 · 0 comments
Open

📎 Add reactCompiler option for useExhaustiveDependencies #5293

arendjr opened this issue Mar 7, 2025 · 0 comments
Labels
A-Linter Area: linter D-React Domain: React good first issue Good for newcomers L-JavaScript Language: JavaScript and super languages S-Help-wanted Status: you're familiar with the code base and want to help the project S-Needs discussion Status: needs a discussion to understand criteria

Comments

@arendjr
Copy link
Contributor

arendjr commented Mar 7, 2025

Description

useExhaustiveDependencies currently reports a diagnostic when using functions that are not wrapped with useCallback as dependency: “[myFunc] changes on every re-render and should not be used as a hook dependency”.

This diagnostic is not accurate for users of the React Compiler, since it automatically wraps such functions.

To resolve this, I agree with this comment that we should introduce an option for this.

Before starting work on this, I think we need to agree what to call the option and where to place it. I think having a single reactCompiler option makes sense, so that if we need other changes to accommodate the React Compiler users still only need to set one option. But that leaves the question whether it should be on the useExhaustiveDependencies rule, or if other React-related rules may also benefit from this, in which case we may prefer to move it up. Suggestions welcome!

@arendjr arendjr added A-Linter Area: linter D-React Domain: React good first issue Good for newcomers L-JavaScript Language: JavaScript and super languages S-Help-wanted Status: you're familiar with the code base and want to help the project S-Needs discussion Status: needs a discussion to understand criteria labels Mar 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Linter Area: linter D-React Domain: React good first issue Good for newcomers L-JavaScript Language: JavaScript and super languages S-Help-wanted Status: you're familiar with the code base and want to help the project S-Needs discussion Status: needs a discussion to understand criteria
Projects
None yet
Development

No branches or pull requests

1 participant