1.0.0 • Published 3 years ago
eslint-plugin-react-xhooks v1.0.0
eslint-plugin-react-xhooks
- 拷贝react官方
eslint-plugin-react-hooks
插件 - 添加
staticValueHooks
配置- 配置到这里的自定义hooks, 跟useRef一样返回静态值, 不需要配置到依赖数组中
安装
npm install --save-dev eslint-plugin-react-xhooks
使用
- 添加插件
markup-replace
到.eslintrc
文件的plugins
中 - 添加配置
staticValueHooks
{
"plugins": [
"react-xhooks"
],
"rules": {
"react-xhooks/rules-of-hooks": 2,
"react-xhooks/exhaustive-deps": [
2,
{
"staticValueHooks": "(usePersistFn|useValueRef|useInstanceRef)"
}
]
}
}
License
MIT
1.0.0
3 years ago