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.

`func-call-spacing` fix creating bugs

See original GitHub issue

Edit: fix post to reflect real bug.

In the latest ESLint (v3.12.2), the func-call-spacing fix is really unhelpful for multiline call expressions (overlap with no-unexpected-multiline), especially when going without semicolons.

// Short snippet
this.cancelled.add(request)
this.decrement(request)
(0, request.reject)(new api.Cancel())

These are likely meant to be separate statements, with the below being (99.99% of the time) what was meant:

// Short snippet
this.cancelled.add(request)
this.decrement(request)
;(0, request.reject)(new api.Cancel())

Instead, func-call-spacing very unhelpfully fixes it to this, leading to runtime errors nearly every time in practice:

// Short snippet
this.cancelled.add(request)
this.decrement(request)(0, request.reject)(new api.Cancel())

Here’s the same issue, but with trailing semicolons:

Input:

// Short snippet
this.cancelled.add(request);
this.decrement(request)
(0, request.reject)(new api.Cancel());

Meant:

// Short snippet
this.cancelled.add(request);
this.decrement(request);
(0, request.reject)(new api.Cancel());

“Fixed”:

// Short snippet
this.cancelled.add(request);
this.decrement(request)(0, request.reject)(new api.Cancel());

Any chance this could be fixed to be a little less over-zealous?

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
platinumazurecommented, Dec 17, 2016

I’ll work on a fix, unless someone’s already on it.

0reactions
mysticateacommented, Dec 17, 2016

I think the autofix was not wrong since it does not change semantics. But surely this is similar to no-useless-escape rule’s case as @platinumazure mentioned. I agree that people expect func-call-spacing to not fix it automatically if the spaces include line terminators.

Read more comments on GitHub >

github_iconTop Results From Across the Web

func-call-spacing reports "unexpected newline", when there is ...
error Unexpected newline between function name and paren func-call-spacing. Are you willing to submit a pull request to fix this bug?
Read more >
func-call-spacing - Pluggable JavaScript Linter - ESLint
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >
func-call-spacing | typescript-eslint
Require or disallow spacing between function identifiers and their invocations. ... This rule extends the base eslint/func-call-spacing rule.
Read more >
Firmware Bugs « State Space - Embedded Gurus
Here, I call the function assert_failed(), commonly used to handle failing assertions. assert_failed() can be a standard C function, but it should not...
Read more >
Spaces between function name and opening parenthesis ...
There should be no space between the name of a function and the ( (left parenthesis) of its parameter list, unless case of...
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