Skip to content
← Back to rules

react/exhaustive-effect-dependencies Suspicious

What it does

Validates that effect dependency arrays are exhaustive and contain no extraneous values.

Powered by the React Compiler, which runs once per file and is shared with the other React Compiler rules. Port of react-hooks/exhaustive-effect-dependencies.

Why is this bad?

Missing effect dependencies capture stale values from a previous render; extraneous dependencies re-fire the effect needlessly.

How to use

To enable this rule using the config file or in the CLI, you can use:

json
{
  "plugins": ["react"],
  "rules": {
    "react/exhaustive-effect-dependencies": "error"
  }
}
ts
import { defineConfig } from "oxlint";

export default defineConfig({
  plugins: ["react"],
  rules: {
    "react/exhaustive-effect-dependencies": "error",
  },
});
bash
oxlint --deny react/exhaustive-effect-dependencies --react-plugin

Version

This rule was added in vnext.

References