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.

Long names cause strange line-breaks with Arrow Functions

See original GitHub issue

I’ve found a strange case when using Arrow functions, chaining methods off an object inside the arrow function. image

If I shorten the length of the variable name image or shorten the first method name image then it collapses and displays more correctly.

I also noticed that changing the name of the otherLongfunctionName doesn’t have any effect. In either case above, both long names push the line length beyond the acceptable length. This causes the arrow function parameters to be put on a new line, even though line-breaking after this would lead to a better result. IMO the “problem” examples I provided are already formatted ideally.

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
jlongstercommented, Jan 10, 2017

Ok, let’s try this. I’m curious if this causes any other awkward formatting, but I think this works.

2reactions
jlongstercommented, Jan 10, 2017

@rattrayalex Sure! If I didn’t just solve it, I’ll leave it up to you 😃 I think I may have something works.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Line break within arrow function throws “Uncaught SyntaxError
I'm getting the error “Uncaught SyntaxError: Unexpected token => ” on my console when I put the e parameter in parentheses and then...
Read more >
Leave one-line functions alone · Issue #4125 · prettier/prettier
Expected behavior: The input was perfectly fine as it stood; it was a nice one-liner, exactly 80 characters long. Breaking it into multiple ......
Read more >
Everything One Can Ask You About JavaScript Arrow ...
Arrow Functions is one of the many concepts introduced in Javascript ES6. ... Arrow functions do work on similar grounds, hence the name....
Read more >
ECMAScript 6: arrow functions and method definitions - 2ality
ECMAScript.next will make things easy by introducing two constructs: arrow functions and method definitions. This blog posts explains what ...
Read more >
Anomalies in JavaScript arrow functions - LogRocket Blog
Arrow functions behave differently from regular JS functions — think of them ... Regular JavaScript functions exhibit a strange behavior in ...
Read more >

github_iconTop Related Medium Post

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