'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 1:[1]

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.

Solution 2:[2]

Adding this line to settings.json worked for me.

"prettier.trailingComma": "none"

Solution 3:[3]

At the root of the project create the Prettier configuration file: .prettierrc.json

Add this code to your file: .prettierrc.json

{
    "trailingComma": "none"
}

Save file and then restart your Visual Studio Code

Solution 4:[4]

I was facing same problem and I added this line in the settings and it worked for me.

"prettier.trailingComma": "none"

Solution 5:[5]

I had the same experience as your screen recording. Restarting VSCode did the trick for me. I could not find a way to restart the prettier addon... maybe someone can chime in on how to do that.

Solution 6:[6]

Run this command:

npm run lint --fix

after formatting...

Solution 7:[7]

In VS Code Settings, go to json file and type this:

"prettier.useEditorConfig": false

Or just in the Setting, under Prettier configs, set this to false/uncheck to prevent prettier other config to take precedence over Prettier

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Ewaren
Solution 2 Sachish
Solution 3 Udhav Sarvaiya
Solution 4 Andrew
Solution 5 Ryan Wheale
Solution 6 Reza Rahemtola
Solution 7 Sterling Diaz