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.

dangling comma vs. newline paren in 12.

See original GitHub issue

In eslint-config-airbnb-base version 11.3.0, this was ok:

const addFrameworkSoapHeader = soapClient =>
  soapClient.addSoapHeader(
    { Security: 'wsse' },
    'frameworksecurity',
    'wsse',
    'http://schemas.xmlsoap.org/ws/2002/07/secext');

In version 12.0.0, you get in this circular loop. The above code says parens must be on new line, so it becomes:

...
'http://schemas.xmlsoap.org/ws/2002/07/secext'
);

However, if you do that, you get yelled at for no dangling comma. So if you add that:

...
'http://schemas.xmlsoap.org/ws/2002/07/secext',
);

Then ESLint abandons the whole file because of a parsing issue with the extra paren:

Parsing error: Unexpected token )

For now, we’ve locked version in our package.json to 11.3.0.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:11

github_iconTop GitHub Comments

2reactions
JesterXLcommented, Sep 29, 2017

@ljharb You rock, thanks man!

1reaction
danmcommented, Sep 29, 2017

thanks @ljharb, interesting. I always assumed that your style guide was always opinionated towards modern syntax of ES. So that if these rules are followed, and you use a modern version of Node, it would always work.

Totally understand from the client perspective. I shall add transpiling to my server side work flow from now on!

Read more comments on GitHub >

github_iconTop Results From Across the Web

comma-dangle always-multiline should only count newlines ...
The new always-multiline behavior of comma-dangle requires a trailing comma if a newline appears anywhere in the literal.
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 >
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 does adding a trailing comma after an expression create ...
It is the commas, not the parentheses, which are significant. The Python tutorial says: A tuple consists of a number of values separated...
Read more >
jsonc/comma-dangle | eslint-plugin-jsonc
This rule enforces consistent use of trailing commas in object and array literals. 1. 2. 3. 4. 5. 6. 7. 8. 9. 10....
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