Long names cause strange line-breaks with Arrow Functions
See original GitHub issueI’ve found a strange case when using Arrow functions, chaining methods off an object inside the arrow function.
If I shorten the length of the variable name
or shorten the first method name
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:
- Created 7 years ago
- Comments:5 (3 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Ok, let’s try this. I’m curious if this causes any other awkward formatting, but I think this works.
@rattrayalex Sure! If I didn’t just solve it, I’ll leave it up to you 😃 I think I may have something works.