Search code examples
visual-studio-codeprettiertrailing

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


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


Solution

  • 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.