-
Notifications
You must be signed in to change notification settings - Fork 46.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update safe-string-coercion to handle additions of string literals #25286
Conversation
Comparing: aed33a4...4d32d44 Critical size changesIncludes critical production bundles, as well as any change greater than 2%:
Significant size changesIncludes any change greater than 0.2%: (No significant changes) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you need a check that the operator is +
?
11496fa
to
13ecb57
Compare
@acdlite would appreciate a review if you have time, not a big deal but solves a minor annoyance (typing |
13ecb57
to
3c3b70a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To confirm, this is just annoying while typing in development right? There's no need to commit a + ''
with a string literal.
Worth checking that the template literal doesn't have any substitutions?
I guess even if the template literal has substitutions then the |
@sophiebits Yeah this is really a mild annoyance at dev time when you're say, writing a long error message that spans multiple lines. Good point about tagged template literals returning non-strings though, I just tried it out and it looks like it is possible. I'll see if I can just match on non-tagged |
Adding strings shouldn't trigger a lint violation of this rule, since adding strings are always safe.
3c3b70a
to
4d32d44
Compare
Updated so we only treat untagged template literals as strings. |
Adding strings shouldn't trigger a lint violation of this rule, since adding strings are always safe.