eslint-plugin-react-hooks-docs
Advanced tools
Comparing version
{ | ||
"name": "eslint-plugin-react-hooks-docs", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "Eslint plugin to enforce react hooks documentation", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -1,27 +0,12 @@ | ||
<h1 align="center"> eslint-plugin-react-hooks-docs </h1> | ||
# eslint-plugin-react-hooks-docs | ||
<p align="center"> | ||
<a href="https://github.com/a-tokyo/eslint-plugin-react-hooks-docs/stargazers"> | ||
<img alt="GitHub stars" src="https://img.shields.io/github/stars/a-tokyo/eslint-plugin-react-hooks-docs?color=0d1117&style=for-the-badge&colorA=1C1D27"> | ||
</a> | ||
<a href="https://github.com/a-tokyo/eslint-plugin-react-hooks-docs/network"> | ||
<img alt="GitHub forks" src="https://img.shields.io/github/forks/a-tokyo/eslint-plugin-react-hooks-docs?color=0d1117&style=for-the-badge&colorA=1C1D27"> | ||
</a> | ||
<a href="https://github.com/a-tokyo/eslint-plugin-react-hooks-docs/issues"> | ||
<img alt="GitHub issues" src="https://img.shields.io/github/issues/a-tokyo/eslint-plugin-react-hooks-docs?style=for-the-badge&color=0d1117&colorA=1C1D27"> | ||
</a> | ||
<a href="httdivs://github.com/a-tokyo/eslint-plugin-react-hooks-docs/blob/develop/LICENSE"> | ||
<img alt="GitHub license" src="https://img.shields.io/github/license/a-tokyo/eslint-plugin-react-hooks-docs?color=0d1117&style=for-the-badge&colorA=1C1D27" /> | ||
</a> | ||
<a href="https://www.npmjs.com/package/eslint-plugin-react-hooks-docs"> | ||
<img alt="NPM" src="https://img.shields.io/npm/dt/eslint-plugin-react-hooks-docs?color=0d1117&style=for-the-badge&colorA=1C1D27" /> | ||
</a> | ||
</p> | ||
🚨 Eslint plugin to enforce react hooks documentation. | ||
<h3 align="center"> 🚨 Eslint plugin to enforce react hooks documentation. </h3> | ||
<br> | ||
<p align="center"> | ||
<sub>Built with ❤︎ by <a href="https://ahmedtokyo.com">Ahmed Tokyo</a> | ||
<br/> | ||
</p> | ||
<a href="https://npmjs.com/package/eslint-plugin-react-hooks-docs"> | ||
<img src="https://img.shields.io/npm/v/eslint-plugin-react-hooks-docs.svg"></img> | ||
<img src="https://img.shields.io/npm/dt/eslint-plugin-react-hooks-docs.svg"></img> | ||
</a> | ||
<a href="https://twitter.com/intent/follow?screen_name=ahmad_tokyo"><img src="https://img.shields.io/twitter/follow/ahmad_tokyo.svg?label=Follow%20@ahmad_tokyo" alt="Follow @ahmad_tokyo"></img></a> | ||
@@ -37,3 +22,3 @@ <br> | ||
```bash | ||
yarn add -D eslint eslint-plugin-react-hooks-docs --save-dev | ||
yarn add -D eslint eslint-plugin-react-hooks-docs | ||
``` | ||
@@ -43,2 +28,9 @@ | ||
### Extending recommended configuration | ||
You can extend the recommended configuration by adding 'plugin:eslint-plugin-react-hooks-docs/recommended' to the `extends` array in your `eslintrc`. | ||
``` | ||
extends: ['plugin:eslint-plugin-react-hooks-docs/recommended'], | ||
``` | ||
### Manually applying the rules | ||
Add `react-hooks-docs` to the plugins section of your `.eslintrc` configuration file. You can omit the `eslint-plugin-` prefix: | ||
@@ -52,3 +44,3 @@ | ||
Then configure the rules you want to use under the rules section. | ||
Then configure the rules you want to use under the rules section. Note that the 2nd param is optional extra configurations. | ||
@@ -62,5 +54,3 @@ ```json | ||
"skipDeclarations": true, | ||
"skipHooks": [ | ||
"useCustomEffect" | ||
] | ||
"skipHooks": [] | ||
} | ||
@@ -71,1 +61,16 @@ ] | ||
``` | ||
## Rules | ||
### docs | ||
Enforces documentation to exist in the form of a comment for react hooks calls. | ||
**Options:** | ||
- skipDeclarations: boolean - doesn't enforce the rule on hook declarations eg: `const [state, setState] = useState(0);`. | ||
- skipHooks: Array<string> - doesn't enforce the rule on the hooks passed to in this array eg: `useCustomHook` | ||
<p align="center"> | ||
<sub>Built with ❤︎ by <a href="https://ahmedtokyo.com">Ahmed Tokyo</a> | ||
<br/> | ||
</p> |
72
7.46%12264
-1.52%