prefer-string-raw: Forbid unnecessary String.raw#2695
Merged
sindresorhus merged 18 commits intoJun 5, 2026
Merged
Conversation
som-sm
commented
Jun 25, 2025
fisker
reviewed
Jun 26, 2025
fisker
reviewed
Jun 26, 2025
fisker
reviewed
Jun 26, 2025
prefer-string-raw: Remove unnecessary usagesprefer-string-raw: Forbid unnecessary String.raw
fisker
reviewed
Jun 26, 2025
fisker
reviewed
Jun 27, 2025
fisker
reviewed
Jun 27, 2025
fisker
reviewed
Jun 27, 2025
fisker
reviewed
Jun 27, 2025
0c30a3c to
ffcc738
Compare
fisker
reviewed
Jun 27, 2025
fisker
reviewed
Oct 12, 2025
fisker
referenced
this pull request
Oct 13, 2025
Collaborator
|
@som-sm Can you solve the conflicts? |
Owner
|
Bump :) |
Contributor
Author
|
Hi, apologies! This slipped off my head. I'll try to update this sometime this week. |
0cc9823 to
1aebc29
Compare
528fef7 to
27be5c6
Compare
27be5c6 to
bf5619e
Compare
Contributor
Author
|
I had lost all context on this, but I've tried to update it and address all pending comments. |
Owner
|
The fixer handles multiline Input: function* foo() {
yield String.raw
// comment
`abc`;
}Current fix: function* foo() {
yield
// comment
'abc';
}This changes runtime behvaior because ASI inserts after And an extra tests worth adding, same multiline function* foo() {
yield String.raw
`a${value}`;
} |
814b622 to
0e023e3
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2652
This PR simply loops over all the
quasisand checks if any of them contain a backslash. If none of them do, then the rule starts complaining.Also, the suggestion is a template string(
`) only if there areexpressionsor the string contains line breaks, otherwise, the suggestion is always a single quotes string (').