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-effectVerified import paths — ran on the pinned version, not inferred.
Setup ESLint config to use the plugin with the strict config or custom rules, detecting unnecessary useEffect usage.
Remove the rule from your config; if you still need the check, consider using alternatives like forwardRef.
Upgrade ESLint to >=8.40.0, or use an older version of the plugin if necessary.
Use the flat config export: import plugin from 'eslint-plugin-react-you-might-not-need-an-effect'; export default [plugin.configs['flat/recommended']];
Use 'react-you-might-not-need-an-effect/no-unnecessary-use-effect' instead of any previous name.
npm install eslint-plugin-react-you-might-not-need-an-effect --save-dev
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'.
Use plugin.configs['flat/recommended'] instead of plugin.configs.recommended in flat configs.