https://github.com/a-tokyo/eslint-plugin-react-hooks-docs
🚨 Eslint plugin to enforce react hooks documentation
https://github.com/a-tokyo/eslint-plugin-react-hooks-docs
Last synced: 27 days ago
JSON representation
🚨 Eslint plugin to enforce react hooks documentation
- Host: GitHub
- URL: https://github.com/a-tokyo/eslint-plugin-react-hooks-docs
- Owner: a-tokyo
- License: mit
- Created: 2024-01-17T20:24:33.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-01-18T20:37:41.000Z (over 1 year ago)
- Last Synced: 2025-03-06T16:08:41.037Z (about 2 months ago)
- Language: TypeScript
- Size: 129 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: .github/CONTRIBUTING.md
- License: LICENSE
- Code of conduct: .github/CODE_OF_CONDUCT.md
- Security: .github/SECURITY.md
Awesome Lists containing this project
README
# eslint-plugin-react-hooks-docs
🚨 Eslint plugin to enforce react hooks documentation.
## Installation
```bash
npm i eslint eslint-plugin-react-hooks-docs --save-dev
```
OR
```bash
yarn add -D eslint eslint-plugin-react-hooks-docs
```## Usage
### 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:```json
{
"plugins": ["react-hooks-docs"]
}
```Then configure the rules you want to use under the rules section. Note that the 2nd param is optional extra configurations.
```json
{
"rules": {
"react-hooks-docs/docs": [
2,
{
"skipDeclarations": true,
"skipHooks": []
}
]
}
}
```## 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 - doesn't enforce the rule on the hooks passed to in this array eg: `useCustomHook`
Built with ❤︎ by Ahmed Tokyo