vscode里面怎么根据eslint来格式化代码?

先确保已经安装了 ESLint 插件

 

Plan A: 设置格式化快捷键

打开命令面板,搜索keyboard shortcuts

keybindings.json 中添加

{
"key": "cmd+alt+space",
"command": "eslint.executeAutofix",
"when": "editorTextFocus"
}

 

Plan B: 开启保存时自动格式化

d用户的 settings.json 中添加 

"eslint.autoFixOnSave": true

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章