{"id":19894,"library":"eslint-plugin-react-hook-form","title":"eslint-plugin-react-hook-form","description":"ESLint plugin for react-hook-form that enforces best practices and catches common mistakes during development. Current stable version is 0.3.1, with irregular release cadence (latest release May 2023). Provides rules like 'destructuring-formstate', 'no-access-control', 'no-nested-object-setvalue', and 'no-use-watch'. Differentiators: specifically targets react-hook-form API misuse (e.g., formState destructuring, control property access, nested objects in setValue, watch usage). Integrates via plugins and extends in ESLint config.","status":"active","version":"0.3.1","language":"javascript","source_language":"en","source_url":"https://github.com/andykao1213/eslint-plugin-react-hook-form","tags":["javascript","react","react-hook-form","eslint","eslintplugin","eslint-plugin"],"install":[{"cmd":"npm install eslint-plugin-react-hook-form","lang":"bash","label":"npm"},{"cmd":"yarn add eslint-plugin-react-hook-form","lang":"bash","label":"yarn"},{"cmd":"pnpm add eslint-plugin-react-hook-form","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency required to use the plugin","package":"eslint","optional":false}],"imports":[{"note":"In ESLint config, do not include 'eslint-plugin-' prefix; use 'plugin:react-hook-form/recommended'.","wrong":"extends: ['eslint-plugin-react-hook-form/recommended']","symbol":"configs.recommended","correct":"extends: ['plugin:react-hook-form/recommended']"},{"note":"Use string severity ('error','warn','off') rather than numeric values. Prefix rule name with 'react-hook-form/'.","wrong":"rules: {'react-hook-form/destructuring-formstate': 2}","symbol":"rules","correct":"rules: {'react-hook-form/destructuring-formstate': 'error'}"},{"note":"ESLint automatically strips 'eslint-plugin-' prefix when specifying plugins.","wrong":"plugins: ['eslint-plugin-react-hook-form']","symbol":"Plugin import (ESLint config)","correct":"plugins: ['react-hook-form']"}],"quickstart":{"code":"// .eslintrc.json\n{\n  \"plugins\": [\"react-hook-form\"],\n  \"rules\": {\n    \"react-hook-form/destructuring-formstate\": \"error\",\n    \"react-hook-form/no-access-control\": \"warn\",\n    \"react-hook-form/no-nested-object-setvalue\": \"error\",\n    \"react-hook-form/no-use-watch\": \"warn\"\n  }\n}\n\n// Alternatively, use recommended config:\n{\n  \"extends\": \"plugin:react-hook-form/recommended\"\n}","lang":"javascript","description":"Shows how to configure the ESLint plugin in .eslintrc.json, either by specifying individual rules or extending the recommended config."},"warnings":[{"fix":"Ensure ESLint is run on files that import react-hook-form and that the plugin is included in the ESLint configuration.","message":"Rules only apply to files using react-hook-form; the plugin does not detect if react-hook-form is installed.","severity":"gotcha","affected_versions":"all"},{"fix":"Disable the rule or add inline exceptions using eslint-disable comments.","message":"Rule 'no-access-control' may report false positives if control is used legitimately (e.g., custom register).","severity":"deprecated","affected_versions":">=0.2.1"},{"fix":"Manually review calls to setValue with array arguments.","message":"The 'no-nested-object-setvalue' rule only flags nested objects in the second argument of setValue, but does not catch deep nesting in arrays.","severity":"gotcha","affected_versions":">=0.2.1"},{"fix":"Override rules in your config if different severity is desired.","message":"The recommended config sets 'destructuring-formstate' and 'no-nested-object-setvalue' as errors, 'no-access-control' as warning, and does not include 'no-use-watch'.","severity":"gotcha","affected_versions":">=0.2.1"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run npm install eslint-plugin-react-hook-form --save-dev and ensure plugins array contains 'react-hook-form' (not 'eslint-plugin-react-hook-form').","cause":"Plugin not installed or incorrectly referenced in ESLint config.","error":"Error: Failed to load plugin 'react-hook-form' declared in '...'"},{"fix":"Check that plugin is listed in plugins array and rule name is correct. Verify plugin version supports the rule.","cause":"Rule name misspelled or plugin not loaded properly.","error":"Definition for rule 'react-hook-form/destructuring-formstate' was not found"},{"fix":"Run npm install eslint-plugin-react-hook-form --save-dev.","cause":"npm package not installed in the project.","error":"Cannot find module 'eslint-plugin-react-hook-form'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}