question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Code style : unneeded comma

See original GitHub issue

At the end of many arrays and objets there are comma like in this example :

bot.client.write('close_window', {
      windowId: window.id,
    });

Is there a reason for this ?

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:10 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
deathcapcommented, Mar 22, 2015

New properties and elements can be added on subsequent lines without changing the prior line to add a comma (= cleaner diff)

0reactions
rom1504commented, Mar 27, 2015

So, indeed WebStorms 10 allows to not error on these trailing comma. I guess it doesn’t matter that much.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Code Syntax Style: Trailing Commas - JetBrains Rider
Apply trailing comma style with custom Code Cleanup profile · Press Ctrl+Alt+S or choose File | Settings (Windows and Linux) or JetBrains Rider ......
Read more >
Trailing commas - JavaScript - MDN Web Docs
Trailing commas (sometimes called "final commas") can be useful when adding new elements, parameters, or properties to JavaScript code.
Read more >
Best practices for using trailing commas in JavaScript
A trailing comma, also known as a dangling or terminal comma, is a comma symbol that is typed after the last item of...
Read more >
Trailing comma after last line in object - Stack Overflow
Trailing commas are a code-style convention that was introduced to avoid spurious differences in version controls (ie Git) ...
Read more >
Why you should enforce Dangling Commas for Multiline ...
We all have different opinions on what code should look like. Most of the time it's a matter of preference based on good...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found