安装插件



配置 vscode settings.json
{
...
// 保存的时候格式化
"editor.formatOnSave": true,
// 启用 eslint 格式化
"eslint.format.enable": true,
// 采用 eslint 格式化
"[vue]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
"[javascript]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
"[typescript]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
}
}
配置 .prettierrc
{
"spaceBeforeFunctionParen": true,
"tabWidth": 2,
"useTabs": false,
"trailingComma": "none",
"eslintIntegration": true,
"singleQuote": true,
"semi": false,
"bracketSpacing": true,
"jsxBracketSameLine": false,
"arrowParens": "avoid"
}
手动指定默认格式化方式(可选)

