[Problem Record] vue error-Eslint

Problem record

When I create the project, write a new vue, and then run it, a bunch of errors are reported directly.
Insert image description here
Elsint’s format check is very strict.

solution

Option 1 - Install plugin

Install plugins, ESLint and Prettier Standard in vscode

Insert image description here

At this point, open the project with vscode and you will see the red wavy line error

Fix error report
Insert image description here

Option 2 - Modify .eslintrc.js to disable checking

1. Trailing spaces are not allowed

Error reported:Trailing spaces not allowed no-trailing-spaces

// 关闭空格检查
'no-irregular-whitespace':'off'

2. Expected 2 spaces indentation, but found 4 spaces indentation

Error reported:Expected indentation of 2 spaces but found 4

Add in the rules field

//
'indent': ['off', 2],

Reference article:
1. The pitfalls in the vue project – Elisint’s error reporting

Guess you like

Origin blog.csdn.net/tyty2211/article/details/135021550
Recommended