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.

npm install eslint-plugin-react-you-might-not-need-an-effect
INSTALL
IMPORT
SIG · ESLINT-PLUGIN-REAC
E
eslint-plugin-react-you-might-not-need-an-effect
testingjavascriptv0.9.3
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
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.

plugin
import plugin from 'eslint-plugin-react-you-might-not-need-an-effect'
const plugin = require('eslint-plugin-react-you-might-not-need-an-effect')
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.
rules
import { rules } from 'eslint-plugin-react-you-might-not-need-an-effect'
import { rule } 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.
configs
import { configs } 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'].

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 issues
breakingRule 'no-pass-ref-to-parent' was removed in v0.9.0.
fix
Remove the rule from your config; if you still need the check, consider using alternatives like forwardRef.
affects: >=0.9.0
gotchaThe plugin requires ESLint >=8.40.0. Using older ESLint versions will cause errors.
fix
Upgrade ESLint to >=8.40.0, or use an older version of the plugin if necessary.
affects: <0.8.0
gotchaFlat config users must use configs['flat/recommended'] or provide plugin object correctly.
fix
Use the flat config export: import plugin from 'eslint-plugin-react-you-might-not-need-an-effect'; export default [plugin.configs['flat/recommended']];
affects: >=0.9.0
deprecatedThe rule 'no-unnecessary-use-effect' replaces older rule names; check your config for deprecated rule IDs.
fix
Use 'react-you-might-not-need-an-effect/no-unnecessary-use-effect' instead of any previous name.
affects: >=0.8.0
Errors
Common errors & fixes
ESLint configuration error: Cannot read plugin 'react-you-might-not-need-an-effect'
Plugin not installed or not in node_modules.
fix
npm install eslint-plugin-react-you-might-not-need-an-effect --save-dev
ESLint: Error while loading rule 'react-you-might-not-need-an-effect/no-unnecessary-use-effect': Rule not found
Incorrect rule name or missing rule registration.
fix
Ensure the plugin is added to the plugins array and the rule name matches exactly 'react-you-might-not-need-an-effect/no-unnecessary-use-effect'.
TypeError: Cannot read properties of undefined (reading 'flat')
Using flat config import with legacy config or wrong syntax.
fix
Use plugin.configs['flat/recommended'] instead of plugin.configs.recommended in flat configs.
Upgrade
Version history
0.9.3latest on npm
Audit
Dependencies
eslintrequiredpeer dependency required for plugin to work
reactoptionalrecommended peer dependency for React projects but not required for basic linting
Agent activity
6 hits · last 30 days
node
4
OpenAI (training)
2
Resources
eslint-plugin-react-you-might-not-need-an-effect — npm install eslint-plugin-react-you-might-not-need-an-effect · libregistry