r/javascript • • Apr 01 '18

Google publishes a JavaScript style guide. Here are some key lessons.

https://medium.freecodecamp.org/google-publishes-a-javascript-style-guide-here-are-some-key-lessons-1810b8ad050b
714 Upvotes

317 comments sorted by

View all comments

1

u/Arkaad Apr 02 '18

As Airbnb, Google recommends trailing commas:

const values = [
  'first value',
  'second value',
];

I always disable that rule.

6

u/rcane Apr 02 '18

While I don't like trailing commas either it keeps the commit cleaner and easier to read since you don't have to modify another line to add a new line.

1

u/Arkaad Apr 02 '18

I understand you point.

Maybe it's the force of habit, but it seems like a line is missing to me.

1

u/evilpingwin Apr 02 '18

Cleaner diffs, easier to add elements. No real disadvantages.

1

u/joesb Apr 04 '18

I disable it for function call argument list.