vscode settings.json文件
{ "editor.tabSize": 2, "workbench.iconTheme": "vscode-icons", "editor.suggestSelection": "first", "vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue", "search.followSymlinks": false, "files.autoSave": "onFocusChange", "gitlens.advanced.messages": { "suppressCommitHasNoPreviousCommitWarning": false, "suppressCommitNotFoundWarning": false, "suppressFileNotUnderSourceControlWarning": false, "suppressGitDisabledWarning": false, "suppressGitVersionWarning": false, "suppressLineUncommittedWarning": false, "suppressNoRepositoryWarning": false, "suppressSupportGitLensNotification": false, "suppressShowKeyBindingsNotice": true }, "git.ignoreMissingGitWarning": true, "git.enableSmartCommit": true, "git.confirmSync": false, "git.autofetch": true, "explorer.confirmDelete": false, "explorer.confirmDragAndDrop": false, "search.exclude": { "**/node_modules": true, "**/bower_components": true, "**/dist": true }, "emmet.syntaxProfiles": { "javascript": "jsx", "vue": "html", "vue-html": "html" }, "[html]": { "editor.defaultFormatter": "vscode.html-language-features" }, "[vue]": { "editor.defaultFormatter": "esbenp.prettier-vscode" }, "[javascript]": { "editor.defaultFormatter": "esbenp.prettier-vscode" }, "[css]": { "editor.defaultFormatter": "michelemelluso.code-beautifier" }, "vetur.format.defaultFormatterOptions": { "js-beautify-html": { "wrap_line_length": 120, "wrap_attributes": "auto", "end_with_newline": true } }, "vetur.format.defaultFormatter.html": "js-beautify-html", "vetur.format.defaultFormatter.js": "vscode-typescript", "editor.codeActionsOnSave": { "source.fixAll.eslint": true, }, "javascript.updateImportsOnFileMove.enabled": "always", "[json]": { "editor.defaultFormatter": "vscode.json-language-features" }, "window.zoomLevel": 1, "diffEditor.ignoreTrimWhitespace": false, "[less]": { "editor.defaultFormatter": "michelemelluso.code-beautifier" }, "[markdown]": { "editor.defaultFormatter": "esbenp.prettier-vscode" }, "leetcode.endpoint": "leetcode-cn", "[jsonc]": { "editor.defaultFormatter": "esbenp.prettier-vscode" }, }
使用prettier之后,需要在项目根目录增加.prettierrc文件,配置
{ "eslintIntegration": true, "semi": false, "singleQuote": true, "printWidth": 140, "wrapAttributes": false, "sortAttributes": false }