How to make Prettier add commas for objects #12673
-
I can't get Prettier in JS to add commas in VScode automatically. Is it now and then a usual behaviour ? I searched stackoverflow and there are mentions of Prettier being able to set commas at the end of each object literal property dated back to year 2020. Note: Prettier puts comma only if one line of property is given and on-save the line receives comma. However, in the event of multiple properties, on-save none receives a comma. const lufthansa = { |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Commas must always be added by you, the last comma is optional and prettier adds it: |
Beta Was this translation helpful? Give feedback.
Commas must always be added by you, the last comma is optional and prettier adds it:
Example