# config

Rule `react-hooks/config`. Validates the compiler configuration options

- Source: react-hooks
- Technologies: React
- Kind: correctness
- Needs type information: no
- Autofix: yes, in at least one linter
- Reach: 165.2M weekly downloads of presets that enable it
- Trend: +28.2% last quarter
- Rank: #106 by reach, #1355 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `react-hooks/config` | yes | safe | package `eslint-plugin-react-hooks` | [docs](https://react.dev/reference/eslint-plugin-react-hooks/lints/config) |

## Code examples

### Incorrect: the rule reports this

```js
module.exports = {
  plugins: [
    ['babel-plugin-react-compiler', {
      compileMode: 'all' // Typo: should be compilationMode
    }]
  ]
};
```

```js
module.exports = {
  plugins: [
    ['babel-plugin-react-compiler', {
      compilationMode: 'everything' // Invalid: use 'all' or 'infer'
    }]
  ]
};
```

### Correct: the rule accepts this

```js
module.exports = {
  plugins: [
    ['babel-plugin-react-compiler', {
      compilationMode: 'infer',
      panicThreshold: 'critical_errors'
    }]
  ]
};
```

Examples from the ESLint documentation.

## Enable it

### ESLint: `eslint.config.js`

```js
import reactHooks from "eslint-plugin-react-hooks";

export default [
  {
    plugins: { "react-hooks": reactHooks },
    rules: {
      "react-hooks/config": "error",
    },
  },
];
```

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [React Hooks recommended](https://lintradar.dev/presets/react-hooks-recommended.md) | ESLint | `eslint-plugin-react-hooks` | 16 | 118.4M | +21.5% |
| [Next.js Core Web Vitals](https://lintradar.dev/presets/next-core-web-vitals.md) | ESLint | `eslint-config-next` | 62 | 46.8M | +48.8% |

## Related rules

- [react-hooks/use-memo](https://lintradar.dev/rules/react-hooks/use-memo.md): Validates usage of the useMemo() hook against common mistakes. See `useMemo()` docs for more information.
- [react-hooks/gating](https://lintradar.dev/rules/react-hooks/gating.md): Validates configuration of gating mode
- [react-hooks/unsupported-syntax](https://lintradar.dev/rules/react-hooks/unsupported-syntax.md): Validates against syntax that we do not plan to support in React Compiler
- [react-hooks/static-components](https://lintradar.dev/rules/react-hooks/static-components.md): Validates that components are static, not recreated every render. Components that are recreated dynamically can reset state and trigger excessive re-rendering
- [react-hooks/set-state-in-render](https://lintradar.dev/rules/react-hooks/set-state-in-render.md): Validates against setting state during render, which can trigger additional renders and potential infinite render loops
- [react-hooks/set-state-in-effect](https://lintradar.dev/rules/react-hooks/set-state-in-effect.md): Validates against calling setState synchronously in an effect. This can indicate non-local derived data, a derived event pattern, or improper external data synchronization.

---

Web page: https://lintradar.dev/rules/react-hooks/config. Data from npm and the linters' documentation, collected Dec 4, 2026. Site guide for agents: https://lintradar.dev/llms.txt
