eslint-plugin-react-hook-form
Advanced tools
Comparing version
@@ -17,7 +17,14 @@ /** | ||
// import all rules in lib/rules | ||
module.exports.rules = requireIndex(__dirname + "/rules"); | ||
module.exports.configs = { | ||
recommended: { | ||
plugins: ["react-hook-form"], | ||
rules: { | ||
"react-hook-form/destructuring-formstate": "error", | ||
"react-hook-form/no-access-control": "error", | ||
"react-hook-form/no-nested-object-setvalue": "error", | ||
}, | ||
}, | ||
}; |
{ | ||
"name": "eslint-plugin-react-hook-form", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "ESLint plugin for react-hook-form", | ||
@@ -12,6 +12,8 @@ "keywords": [ | ||
], | ||
"author": "Andrew Kao", | ||
"author": "Andrew Kao <andykao1213@gmail.com>", | ||
"main": "lib/index.js", | ||
"repository": "https://github.com/andykao1213/eslint-plugin-react-hook-form.git", | ||
"scripts": { | ||
"test": "mocha tests --recursive" | ||
"test": "mocha tests --recursive", | ||
"release": "standard-version" | ||
}, | ||
@@ -23,3 +25,4 @@ "dependencies": { | ||
"eslint": "^7.1.0", | ||
"mocha": "^7.2.0" | ||
"mocha": "^7.2.0", | ||
"standard-version": "^9.3.0" | ||
}, | ||
@@ -26,0 +29,0 @@ "engines": { |
# eslint-plugin-react-hook-form | ||
[](https://www.npmjs.com/package/eslint-plugin-react-hook-form) | ||
[](LICENSE) | ||
[react-hook-form](https://github.com/react-hook-form/react-hook-form) is an awsome library which provide a neat solution for building forms. However, there are many rules for the API which may be missed by the developer. This plugin aims to check those rules automatically thourgh ESLint. Thus brings better DX for react-hook-form. | ||
@@ -39,4 +42,28 @@ | ||
or start with the recommended rule set: | ||
```json | ||
{ | ||
"extends": "plugin:react-hook-form/recommended" | ||
} | ||
``` | ||
## Supported Rules | ||
- [destructuring-formState](docs/rules/destructuring-formstate.md) | ||
| Rule | Description | Recommended | Fixable | | ||
| -------------------------------------------------------------------- | --------------------------------------------------------------------- | ----------- | ------- | | ||
| [destructuring-formState](docs/rules/destructuring-formstate.md) | Use destructuring assignment to access the properties of `formState`. | ⛔️ | | | ||
| [no-access-control](docs/rules/no-access-control.md) | Avoid accessing the properties of `control` | ⛔️ | | | ||
| [no-nested-object-setvalue](docs/rules/no-nested-object-setvalue.md) | Avoid nested object in second argument of `setValue` | ⛔️ | 🔧 | | ||
### Key | ||
| Icon | Description | | ||
| ---- | ----------------------------------------------- | | ||
| ⛔️ | Reports as error in recommended configuration | | ||
| ⚠️ | Reports as warning in recommended configuration | | ||
| 🔧 | Rule is fixable with `eslint --fix` | | ||
## License | ||
[MIT](LICENSE) |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
34098
196.94%21
110%606
175.45%69
64.29%0
-100%3
50%