1.0.0 • Published 3 years ago

eslint-plugin-react-xhooks v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

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