You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When used as function arguments and in function calls, template literals conditionally insert a newline before and after themselves depending on whether there is a newline in the source code.
Prettier should select one style and stick with it. The Prettier website mentions that only cases where newlines are taken into account are in object literals, object type literals, and decorators, yet the compiler produces different results in this case.
I have found that the minimal example requires that the template literal have a single newline with no other characters. If no newlines are present in the source string, Prettier correctly formats the function call as a single line in the result.
The text was updated successfully, but these errors were encountered:
After experimenting, I noticed that this issue does not occur in computed property access, where a newline is inserted before multi line strings whether or not one existed beforehand.
Duplicate of #2068, we look at newlines (for function call) in your source code to decide to keep the newline or not for better DX, we can solve it only introduce the --pure option
When used as function arguments and in function calls, template literals conditionally insert a newline before and after themselves depending on whether there is a newline in the source code.
Prettier 2.7.1
Playground link 1, playground link 2
Input 1:
Output 1:
Input 2:
Output 2:
Expected behavior:
Prettier should select one style and stick with it. The Prettier website mentions that only cases where newlines are taken into account are in object literals, object type literals, and decorators, yet the compiler produces different results in this case.
I have found that the minimal example requires that the template literal have a single newline with no other characters. If no newlines are present in the source string, Prettier correctly formats the function call as a single line in the result.
The text was updated successfully, but these errors were encountered: