首页 新闻 会员 周边

tslint-react-hooks怎么能生效?

0
悬赏园豆:5 [待解决问题]

我正在学习 react hook,看了 react 官方文档中的 hook 使用规则和这篇文档,想要校验规则。我已经安装了相关依赖,并在 package.json 进行了配置。

"eslintConfig": {
    "extends": [
      "react-app",
      "plugin:react-hooks/recommended",
      "tslint-react-hooks"
    ],
    "rules": {
      "react-hooks-nesting": "error"
    }
  },
"devDependencies": {
    "eslint-plugin-react-hooks": "^3.0.0",
    "tslint-react-hooks": "^2.2.2"
  }

但是我在条件判断中使用 hook,并未报错。

if(1){
    //测试 Hook 使用规则
    const [count1, setCount1] = useState(0);

    useEffect(() => {
      document.title = `aaaaaa`;
    });
  }

我的项目目录中没有 tslint.json,请问怎么能让校验生效?

zanetti的主页 zanetti | 初学一级 | 园豆:128
提问于:2020-04-20 10:47
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册