How to make Prettier add commas for objects #12673
Answered
by
cerm88
erhanertem
asked this question in
Q&A
-
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.
Answered by
cerm88
May 3, 2022
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.
0 replies
Answer selected by
erhanertem
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Commas must always be added by you, the last comma is optional and prettier adds it:
Example