Plugin for enforcing stricter rules on react hooks
You'll first need to install ESLint:
npm i eslint --save-dev
Next, install eslint-plugin-react-strict-hooks
:
npm install eslint-plugin-react-strict-hooks --save-dev
Add react-strict-hooks
to the plugins section of your .eslintrc
configuration file. You can omit the eslint-plugin-
prefix:
{
"plugins": [
"react-strict-hooks"
]
}
Make sure that type checking in eslint is enabled
{
parserOptions: {
project: './tsconfig.json',
tsconfigRootDir: __dirname
}
}
Then configure the rules you want to use under the rules section.
{
"rules": {
"react-strict-hooks/rule-name": 2
}
}
Name |
---|
no-useeffect-misuse |