Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/upset-apes-reply.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@biomejs/biome": minor
---

React 19.2 support is now supported in Biome:
- Treats `useEffectEvent` like `useRef` in [`useExhaustiveDependencies`](https://biomejs.dev/linter/rules/use-exhaustive-dependencies/)
- Added `<Activity />` to known React APIs.
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ declare_lint_rule! {
/// - `useDebugValue`
/// - `useDeferredValue`
/// - `useTransition`
/// - `useEffectEvent`
///
/// If you want to add more hooks to the rule, check the [options](#options).
///
Expand Down Expand Up @@ -303,6 +304,7 @@ impl Default for HookConfigMaps {
true,
),
StableReactHookConfiguration::new("useRef", StableHookResult::Identity, true),
StableReactHookConfiguration::new("useEffectEvent", StableHookResult::Identity, true),
]);

Self {
Expand Down
4 changes: 3 additions & 1 deletion crates/biome_js_analyze/src/react.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ impl ReactLibrary {
/// List of valid [`React` API]
///
/// [`React` API]: https://reactjs.org/docs/react-api.html
const VALID_REACT_API: [&str; 29] = [
const VALID_REACT_API: [&str; 31] = [
"Component",
"PureComponent",
"memo",
Expand Down Expand Up @@ -173,6 +173,8 @@ const VALID_REACT_API: [&str; 29] = [
"useTransition",
"useId",
"useSyncExternalStore",
"Activity",
"useEffectEvent",
];

/// Checks if the current [JsCallExpression] is a potential [`React` API].
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
useState,
useReducer,
useTransition,
useEffectEvent,
} from "react";
import { useRef } from "unknown/hooks"

Expand All @@ -29,6 +30,7 @@ function MyComponent2() {
const memoizedValue = useMemo();
const deferredValue = useDeferredValue(value);
const [isPending, startTransition] = useTransition();
const event = useEffectEvent(() => {});
useEffect(() => {
console.log(name);
setName(1);
Expand All @@ -42,6 +44,7 @@ function MyComponent2() {

console.log(isPending);
startTransition();
event();
}, []);
}

Expand Down
Loading
Loading