ESLint with React gives `no-unused-vars` errors

前端 未结 6 735
隐瞒了意图╮
隐瞒了意图╮ 2020-11-28 05:00

I\'ve setup eslint & eslint-plugin-react.

When I run ESLint, the linter returns no-unused-vars errors for each React comp

6条回答
  •  野趣味
    野趣味 (楼主)
    2020-11-28 05:54

    If you create the project throught create-react-app CLI,You can npm run eject,and edit the package.json "eslintConfig" field,like this:

    `"eslintConfig": {
        "extends": "react-app",
        "rules": {
          "eqeqeq": "off",
          "no-unused-vars": "off",
        }
      },`
    

    the eslint will be closed

提交回复
热议问题