旧版配置

{
	//配置eslint
	"eslint.autoFixOnSave": true,  //  启用保存时自动修复,默认只支持.js文件
	"eslint.validate": [
	   "javascript",  //  用eslint的规则检测js文件
	   {
	     "language": "vue",   // 检测vue文件
	     "autoFix": true   //  为vue文件开启保存自动修复的功能
	   },
	   {
	     "language": "html",
	     "autoFix": true
	   }
	 ]
}

新版(>1.41.0)配置

{
	//autoFixedOnSave 设置已废弃,采用如下新的设置
	"editor.codeActionsOnSave": {
	  "source.fixAll.eslint": true
	},
	"eslint.format.enable": true,
	//autoFix默认开启,只需输入字符串数组即可
	"eslint.validate": ["javascript", "vue", "html"]

注意:配置完后重启vscode才有效

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2020-05-15
  • 2021-09-27
  • 2021-11-26
  • 2022-02-24
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-22
  • 2022-12-23
  • 2021-06-24
相关资源
相似解决方案