How to stop Vuter from removing trailing (dangling) commas
See original GitHub issueInfo
- Platform: macOS
- Vetur version: 0.21.0
- VS Code version: 1.34.0
Problem
When I save a .vue
file all trailing commas will be removed.
[
I’ve tried multiple Vetur › Format › Default Formatter: HTML
settings and js-beautify-html
get the closest to how I like to write code. (please don’t write comments telling me why trailing commas are bad)
Reproducible Case
- Get vscode
- install Vuter
- Save a
.vue
file with trailing commas
Issue Analytics
- State:
- Created 4 years ago
- Comments:14 (5 by maintainers)
Top Results From Across the Web
How to turn off the prettier trailing comma in VS Code?
Select none for the prettier trailing comma. ... Select a piece of TypeScript, press Ctrl + Shift + F and the trailing commas...
Read more >comma-dangle - ESLint - Pluggable JavaScript Linter
Trailing commas simplify adding and removing items to objects and arrays, since only the lines you are modifying must be touched. Another argument...
Read more >Trailing commas - JavaScript - MDN Web Docs
JavaScript allows trailing commas wherever a comma-separated list of values is accepted and more values may be expected after the last item.
Read more >Code Syntax Style: Trailing Commas - JetBrains Rider
Your version control diffs are cleaner when you add a new item in the end of the list. ... JetBrains Rider syntax style...
Read more >Best practices for using trailing commas in JavaScript
A trailing comma, also known as a dangling or terminal comma, ... where you can safely add a trailing comma to the end...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I am having this exact same issue. I use prettier+eslint (with .eslintrc) and prettier works just find on .js files and respects eslint rules. But for some reason vetur, even with the
"vetur.format.defaultFormatter.js": "prettier-eslint",
setting on, removes my trailing commas. The only fix I found is to manually set prettier config options. I do feel this is some sort of bug because the only thing vetur seems to get wrong is the trailing commas. Otherwise it seems to format just fine.You can set VSCode setting.
if use
prettier
, you can set prettier config..prettierrc
at project root.https://prettier.io/docs/en/options.html#trailing-commas