简体   繁体   中英

How to disable eslint type errors in react app?

I don't use typescript but i have type errors. I want to ignore type errors. But i couldn't disable them. Does anybody have idea?

Examples: 在此处输入图像描述

在此处输入图像描述

And this is my package.json: 在此处输入图像描述

I may be wrong, but from your screenshot it seems you are using VSCode as your IDE. If you just want to stop these errors from showing up in the IDE, adding these overrides in your user/workspace settings should help:-

"typescript.validate.enable": false,
"javascript.validate.enable": false,

Also, it looks like a create-react-app scaffolded project, if you do not intend to use Typescript, it would be ideal to scaffold the project again without it, if that is still an option!

I myself found the solution from here Edit.env:

DISABLE_ESLINT_PLUGIN=true

Or in package.json:

{
  "scripts": {
    "start": "DISABLE_ESLINT_PLUGIN=true react-scripts start",
    "build": "DISABLE_ESLINT_PLUGIN=true react-scripts build",
    "test": "DISABLE_ESLINT_PLUGIN=true react-scripts test"
  }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM