在项目根目录下创建.vscode文件夹,里面创建一个settings.json文件,内容如下:
{ // vscode默认启用了根据文件类型自动设置tabsize的选项
"editor.fontSize": 16,
// "editor.detectIndentation": false,
// 重新设定tabsize
// "editor.tabSize": 2,
// #每次保存的时候自动格式化
"editor.formatOnSave": true,
// #每次保存的时候将代码按eslint格式进行修复
"eslint.autoFixOnSave": true,
// 添加 vue 支持
"eslint.validate": [
"javascript",
"javascriptreact",
{
"language": "vue",
"autoFix": true
}
],
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"i18n-ally.localesPaths": [
"lang"
],
}
// "editor.codeActionsOnSave": {
// "source.fixAll.eslint": true
// }
// }