Where to find webpack.config.js? React project turns off eslint monitoring

Table of contents

Where to find webpack.config.js?

React project turns off eslint monitoring


Where to find webpack.config.js?

In the React project, when we need to modify some configurations, we find that webpack.config.js cannot be found. Is there something wrong with the project we created? Does the project we need to create a new project no longer contain the webpack.config.js file? ?

In fact, when creating a project, the webpack.config.js file is automatically hidden, and we need to expose the webpack.config.js file ourselves.

Ways to expose the webpack.config.js file:

Execute npm run eject

After execution, we will see the webpack.config.js file in the exposed config folder

 

React project turns off eslint monitoring

1. Set the package.json file

  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ],
    "rules": {
      "no-undef": "off",
      "no-restricted-globals": "off",
      "no-unused-vars": "off"
    }
  },

To understand the rules of eslint, please refer to the following article

eslint official website rules http://eslint.cn/docs/rules/

or

Eslint_Rules reference http://www.verydoc.net/eslint/00003312.html

Turn off relevant rules according to your needs.

If you find that eslint is disabled after setting the above code in the package.json file, you can directly comment the eslint-related code in webpack.config.js

 2. Comment eslint-related code in webpack.config.js

 

Guess you like

Origin blog.csdn.net/Celester_best/article/details/128996092