CLI:
Version: 1.5.2
Color support: true
Platform:
CPU Architecture: x86_64
OS: linux
Environment:
BIOME_LOG_DIR: unset
NO_COLOR: unset
TERM: "xterm-256color"
JS_RUNTIME_VERSION: "v20.9.0"
JS_RUNTIME_NAME: "node"
NODE_PACKAGE_MANAGER: "pnpm/8.10.2"
Biome Configuration:
Status: Loaded successfully
Formatter disabled: false
Linter disabled: false
Organize imports disabled: false
VCS disabled: true
Workspace:
Open Documents: 0
useExhaustiveDependencies
https://codesandbox.io/p/devbox/biome-shnrcy?file=%2Fsrc%2FApp.tsx
If useRef type is define using type assertion and when ref is used in any react hook, exhaustive deps breaks.
Works fine
import { useEffect, useRef } from "react";
const App = () => {
const ref = useRef<HTMLDivElement>();
useEffect(() => {
console.log(ref.current);
}, []);
return <div>Hello World</div>;
};
export default App;
Throw error This hook does not specify all of its dependencies.
import { type MutableRefObject, useEffect, useRef } from "react";
const App = () => {
const ref = useRef() as MutableRefObject<HTMLDivElement>;
useEffect(() => {
console.log(ref.current);
}, []);
return <div>Hello World</div>;
};
export default App;
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too