# @wogns3623/eslint-plugin-better-exhaustive-deps

> Better ESLint rules for React Hooks

Latest version **1.2.5** (published 2026-05-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install @wogns3623/eslint-plugin-better-exhaustive-deps
pnpm add @wogns3623/eslint-plugin-better-exhaustive-deps
yarn add @wogns3623/eslint-plugin-better-exhaustive-deps
bun add @wogns3623/eslint-plugin-better-exhaustive-deps
```

## Health

**Score 55/100 (C)** — status: active.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

## Facts

| | |
|---|---|
| Version | 1.2.5 |
| Published | 2026-05-27 |
| First published | 2022-05-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=10 |
| Dependencies | 0 |
| Unpacked size | 31.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 16 |
| Maintainers | wogns3623 |
| Keywords | eslint, eslint-plugin, eslintplugin, react, react-hooks, react-hooks/exhaustive-deps |

## Links

- npm: https://www.npmjs.com/package/@wogns3623/eslint-plugin-better-exhaustive-deps
- Repository: https://github.com/wogns3623/eslint-plugin-better-exhaustive-deps
- Issues: https://github.com/wogns3623/eslint-plugin-better-exhaustive-deps/issuess
- npm.io page: https://npm.io/package/@wogns3623/eslint-plugin-better-exhaustive-deps

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.2.5 (latest) — 2026-05-27
- 1.2.4 — 2026-04-18
- 1.2.3 — 2026-02-22
- 1.2.2 — 2025-04-08
- 1.2.1 — 2025-02-23
- 1.2.0 — 2025-02-22
- 1.1.1 — 2025-02-22
- 1.1.0 — 2022-05-22
- 1.0.0 — 2022-05-13

## README

# Better react exhaustive-deps eslint plugin with static variable check

## Installation

```bash
yarn add -D @wogns3623/eslint-plugin-better-exhaustive-deps
# or
pnpm i -D @wogns3623/eslint-plugin-better-exhaustive-deps
# or
npm i -D @wogns3623/eslint-plugin-better-exhaustive-deps
```

## Usage

For [ESLint 9.0.0 and above](https://eslint.org/blog/2024/04/eslint-v9.0.0-released/) users, add the `recommended-latest` config.

```javascript
import betterHooks from "@wogns3623/eslint-plugin-better-exhaustive-deps";

module.exports = [
  // ...
  betterHooks.configs["recommended-latest"],
];
```

### Legacy Config (.eslintrc)

If you are still using ESLint below 9.0.0, please continue to use `recommended-legacy`. To avoid breaking changes, we still support `recommended` as well, but note that this will be changed to alias the flat recommended config in v6.

```js
{
  "extends": [
    // ...
    "plugin:@wogns3623/better-exhaustive-deps/recommended-legacy"
  ]
}
```

## Custom Configuration

To use this plugin, you must disable original `react-hooks/exhaustive-deps` rule

```js
import reactHooks from "eslint-plugin-react-hooks";
import betterHooks from "@wogns3623/eslint-plugin-better-exhaustive-deps";

export default [
  {
    files: ["**/*.{js,jsx}"],
    plugins: {
      "react-hooks": reactHooks,
      "@wogns3623/better-exhaustive-deps": betterHooks,
    },
    // ...
    rules: {
      // disable original rule
      "react-hooks/exhaustive-deps": "off",
      "@wogns3623/better-exhaustive-deps/exhaustive-deps": "warn",
    },
  },
];
```

### Legacy Config (.eslintrc)

```js
module.exports = {
  plugins: [
    // ...
    "@wogns3623/better-exhaustive-deps",
  ],
  rules: {
    // disable original rule
    "react-hooks/exhaustive-deps": "off",
    "@wogns3623/better-exhaustive-deps/exhaustive-deps": "warn",
  },
};
```

## Advanced Configuration

### checkMemoizedVariableIsStatic

Check variable memoized by `useCallback` or `useMemo` is static.

If Deps is empty or filled with static variable, the return value is also treated as a static variable.

```javascript
module.exports = {
  // ...
  rules: {
    // disable original rule
    "react-hooks/exhaustive-deps": "off",
    "@wogns3623/better-exhaustive-deps/exhaustive-deps": [
      "warn",
      {
        checkMemoizedVariableIsStatic: true,
      },
    ],
  },
  // ...
};
```

### staticHooks

Return values ​​registered as true are treated as static variable.

Can configure destructured value independently.

```javascript
module.exports = {
  // ...
  rules: {
    // disable original rule
    "react-hooks/exhaustive-deps": "off",
    "@wogns3623/better-exhaustive-deps/exhaustive-deps": [
      "warn",
      {
        staticHooks: {
          useCustomRef: true,
          useSomething: [false, true],
          useSomethingOther: {
            value: false,
            callback: true,
          },
        },
      },
    ],
  },
  // ...
};
```

> use [grncdr](https://github.com/grncdr)'s code
> [https://github.com/facebook/react/issues/16873#issuecomment-536346885](https://github.com/facebook/react/issues/16873#issuecomment-536346885)

## TODO

- [x] Check callback generated by useCallback is immutable
- [x] Add test code for staticHooks
- [x] Update test code for checkMemoizedVariableIsStatic
- [ ] Create a rule to check for unnecessary static (stable) values in dependency list.
- [ ] Add presets for popular React libraries
- [ ] Add automatic inference for whether a custom hook return value is static or not
- [ ] Add deep nested object support for staticHooks
- [ ] Support glob patter matching in staticHooks

---
_Source: https://npm.io/package/@wogns3623/eslint-plugin-better-exhaustive-deps · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
