$ npm install eslint-plugin-react-hooks
eslint-plugin-react-hooks
This ESLint plugin enforces the Rules of Hooks.
It is a part of the Hooks API for React.
Note: If you're using Create React App, please use react-scripts
>= 3 instead of adding it directly.
Assuming you already have ESLint installed, run:
# npm
npm install eslint-plugin-react-hooks --save-dev
# yarn
yarn add eslint-plugin-react-hooks --dev
Then add it to your ESLint configuration:
{
"plugins": [
// ...
"react-hooks"
],
"rules": {
// ...
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn"
}
}
Or use the recommended config:
{
"extends": [
// ...
"plugin:react-hooks/recommended"
]
}
Please refer to the Rules of Hooks documentation and the Hooks FAQ to learn more about this rule.
MIT
© 2010 - cnpmjs.org x YWFE | Home | YWFE