vscode在vue-cli中按照ESlint自动格式化代码

先安装
npm i -S eslint-plugin-vue

.eslintrc下

"plugins": [
    "vue"
]

 vscode首选项 添加

"eslint.autoFixOnSave": true,
"eslint.validate": [
    "javascript",{
        "language": "vue",
        "autoFix": true
    },"html",
    "vue"
],

 当按ctrl+s保存的时候,格式才会发生变化

空格,引号都会变成我们需要的格式


猜你喜欢

转载自www.cnblogs.com/anxiaoyu/p/9390280.html