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.

Trailing comma adds a comma to function parameters as well

See original GitHub issue

If Training comma is activated, it adds a comma to the function parameters as well.

For example:

someFunction(somethingreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallylong);

gets converted to:

someFunction(
  somethingreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallylong,
);

which introduces a comma at the end and breaks the code.

I love the project by the way, congrats ☺️

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
hawkrivescommented, Mar 21, 2017

You can also pass the --trailing-comma argument to the prettier cli. Try --trailing-comma es5 or --trailing-comma none, depending on what you want.

0reactions
hawkrivescommented, Mar 21, 2017

(that last was directed @brainsandspace)

Read more comments on GitHub >

github_iconTop Results From Across the Web

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 >
PHP 8.0: Trailing commas are allowed in parameter lists and ...
PHP 8.0 syntax allows to leave a trailing-comma in parameter lists and closure use lists. function foo(string $foo, string $bar,) {} function() use...
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 >
Why is a trailing comma in a function call not a syntax error?
Most languages accept trailing commas in comma-separated lists like argument lists or tuple or array literals. This is helpful if you split ...
Read more >
ES proposal: Trailing commas in function parameter lists and ...
Why is that useful? There are two benefits. First, rearranging items is simpler, because you don't have to add and remove commas if...
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