'ReactJS - Getting Eslint errors while building or running application

I am creating an application in ReactJS. I have setup react project using "create-react-app". In this project I have added few pages and common layout. Now when I run project using "npm run start", I am getting below errors/warnings:

enter image description here

To disable this warnings/error I have added some rules in package.json file that are given below:

"eslintConfig": {
    "extends": [
        "react-app",
        "shared-config"
    ],
    "rules": {
        "jsx-a11y/anchor-is-valid": "off",
        "no-undef": "off",
        "eqeqeq": "off",
        "no-useless-constructor": "off"
    }
}  

But still getting above errors. I have also tried to disable all eslint rules by adding "".eslintignore file with *****. But this is also not working.



Solution 1:[1]

it took me some hours to find possible solutions: 1- workaround: add rules inside the package.json file

  "eslintConfig": {
    "extends": ["react-app"],
    "rules": {
      "no-unused-vars": "warn"
    },
    "overrides": [
      {
        "files": ["**/*.ts?(x)"],
        "rules": {
          "max-len": "warn"
        }
      }
    ]
  },
2- you can use a .eslintrc.js file, by adding .env file in the root folder with following content:
DISABLE_ESLINT_PLUGIN=true
ESLINT_NO_DEV_ERRORS=true

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Sooraj s