Skip to content

📎 React 19.2: add useEffectEvent semantics to useExhaustiveDependencies and recognise <Activity /> #7631

@barklund

Description

@barklund

Description

React 19.2 adds two built-ins that Biome should understand:

Summary

React 19.2 introduces two new built-ins that Biome should support:

Why

  • Align Biome’s useExhaustiveDependencies rule with React 19.2 semantics so developers don’t get false positives when using Effect Events.
  • Keep Biome’s React API list up to date by recognising new built-ins introduced in React releases.

Proposed changes

  • In use_exhaustive_dependencies.rs, treat useEffectEvent like useRef:

    • Calls to useEffectEvent should be recognised as producing a stable, ref-like value that is never added to dependency arrays.
    • Example:
      const onConnected = useEffectEvent(() => { ... });
      useEffect(() => { ... }, []); // should not warn about missing `onConnected`
    • Update the test suite by adding representative cases to valid.js (no missing dep warning for Effect Events) and missingDependenciesInvalid.jsx (ensure adding an Effect Event is flagged as unnecessary).
  • In react.rs, add:

    • useEffectEvent to the known React Hooks list.
    • Activity to the known React Components list.
    • Example:
      import { Activity } from "react";
      <Activity />; // should be recognised as a React API element

Metadata

Metadata

Assignees

Labels

A-LinterArea: linterD-ReactDomain: ReactL-JavaScriptLanguage: JavaScript and super languagesS-EnhancementStatus: Improve an existing feature

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions