第一步下载Eslint 找到右下角的设置图标
点击打开扩展设置
第二步、选择打开 右上角的json配置文件
第三步 写入代码
{
"emmet.triggerExpansionOnTab": true,
"editor.fontSize": 14,
"editor.tabSize": 2,
"update.showReleaseNotes": false,
"prettier.printWidth": 150,
"workbench.editor.untitled.hint": "hidden",
"prettier.arrowParens": "avoid",
"prettier.vueIndentScriptAndStyle": true,
"terminal.integrated.tabs.enabled": true,
"git.enableSmartCommit": true,
"explorer.confirmDelete": false,
"editor.acceptSuggestionOnEnter": "smart",
"workbench.enableExperiments": false,
"security.workspace.trust.enabled": false,
"path-intellisense.mappings": {
"@": "${workspaceRoot}/src"
},
"prettier.jsxSingleQuote": true,
"prettier.semi": false,
"explorer.compactFolders": false,
"explorer.incrementalNaming": "smart",
"eslint.alwaysShowStatus": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"eslint.useESLintClass": true,
"editor.detectIndentation": false,
"editor.formatOnSave": true,
"eslint.format.enable": true,
"gitlens.advanced.messages": {
"suppressGitMissingWarning": true
},
"editor.suggestSelection": "recentlyUsed",
"editor.minimap.enabled": false,
"editor.unicodeHighlight.allowedCharacters": {
":": true
},
"prettier.singleQuote": true,
"update.enableWindowsBackgroundUpdates": false,
"update.mode": "start",
"editor.suggest.snippetsPreventQuickSuggestions": false,
"editor.guides.bracketPairs": "active",
"workbench.startupEditor": "none",
"eslint.run": "onSave",
"workbench.editor.splitInGroupLayout": "vertical",
"[vue]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[javascript]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
"eslint.probe": [
"javascript",
"javascriptreact",
"typescript",
"typescriptreact",
"html",
"vue",
"markdown",
"Vue",
"VUE"
],
"files.associations": {
"*.vue": "vue"
},
}
点击文件鼠标右击
选一个默认格式化