Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 415
shanmugharaj Avatar asked Jan 28 '23 17:01

shanmugharaj


1 Answers

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.

like image 111
Ragavan Rajan Avatar answered Jan 31 '23 21:01

Ragavan Rajan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!