shanmugharaj
shanmugharaj

Reputation: 3924

How to disable the trailing comma after the decorator in vscode when using prettier

My code looks like this

import { ApiController, Controller } from "./lib/rest";

[Controller("test")];
export class TestController extends ApiController {}

Here vscode inserts the trailing comma after the decorator

[Controller("test")];

I couldn't figure out how to disable this behaviour only for decorators.

Please help me on this.

Upvotes: 5

Views: 9867

Answers (1)

Ragavan Rajan
Ragavan Rajan

Reputation: 4397

There is a workaround to solve your problem. Instead of prettier you can use the extension called "beautify" to solve the comma trailing issue.

https://marketplace.visualstudio.com/items?itemName=HookyQR.beautify

if you want to stick on to prettier then in vscode

file > preferences > settings > on the user settings >

"prettier.trailingComma": "none" or change it to "prettier.trailingComma": "es5"

Hope it will fix your problem.

Upvotes: 10

Related Questions