1. Problem description
When writing items with Vue
, the eslint
syntax check was turned on as usual, but various errors, single and double quotation marks and function spaces were found after formatting and saving with vscode. Because the formatting plug-in of vscode
itself does not match eslint
. Therefore, some configurations need to be modified to achieve the effect of configuration. There are two ways to modify.
2. Solution 1
Since the vsdoe
formatting does not match eslint
, we will modify the rules of vscode
. Create a file .Pretierrc
under the current project and modify relevant configuration items. Here, we only modify single and double quotation marks and semicolons.
{
"semi": true,
"singleQuote": true
}
3. Solution 2
Modify the style location where you save Vue formats:
3.1 open configuration item
3.2 find the corresponding configuration item and modify the corresponding value
"[vue]": {
//"editor.defaultFormatter": "esbenp.prettier-vscode" //before fixing,
"editor.defaultFormatter": "octref.vetur" // Use vetur formatting rules, after modification
},
3.3 setting vetur rules
"vetur.format.defaultFormatterOptions": {
"js-beautify-html": {
"wrap_attributes": "force-aligned" //Attribute forced line alignment
},
"prettier": {
"semi": true, // keep the semicolon
"singleQuote": true, // true uses single quotes
},
},
Read More:
- How to Solve Vscode save Vue file eslint error
- Vue3 Error: [vue/no-multiple-template-root] The template root requires exactly one element
- VScode vue3 Project vetur Error [How to Solve]
- [Solved] VS Code Error: Vetur can‘t find ‘tsconfig.json‘ or ‘jsconfig.json‘
- [Solved] ESLint: Parsing error: Unexpected token(prettier/prettier)
- [Solved] Vue eslint Error: Component name “*****“ should always be multi-word
- [Solved] ✖ 2 problem (1 error, 0 warnings) 2 error and 0 warnings potentially fixable with the`–fix`
- [Solved] Syntax Error: Error: No ESLint configuration found & TypeError: eslint.CLIEngine is not a constructor
- [Solved] Vue3.0 Error: The component has been registered but not used vue/no-unused-components, Close eslint
- How to Solve VUE Error: Mixed spaces and tabs
- eslint Error: Delete `␍` [How to Solve]
- [Solved] Vue Project Error: Arrow function should not return assignment
- How to Solveb Vue3 defineProps Error
- How to Solve Vue editor bridge error
- [Solved] Errors: 1 http://eslint.org/docs/rules/quotes…elementUI Import Error
- VUE Error: Mixed spaces and tabs [How to Solve]
- [Solved] error: Unexpected console statement (no-console)
- [Solved] Vue Project startup error: no eslint configuration found
- [Solved] Vue 3 Script Setup ESLint Error: ‘defineProps‘ is not defined
- [Solved] VUE eslint Error: Expected linebreaks to be ‘LF‘ but found ‘CRLF