美文网首页
eslint格式化不起作用的问题

eslint格式化不起作用的问题

作者: 天马行空_eaa7 | 来源:发表于2022-05-24 09:55 被阅读0次

这篇文章不错
我这次遇到的问题是:eslint和其他格式化程序冲突的问题

  1. 首先通过设置vscode的setting.json,使其支持格式化.vue文件

"[vue]": {
"editor.defaultFormatter": "octref.vetur"
},

  1. 解决eslint和其他格式化程序冲突的问题
// 保存时使用VSCode 自身格式化程序格式化
"editor.formatOnSave": true,
// 保存时用eslint格式化
"editor.codeActionsOnSave": {
    "source.fixAll.eslint": true
}
// 两者会在格式化js时冲突,所以需要关闭默认js格式化程序 
"javascript.format.enable": false

相关文章

网友评论

      本文标题:eslint格式化不起作用的问题

      本文链接:https://www.haomeiwen.com/subject/wboqurtx.html