fix(lint): skip noUselessStringConcat for tagged templates#9565
Conversation
…sStringConcat Fixes biomejs#9505 The `noUselessStringConcat` rule treated tagged template literals (e.g. `sql\`query\``) as plain strings. The autofix would strip the tag function and produce incorrect code. Check `JsTemplateExpression::tag()` before treating a template as a plain string in both `is_string_expression` and `extract_string_value`.
🦋 Changeset detectedLatest commit: d10b82e The changes in this PR will be included in the next version bump. This PR includes changesets to release 13 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
WalkthroughThe Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
ematipico
left a comment
There was a problem hiding this comment.
Changeset missing. Do people read the PR template, or contribution guide or the bot? Lol
|
@ematipico Sorry, first time contributing here and I missed that. Added now. |
|
Thank you. Please next time don't wipe out the PR template (or at least read it). It had all the information you needed. |
Merging this PR will not alter performance
Comparing Footnotes
|
Tagged template literals like sql
querycall a function and are not plain strings. The noUselessStringConcat rule incorrectly treated them as strings and suggested an autofix that stripped the tag, changing runtime behavior.is_string_expressionandextract_string_valuenow checktag().is_none()before classifying a template as a string. Untagged templates are still flagged.Fixes #9505