Registry / testing / eslint-plugin-react-you-might-not-need-an-effect

eslint-plugin-react-you-might-not-need-an-effect

JSON →
library0.9.3jsnpmunverified

An ESLint plugin (v0.9.3, updated April 2026) that warns against unnecessary React useEffect hooks by detecting patterns where effects are synchronous or could be replaced with derived state, event handlers, or other React patterns. It encourages following the principle 'You Might Not Need an Effect' from the React docs. Unlike general React lint rules, this plugin specifically targets overuse of useEffect and provides auto-fix suggestions. Requires ESLint >=8.40.0 and Node >=14.0.0. Written in TypeScript, ships with types. The recommended and strict configs are included. Supports both flat and legacy ESLint configs.

testing
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Default import works in both ESM and CJS. For ESM, use the default import; for CJS, use require. The plugin also exports a flat config compatible version.

import plugin from 'eslint-plugin-react-you-might-not-need-an-effect'

The correct named export is 'rules' (plural), not 'rule'. This gives access to the rule definitions dictionary.

import { rules } from 'eslint-plugin-react-you-might-not-need-an-effect'

Use 'configs' to access built-in configs like 'recommended' or 'strict'. For flat config, use configs['flat/recommended'].

import { configs } from 'eslint-plugin-react-you-might-not-need-an-effect'

Setup ESLint config to use the plugin with the strict config or custom rules, detecting unnecessary useEffect usage.

// .eslintrc.json { "plugins": ["react-you-might-not-need-an-effect"], "extends": ["plugin:react-you-might-not-need-an-effect/strict"], "rules": { "react-you-might-not-need-an-effect/no-unnecessary-use-effect": "warn" } } // Or with flat config (eslint.config.js) import plugin from 'eslint-plugin-react-you-might-not-need-an-effect'; export default [ plugin.configs['flat/recommended'], // or { plugins: { 'react-you-might-not-need-an-effect': plugin }, rules: { 'react-you-might-not-need-an-effect/no-unnecessary-use-effect': 'error', }, }, ];
Debug
Known footguns
breakingRule 'no-pass-ref-to-parent' was removed in v0.9.0.
gotchaThe plugin requires ESLint >=8.40.0. Using older ESLint versions will cause errors.
gotchaFlat config users must use configs['flat/recommended'] or provide plugin object correctly.
deprecatedThe rule 'no-unnecessary-use-effect' replaces older rule names; check your config for deprecated rule IDs.
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
9 hits · last 30 days
gptbot
4
ahrefsbot
4
script
1
Resources