-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
js in html tagged template literals too verbose? #5672
Copy link
Copy link
Labels
area:multiparserIssues with printing one language inside another, like CSS-in-JSIssues with printing one language inside another, like CSS-in-JSlang:htmlIssues affecting HTML (and SVG but not JSX)Issues affecting HTML (and SVG but not JSX)lang:javascriptIssues affecting JSIssues affecting JSlocked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.Please open a new issue and fill out the template instead of commenting.status:has prIssues with an accompanying pull request. These issues will probably be fixed soon!Issues with an accompanying pull request. These issues will probably be fixed soon!
Milestone
Metadata
Metadata
Assignees
Labels
area:multiparserIssues with printing one language inside another, like CSS-in-JSIssues with printing one language inside another, like CSS-in-JSlang:htmlIssues affecting HTML (and SVG but not JSX)Issues affecting HTML (and SVG but not JSX)lang:javascriptIssues affecting JSIssues affecting JSlocked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.Please open a new issue and fill out the template instead of commenting.status:has prIssues with an accompanying pull request. These issues will probably be fixed soon!Issues with an accompanying pull request. These issues will probably be fixed soon!
hey,
so when using prettier for tagged template literals it becomes kind of very verbose. e.g. it puts every
${andfunction()on its own line. I would like to get easily readable and "short" js/html code - and that in this case unneeded verbosity sort of defeats the purpose.Don't get me wrong for javascript it completely makes sense... but the js in a html tagged template literal is usually pretty limited. e.g. you will not define full functions there.
So this is basically a discussion to see if we can get a more "suitable" default for js in html tagged template literals. It does not need to be completely the same as
Expected behaviorbut not putting each${followed by afunctiononto a seprate line would already help tremendously.Prettier 1.15.3
Playground link
Input:
Output:
Expected behavior:
An alternative possible outcome (okish):