先確保已經安裝了 ESLint 插件
Plan A: 設置格式化快捷鍵
打開命令面板,搜索keyboard shortcuts
keybindings.json 中添加
{
"key": "cmd+alt+space",
"command": "eslint.executeAutofix",
"when": "editorTextFocus"
}
Plan B: 開啓保存時自動格式化
d用戶的 settings.json 中添加
"eslint.autoFixOnSave": true