Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to turn off the prettier trailing comma in VS Code?

Tags:

How to turn off the prettier trailing comma in VS Code?

I go to settings. Select none for the prettier trailing comma. Restart VS Code. Select a piece of TypeScript, press Ctrl + Shift + F and the trailing commas still appear. How could I fix it?

enter image description here

like image 947
manymanymore Avatar asked May 18 '20 18:05

manymanymore


People also ask

How do I temporarily disable prettier in Vscode?

prettier-vscode", If you want to disable Prettier for a specific language, you can set the editor. defaultFormatter to null .

What are trailing commas?

A trailing comma, also known as a dangling or terminal comma, is a comma symbol that is typed after the last item of a list of elements. Since the introduction of the JavaScript language, trailing commas have been legal in array literals. Later, object literals joined arrays.


2 Answers

Since you are working on the Tour of Heroes project, it is maybe the .editorconfig file there that introduces conflicts with your VSCode Prettier settings. Try adding the following .prettierrc file at the root of your project :

{
  "trailingComma": "none"
}

The .prettierrc file has the highest priority over any setting, so it should override any conflict.

like image 191
Ewaren Avatar answered Sep 24 '22 04:09

Ewaren


Adding this line to settings.json worked for me.

"prettier.trailingComma": "none"

like image 23
Sachish Avatar answered Sep 25 '22 04:09

Sachish