-
-
Notifications
You must be signed in to change notification settings - Fork 715
Labels
A-LinterArea: linterArea: linterD-ReactDomain: ReactDomain: ReactL-JavaScriptLanguage: JavaScript and super languagesLanguage: JavaScript and super languagesS-EnhancementStatus: Improve an existing featureStatus: Improve an existing feature
Description
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:
- The new built-in hook
useEffectEvent
has a stable, ref-like return value that must not be added to dependency arrays (should be treated likeuseRef
). - The new built-in component
<Activity />
should be added to the list of known React API elements.
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
, treatuseEffectEvent
likeuseRef
:- 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).
- Calls to
-
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
Malin88, kkhys, Rihyx, yuheitomi, debuglebowski and 12 more
Metadata
Metadata
Assignees
Labels
A-LinterArea: linterArea: linterD-ReactDomain: ReactDomain: ReactL-JavaScriptLanguage: JavaScript and super languagesLanguage: JavaScript and super languagesS-EnhancementStatus: Improve an existing featureStatus: Improve an existing feature