Tag function (lit-html) breaks arrow function in multiple lines
See original GitHub issueI have an oneliner arrow func smaller than printWidth that keeps being breaked in various lines just because of a html lit-html call inside of it.
Prettier 1.16.1 Playground link
Input:
const result = this.myProp.map(i => html`<li>${this.myMethod(i)}</li>`)
Output:
const result = this.myProp.map(
i =>
html`
<li>${this.myMethod(i)}</li>
`
)
Expected behavior:
const result = this.myProp.map(i => html`<li>${this.myMethod(i)}</li>`)
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (5 by maintainers)
Top Results From Across the Web
Arrow function expressions - JavaScript - MDN Web Docs
The braces can only be omitted if the function directly returns an expression. If the body has additional lines of processing, the braces...
Read more >13. Arrow functions
1. Arrow functions bind very loosely; 13.5. · 2. No line break after arrow function parameters; 13.5. · 3. You can't use statements...
Read more >ES6 Arrow Functions Cheatsheet | SamanthaMing.com
We have several ways of writing our arrow functions. This is because arrow functions can have either "implied return" or "explicit return" keyword....
Read more >Keyboard Shortcuts
Select all text, Ctrl + A, Cmd + A. Copy text, Ctrl + C, Cmd + C ... Go to the right or...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop 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
Top GitHub Comments
Fixed by https://github.com/prettier/prettier/pull/7208
Hitting this as part of AMP HTML’s transition to prettier. Formatting of embedded languages in JS files should be disable-able at a minimum.
This should be given a much higher priority, as this formatting changes the runtime evaluation of the code. This probably means it should be disabled by default.