先确保已经安装了 ESLint 插件
Plan A: 设置格式化快捷键
打开命令面板,搜索keyboard shortcuts
keybindings.json 中添加
{
"key": "cmd+alt+space",
"command": "eslint.executeAutofix",
"when": "editorTextFocus"
}
Plan B: 开启保存时自动格式化
d用户的 settings.json 中添加
"eslint.autoFixOnSave": true