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.

comma-dangle = always-multiline and the spread operator

See original GitHub issue

There is a bit of an issue with comma-dangle set to "always-multiline" and the spread operator used in a destructuring assignment:

var [
  y, // Getting "missing trailing comma" error
] = parsed;

For compliance with spec there should be no comma after the AssignmentRestElement and I think that "always-multiline" should treat this as a special case and ignore the missing trailing comma.

For now I’m ignoring the error for this line.

The version I have is 1.2.1.

Issue Analytics

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

github_iconTop GitHub Comments

not-an-aardvarkcommented, Dec 11, 2017

I feel like this case is fundamentally the parser’s job to handle. It seems strange for us to add logic for a new error message just to account for a bug in babel-eslint.

Updating the documentation sounds good to me, though.

fatfiszcommented, Dec 11, 2017

Wouldn’t a better error message be a good solution here?

Unexpected trailing comma - no comma allowed after rest properties.

If so, then I could do that.

Read more comments on GitHub >

github_iconTop Results From Across the Web

comma-dangle - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >
Why you should enforce Dangling Commas for Multiline ...
Fortunately ESLint has the comma-dangle rule which allows you to enforce dangling commas for multiline statements. comma-dangle: “always-multiline”.
Read more >
Trailing commas - JavaScript - MDN Web Docs
JavaScript allows trailing commas wherever a comma-separated list of values is accepted and more values may be expected after the last item.
Read more >
Are you using Trailing Commas in your JavaScript?
In multi-line objects & arrays in JavaScript, Trailing Comma is can be very useful, being part of ES5 standard, see how it can...
Read more >
Airbnb JavaScript Style Guide()
3.8 Prefer the object spread operator over Object.assign to shallow-copy objects. ... with a trailing comma on the last item. eslint: function-paren-newline.
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 Post

No results found

github_iconTop Related Hashnode Post

No results found