Linebreaks weirdly in long ES6 template strings with expressions
Problem
Prettier 1.8.2 Playground link [code block] Input: [code block] Output: [code block] Expected behavior: I would prefer a long string to _not_ get split into multiple lines, even if it contains expressions. When there are no expressions, Prettier correctly lets a long string go beyond the `print-width` limit. I can't decide if this is a bug or a personal preference, but it's been creating weird hard to read code in our codebase. We can clean most of it up by simplifying our expressions, but there's only so short we can go.
Unverified for your environment
Select your OS to check compatibility.
1 Fix
Solution: Linebreaks weirdly in long ES6 template strings with expressions
I'd say a lot of people, including myself, could dig an option that reverts to previous behaviour i.e. rule to disable formatting template literals completely e.g. ignoreTemplateLiterals: true. Does this exist already? Any reason this would be a problem?
Trust Score
7 verifications
- 1
I'd say a lot of people, including myself, could dig an option that reverts to p
I'd say a lot of people, including myself, could dig an option that reverts to previous behaviour i.e. rule to disable formatting template literals completely e.g. ignoreTemplateLiterals: true.
- 2
Does this exist already? Any reason this would be a problem?
Does this exist already? Any reason this would be a problem?
Validation
Resolved in prettier/prettier GitHub issue #3368. Community reactions: 34 upvotes.
Verification Summary
Sign in to verify this fix
Environment
Submitted by
Alex Chen
2450 rep