When creating a new vue-cli, I chose eslint syntax, which
is very
annoying
-
ESLint has many specifications, and the most used ones are
标准规范
-
Features:
- No semicolon at the end of the code
- Strings in js must use single quotes
- Can't have too many newlines
- Can not have more than one space
- There must be one and only one space around the parentheses of the function name
- …
-
By default, vscode does not have the ability to report irregular codes, so you can install a vscode plug-in called
ESLint
-
Install a formatting plug-
Prettier-Standard
in, function: when you can right-click to format, help us automatically repair the non-standard code and turn it into a standardized code -
The following settings are to allow you to automatically fix non-standard code when you save the code
-
Then add the following configuration to the settings
// 默认使用prittier作为格式化工具 "editor.defaultFormatter": "numso.prettier-standard-vscode", // 保存时自动格式化 - 按照eslint的规则格式化 "editor.codeActionsOnSave": { "source.fixAll": true }, "[javascript]": { "editor.defaultFormatter": "numso.prettier-standard-vscode" }, "[html]": { "editor.defaultFormatter": "numso.prettier-standard-vscode" }, "[vue]": { "editor.defaultFormatter": "numso.prettier-standard-vscode" },
At that time, the new project chose eslint syntax. If there is no way,
delete this place in package.json
"@vue/cli-plugin-eslint": "~4.5.0",