Error reporting of eslint in webstorm

Background:

Webstorm2019.1 editor, import a new project, the package.json has been written, directly NPM install to install node_ Module package. And then the question came…

Problem Description:

Question 1: after installing node_ After the module, the eslint of the project does not work, so it can’t check the syntax and repair automatically; See editor tips eslint:this.cliEnigne is not a XXXX

Question 2: after installing eslint, the verification rules are not what you want…. For example: force all HTML tags to be written in Hump style, & lt; el-button> Change to & lt; ElButton> It’s awkward to look at…

terms of settlement:

The solution to problem 1:

The version of webstorm does not correspond to the version of eslint. I have reduced the version of eslint in the project.

npm uninstall eslint                  // Uninstall eslint

npm install [email protected] –save-dev                 // Install a lower version of eslint

be careful:   Remember to install it in devdependencies. The following items will not be packaged in the production environment. Command NPM install XXX   — When I installed save dev, I didn’t add dev, but it was installed under dependencies. As a result, I couldn’t install it or caused other errors.

The solution to problem 2:

Tried a lot of ways, also rewritten the eslintrc.js rule, added the rules about hump in the rules, but it didn’t work, I don’t know why…..

Finally, compared with the previous project, I changed the version of eslint package to the same one, and the problem was solved!

I changed these two bags

npm install [email protected] –save-dev

npm install [email protected] –save-dev

Little knowledge:

Do you really understand the difference between devdependencies and dependencies?

devdependencies for local environment development dependencies User publishing environment

Devdependencies are modules that will only be relied on in the development environment, and the production environment will not be included in the package. Through node_ Env = development or node_ Env = production specifies the development or production environment
the packages that depend on can be used not only in the development environment, but also in the production environment. In fact, this sentence is the key. According to this concept, it’s easy to decide whether to use — save or — save dev when installing a module
 
 

Read More: