Registry / testing / eslint-plugin-react-hook-form

eslint-plugin-react-hook-form

JSON →
library0.3.1jsnpmunverified

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.

npm install eslint-plugin-react-hook-form
INSTALL
IMPORT
SIG · ESLINT-PLUGIN-REAC
E
eslint-plugin-react-hook-form
testingjavascriptv0.3.1
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.

configs.recommended
extends: ['plugin:react-hook-form/recommended']
extends: ['eslint-plugin-react-hook-form/recommended']
In ESLint config, do not include 'eslint-plugin-' prefix; use 'plugin:react-hook-form/recommended'.
rules
rules: {'react-hook-form/destructuring-formstate': 'error'}
rules: {'react-hook-form/destructuring-formstate': 2}
Use string severity ('error','warn','off') rather than numeric values. Prefix rule name with 'react-hook-form/'.
Plugin import (ESLint config)
plugins: ['react-hook-form']
plugins: ['eslint-plugin-react-hook-form']
ESLint automatically strips 'eslint-plugin-' prefix when specifying plugins.

Shows how to configure the ESLint plugin in .eslintrc.json, either by specifying individual rules or extending the recommended config.

// .eslintrc.json { "plugins": ["react-hook-form"], "rules": { "react-hook-form/destructuring-formstate": "error", "react-hook-form/no-access-control": "warn", "react-hook-form/no-nested-object-setvalue": "error", "react-hook-form/no-use-watch": "warn" } } // Alternatively, use recommended config: { "extends": "plugin:react-hook-form/recommended" }
Debug
Known issues
gotchaRules only apply to files using react-hook-form; the plugin does not detect if react-hook-form is installed.
fix
Ensure ESLint is run on files that import react-hook-form and that the plugin is included in the ESLint configuration.
affects: all
deprecatedRule 'no-access-control' may report false positives if control is used legitimately (e.g., custom register).
fix
Disable the rule or add inline exceptions using eslint-disable comments.
affects: >=0.2.1
gotchaThe 'no-nested-object-setvalue' rule only flags nested objects in the second argument of setValue, but does not catch deep nesting in arrays.
fix
Manually review calls to setValue with array arguments.
affects: >=0.2.1
gotchaThe recommended config sets 'destructuring-formstate' and 'no-nested-object-setvalue' as errors, 'no-access-control' as warning, and does not include 'no-use-watch'.
fix
Override rules in your config if different severity is desired.
affects: >=0.2.1
Errors
Common errors & fixes
Error: Failed to load plugin 'react-hook-form' declared in '...'
Plugin not installed or incorrectly referenced in ESLint config.
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').
Definition for rule 'react-hook-form/destructuring-formstate' was not found
Rule name misspelled or plugin not loaded properly.
fix
Check that plugin is listed in plugins array and rule name is correct. Verify plugin version supports the rule.
Cannot find module 'eslint-plugin-react-hook-form'
npm package not installed in the project.
fix
Run npm install eslint-plugin-react-hook-form --save-dev.
Upgrade
Version history
0.3.1latest on npm
Audit
Dependencies
eslintrequiredpeer dependency required to use the plugin
Agent activity
2 hits · last 30 days
node
2
Resources
eslint-plugin-react-hook-form — npm install eslint-plugin-react-hook-form · libregistry