Home > Web Front-end > Front-end Q&A > How to turn off eslint in react

How to turn off eslint in react

WBOY
Release: 2022-04-19 10:20:37
Original
7735 people have browsed it

Method: 1. Use "npm run eject" to copy all dependency files and corresponding dependencies to the project; 2. Modify the code of the ""eslintConfig"" project in "package.json"; 3. If Dependencies are missing and you need to reinstall them. Just use "npm start" to restart the project.

How to turn off eslint in react

The operating environment of this tutorial: Windows 10 system, react17.0.1 version, Dell G3 computer.

How to turn off eslint in react

The first step: npm run eject

npm run eject
Copy after login

npm run eject will copy all dependent files and corresponding dependencies (webpack , babel, etc.) to your project. It is a one-way operation. Once ejected, the operation of npm run eject is irreversible

Step 2: Modify the code in package.json

"eslintConfig": {
    "extends": "react-app",
    "rules": {
      "no-undef": "off",
      "no-restricted-globals": "off",
      "no-unused-vars": "off"
    }
}
Copy after login

Step 3: Restart the project

npm start
Copy after login

If there are missing dependencies, then you need to reinstall the dependencies.

Recommended learning: "react video tutorial"

The above is the detailed content of How to turn off eslint in react. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template