Vetur: Vetur Adding Semicolon to <script>

Created on 6 Jun 2019  路  4Comments  路  Source: vuejs/vetur

Info

  • Platform: Win
  • Vetur version: 0.21.0
  • VS Code version: 1.35.0

Problem

Screenshot_1

Reproducible Case

VS Code settings.json:

    "prettier.semi": false,
    "prettier.jsxSingleQuote": true,
    "prettier.trailingComma": "all",
    "prettier.eslintIntegration": true,
    "prettier.singleQuote": true,
    "prettier.tabWidth": 4,
    "prettier.useTabs": true,
    "vetur.format.options.useTabs": true,
    "vetur.format.options.tabSize": 4,
    "vetur.format.scriptInitialIndent": true,
    "vetur.format.styleInitialIndent": true,

Just started recently without any known changes. Only affecting .vue files (prettier works fine in .js files).

question

Most helpful comment

you can use .prettierrc file at project root.
or

"vetur.format.defaultFormatterOptions": {
  "prettier": {
    // Prettier option here
    "semi": false
  }
}

All 4 comments

you can use .prettierrc file at project root.
or

"vetur.format.defaultFormatterOptions": {
  "prettier": {
    // Prettier option here
    "semi": false
  }
}

you can use .prettierrc file at project root.
or

"vetur.format.defaultFormatterOptions": {
  "prettier": {
    // Prettier option here
    "semi": false
  }
}

I really didn't want to have a .prettierrc file for every project, so second option is perfect. Thanks for your help.

@xon52 any chance of this being added to the FAQ? I went around in circles trying to figure out how to fix it before finding this issue and applying the fix in "settings.json".

I ask because I thought that Vetur would pickup on the existing "prettier.semi": false, setting, but found out the hard way it is controlled via vetur.format.defaultFormatterOptions block. It just wasn't immediately obvious.

@TerraTech Wanna send a PR to clarify https://vuejs.github.io/vetur/formatting.html#settings? I'd be happy to review it. File to change: https://github.com/vuejs/vetur/blob/master/docs/formatting.md

Was this page helpful?
0 / 5 - 0 ratings