Can't get correct autoformat on save in Visual Studio Code with ESLint and Prettier

后端 未结 7 912
囚心锁ツ
囚心锁ツ 2021-01-30 03:16

in Visual Studio Code with ESLint and Prettier when working on .vue files, it seems I can\'t get vue/max-attributes-per-line to auto-fix correctly.

For example, with vue

7条回答
  •  醉酒成梦
    2021-01-30 03:46

    I bumped into the same issue, and surprisingly found that prettier and vetur were conflicting. I had to disable vetur formatter and it now works as expected.

    If you have this section in your editor's settings.json and you have prettier installed,

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

    chances are, these two formatters are conflicting and thus the unexpected behaviour.

    A quick workaround is to comment it as below, or simply delete it permanently.

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

提交回复
热议问题