{
"tabWidth": 2,
"semi": true,
"singleQuote": true, //是否使用單引號爲true
"trailingComma": "es5",
"bracketSpacing": true,
"arrowParens": "avoid",
"overrides": [{
"files": [
"*.json",
".eslintrc",
".tslintrc",
".prettierrc",
".tern-project"
],
"options": {
"parser": "json",
"tabWidth": 2
}
},
{
"files": "*.{css,sass,scss,less}",
"options": {
"parser": "scss",
"tabWidth": 2
}
},
{
"files": "*.vue",
"options": {
"parser": "vue",
"tabWidth": 2
}
},
{
"files": "*.ts",
"options": {
"parser": "typescript",
"tabWidth": 2
}
},
{
"files": "*.tsx",
"options": {
"parser": "typescript"
}
}
]
}
複製代碼
"prettier": {
"semi": false,
"singleQuote": true
}
複製代碼
完成上述兩個步驟就能夠解決我上面的所列的3個問題啦css
{
"workbench.iconTheme": "vscode-icons",
"editor.fontSize": 15,
"files.autoSave": "off",
"window.zoomLevel": 0,
"editor.tabSize": 2,
"editor.detectIndentation": false,
"beautify.tabSize": 2,
"vetur.format.options.tabSize": 2,
// "vetur.format.defaultFormatter.html": "prettier",
"vetur.format.defaultFormatter.js": "vscode-typescript",
// "vetur.format.styleInitialIndent": true,
"prettier.tabWidth": 2,
"beautify.options": {
"editor.tabSize": 2
},
"prettier": {
"semi": false,
"singleQuote": true
},
"liveServer.settings.donotShowInfoMsg": true,
}
複製代碼
npm install prettier --save-dev
.prettier.config.js
module.exports = {
"singleQuote": true,
"tabWidth": 2,
"semi": true,
"overrides": [{
"files": [
"*.json",
".eslintrc",
".tslintrc",
".prettierrc",
".tern-project"
],
"options": {
"parser": "json",
"tabWidth": 2
}
},
{
"files": "*.{css,sass,scss,less}",
"options": {
"parser": "scss",
"tabWidth": 2
}
},
{
"files": "*.vue",
"options": {
"parser": "vue",
"tabWidth": 2
}
},
{
"files": "*.ts",
"options": {
"parser": "typescript",
"tabWidth": 2
}
},
{
"files": "*.tsx",
"options": {
"parser": "typescript"
}
}
],
};
複製代碼
{
"workbench.iconTheme": "vscode-icons",
"editor.fontSize": 15,
"files.autoSave": "off",
"window.zoomLevel": 0,
"editor.tabSize": 2,
"editor.detectIndentation": false,
"beautify.tabSize": 2,
"vetur.format.options.tabSize": 2,
// "vetur.format.defaultFormatter.html": "prettier",
"vetur.format.defaultFormatter.js": "vscode-typescript",
// "vetur.format.styleInitialIndent": true,
"prettier.tabWidth": 2,
"beautify.options": {
"editor.tabSize": 2
},
"prettier": {
"semi": false,
"singleQuote": true
},
"liveServer.settings.donotShowInfoMsg": true,
"terminal.integrated.shell.windows": "C:\\windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe",
}
複製代碼