首页 > 解决方案 > 未找到规则“re​​act-hooks/exhaustive-deps”的定义

问题描述

// eslint-disable-next-line react-hooks/exhaustive-deps添加我的代码后,我收到以下 eslint 错误。

8:14 找不到规则“re​​act-hooks/exhaustive-deps”的错误定义

我参考了这篇文章来解决这个问题,但提到的解决方案在我的情况下不起作用。任何线索如何抑制这个eslint错误?

PS我正在结合使用standardjs

标签: javascriptreactjsreact-hookseslintstandardjs

解决方案


这通常是因为插件配置react-hooks中缺少.eslintrc插件。确保您已react-hooks按以下示例添加:

"plugins": ["react", "react-hooks",],

推荐阅读