{"id":19909,"library":"eslint-plugin-react-you-might-not-need-an-effect","title":"eslint-plugin-react-you-might-not-need-an-effect","description":"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.","status":"active","version":"0.9.3","language":"javascript","source_language":"en","source_url":"https://github.com/NickvanDyke/eslint-plugin-react-you-might-not-need-an-effect","tags":["javascript","eslint","eslintplugin","eslint-plugin","react"],"install":[{"cmd":"npm install eslint-plugin-react-you-might-not-need-an-effect","lang":"bash","label":"npm"},{"cmd":"yarn add eslint-plugin-react-you-might-not-need-an-effect","lang":"bash","label":"yarn"},{"cmd":"pnpm add eslint-plugin-react-you-might-not-need-an-effect","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency required for plugin to work","package":"eslint","optional":false},{"reason":"recommended peer dependency for React projects but not required for basic linting","package":"react","optional":true}],"imports":[{"note":"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.","wrong":"const plugin = require('eslint-plugin-react-you-might-not-need-an-effect')","symbol":"plugin","correct":"import plugin from 'eslint-plugin-react-you-might-not-need-an-effect'"},{"note":"The correct named export is 'rules' (plural), not 'rule'. This gives access to the rule definitions dictionary.","wrong":"import { rule } from 'eslint-plugin-react-you-might-not-need-an-effect'","symbol":"rules","correct":"import { rules } from 'eslint-plugin-react-you-might-not-need-an-effect'"},{"note":"Use 'configs' to access built-in configs like 'recommended' or 'strict'. For flat config, use configs['flat/recommended'].","symbol":"configs","correct":"import { configs } from 'eslint-plugin-react-you-might-not-need-an-effect'"}],"quickstart":{"code":"// .eslintrc.json\n{\n  \"plugins\": [\"react-you-might-not-need-an-effect\"],\n  \"extends\": [\"plugin:react-you-might-not-need-an-effect/strict\"],\n  \"rules\": {\n    \"react-you-might-not-need-an-effect/no-unnecessary-use-effect\": \"warn\"\n  }\n}\n\n// Or with flat config (eslint.config.js)\nimport plugin from 'eslint-plugin-react-you-might-not-need-an-effect';\nexport default [\n  plugin.configs['flat/recommended'],\n  // or\n  {\n    plugins: { 'react-you-might-not-need-an-effect': plugin },\n    rules: {\n      'react-you-might-not-need-an-effect/no-unnecessary-use-effect': 'error',\n    },\n  },\n];","lang":"typescript","description":"Setup ESLint config to use the plugin with the strict config or custom rules, detecting unnecessary useEffect usage."},"warnings":[{"fix":"Remove the rule from your config; if you still need the check, consider using alternatives like forwardRef.","message":"Rule 'no-pass-ref-to-parent' was removed in v0.9.0.","severity":"breaking","affected_versions":">=0.9.0"},{"fix":"Upgrade ESLint to >=8.40.0, or use an older version of the plugin if necessary.","message":"The plugin requires ESLint >=8.40.0. Using older ESLint versions will cause errors.","severity":"gotcha","affected_versions":"<0.8.0"},{"fix":"Use the flat config export: import plugin from 'eslint-plugin-react-you-might-not-need-an-effect'; export default [plugin.configs['flat/recommended']];","message":"Flat config users must use configs['flat/recommended'] or provide plugin object correctly.","severity":"gotcha","affected_versions":">=0.9.0"},{"fix":"Use 'react-you-might-not-need-an-effect/no-unnecessary-use-effect' instead of any previous name.","message":"The rule 'no-unnecessary-use-effect' replaces older rule names; check your config for deprecated rule IDs.","severity":"deprecated","affected_versions":">=0.8.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"npm install eslint-plugin-react-you-might-not-need-an-effect --save-dev","cause":"Plugin not installed or not in node_modules.","error":"ESLint configuration error: Cannot read plugin 'react-you-might-not-need-an-effect'"},{"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'.","cause":"Incorrect rule name or missing rule registration.","error":"ESLint: Error while loading rule 'react-you-might-not-need-an-effect/no-unnecessary-use-effect': Rule not found"},{"fix":"Use plugin.configs['flat/recommended'] instead of plugin.configs.recommended in flat configs.","cause":"Using flat config import with legacy config or wrong syntax.","error":"TypeError: Cannot read properties of undefined (reading 'flat')"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}