0

I can't add rules or edit ESLint in a Create React App.

before version 4.0. all was ok- i had .eslintrc.js file with rules. i moved to 4.0.2 and - the app stopped compiling. so i removed .eslintrc.js, and got completion back. ok.

but now, i can't add or edit anything regarding ESLlint.

i can't add a new .eslintrc.js, use the old one, or config the lint in the package.json file like the documentation solution - all returning to completion problem.

tried to add .env file with ESLINT_NO_DEV_ERRORS=true but still the same problem.

how can you extend or Edit ESLint ?

Citizen-Dror
  • 843
  • 9
  • 17
  • 1
    Duplicate of https://stackoverflow.com/q/59633005/6928824, which also answers the question but provides further information – jneuendorf Apr 28 '21 at 22:14

1 Answers1

0

one solution is to use to edit the rules in the package.json :

for example :

  "eslintConfig": {
    "extends": ["react-app"],
    "rules": {
      "no-unused-vars": "warn"
    },
    "overrides": [
      {
        "files": ["**/*.ts?(x)"],
        "rules": {
          "max-len": "warn"
        }
      }
    ]
  },
Citizen-Dror
  • 843
  • 9
  • 17