umijs / umi

A framework in react community ✨
https://umijs.org
MIT License
15.3k stars 2.65k forks source link

怎么在 umi 中启用 eslint-plugin-react-hooks #3200

Closed odanzhou closed 4 years ago

odanzhou commented 5 years ago

Background

使用了 hooks 写代码,配置了 eslint-plugin-react-hooks 但没起作用,编译器控制台没有警告信息

furylee commented 5 years ago
{
  ...
  plugins: [
    'react-hooks',
  ],
 rules: {
  ...
 'react-hooks/rules-of-hooks': 'error', // Checks rules of Hooks
    'react-hooks/exhaustive-deps': 'error', // Checks effect dependencies
}
}
xiaohuoni commented 4 years ago

如楼上所示,在eslint配置中使用

odanzhou commented 4 years ago

@furylee @xiaohuoni 放在 .eslingtrc 文件里面吗?我放在里面没起作用

wjw760306378 commented 4 years ago

@furylee @xiaohuoni 放在 .eslingtrc 文件里面吗?我放在里面没起作用

您好请问您解决了吗 我在umi中也遇到了这个问题

xiaohuoni commented 4 years ago

.eslintrc.js 这里面配置,应该是有效的。