Skip to content

📎 Add reactCompiler option for useExhaustiveDependencies #5293

Open
@arendjr

Description

@arendjr

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-LinterArea: linterD-ReactDomain: ReactL-JavaScriptLanguage: JavaScript and super languagesS-Help-wantedStatus: you're familiar with the code base and want to help the projectS-Needs discussionStatus: needs a discussion to understand criteriagood first issueGood for newcomers

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions