This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
An ESLint plugin that enforces best practices for react-hook-form. Written in plain JavaScript (CommonJS, no TypeScript, no build step).
- Run all tests:
npm test(runsmocha tests --recursive) - Run a single test file:
npx mocha tests/lib/rules/<rule-name>.js - Lint: No linter is configured for this project itself.
The plugin uses the standard ESLint plugin structure with no build step — source files in lib/ are the published artifacts.
lib/index.js— Plugin entry point. Usesrequireindexto auto-discover all rules fromlib/rules/. Defines two config presets:recommendedandreact-compiler.lib/rules/— One file per ESLint rule. Each exports a standard ESLint rule object withmeta(type, docs, messages) andcreate(context)returning AST visitor methods.lib/utils/— Shared helpers used across rules (e.g.,findPropertyByNamefor extracting destructured properties from AST nodes).tests/lib/rules/— One test file per rule using ESLint'sRuleTesterwith mocha. Tests use anormalizeIndenttagged template helper fromtests/lib/utils/.docs/rules/— One markdown doc per rule.
| Rule | In recommended |
Fixable |
|---|---|---|
destructuring-formstate |
Yes | No |
no-access-control |
Yes | No |
no-nested-object-setvalue |
Yes | Yes |
no-use-watch |
No (in react-compiler config) |
No |
- Create
lib/rules/<rule-name>.js— it will be auto-discovered byrequireindex. - Create
tests/lib/rules/<rule-name>.jsusingRuleTester. - Create
docs/rules/<rule-name>.md. - Add the rule to the appropriate config in
lib/index.jsif it should be in a preset. - Update the Supported Rules table in
README.md.
- Do NOT include
Co-Authored-Bylines in commit or PR messages.