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

manymanymore picture manymanymore · May 18, 2020 · Viewed 9.9k times · Source

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

Answer

Ewaren picture Ewaren · May 20, 2020

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.