Package eslint-plugin-react-hooks is usefull to trap such error / warning.
yarn add eslint-plugin-react -D
Edit your package.json to enable the plugin and you can turn off, error, warn the rules which you prefer.
"eslintConfig": {
"plugins": [
"react"
],
"extends": [
"react-app",
"react-app/jest",
"plugin:react/recommended"
],
"rules": {
"eqeqeq": "off",
"no-useless-escape": "off",
"jsx-a11y/alt-text": "off",
"react/prop-types": "off",
"react/display-name": "off",
"react-hooks/exhaustive-deps": "off",
"react/no-unknown-property": "warn",
"react/jsx-key": "warn"
}
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…