fix(noUselessEscapeInString): correctly flag chars#9420
Conversation
🦋 Changeset detectedLatest commit: 3abcf8a 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 |
WalkthroughThis patch fixes the Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 3 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Tip Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs). Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
crates/biome_css_analyze/tests/specs/suspicious/noUselessEscapeInString/valid.css (1)
10-12: Consider one uppercase or digit-led fixture too.This proves the lowercase path, but the matcher now also allows
0-9andA-F. Adding one\31or\E7BBexample would keep those branches from quietly wandering off later.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@crates/biome_css_analyze/tests/specs/suspicious/noUselessEscapeInString/valid.css` around lines 10 - 12, Add an additional test fixture to cover the digit-led or uppercase hex-escape branches: alongside the existing .icon-file:before { content: "\e7bb"; } add another rule using either a digit-led escape (e.g., content: "\31";) or an uppercase hex escape (e.g., content: "\E7BB";) so the matcher is exercised for `0-9` and `A-F` paths.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In
`@crates/biome_css_analyze/tests/specs/suspicious/noUselessEscapeInString/invalid.css`:
- Line 4: The test CSS contains inline comments without inner whitespace around
the comment text (the line with content: /*before*/ "useless \z" /*after*/),
which trips stylelint's comment-whitespace-inside; update the test string to add
spaces inside those comments (e.g., change /*before*/ to /* before */ and
/*after*/ to /* after */) so it conforms to comment-whitespace-inside, then
refresh the snapshot; if the test intentionally ignores inner spacing,
alternatively update the test's expected snapshot to match the exact current
spacing.
---
Nitpick comments:
In
`@crates/biome_css_analyze/tests/specs/suspicious/noUselessEscapeInString/valid.css`:
- Around line 10-12: Add an additional test fixture to cover the digit-led or
uppercase hex-escape branches: alongside the existing .icon-file:before {
content: "\e7bb"; } add another rule using either a digit-led escape (e.g.,
content: "\31";) or an uppercase hex escape (e.g., content: "\E7BB";) so the
matcher is exercised for `0-9` and `A-F` paths.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 87b103bd-b52b-425d-b702-72157a9ec55a
⛔ Files ignored due to path filters (2)
crates/biome_css_analyze/tests/specs/suspicious/noUselessEscapeInString/invalid.css.snapis excluded by!**/*.snapand included by**crates/biome_css_analyze/tests/specs/suspicious/noUselessEscapeInString/valid.css.snapis excluded by!**/*.snapand included by**
📒 Files selected for processing (4)
.changeset/fix-css-unicode-escape-in-string.mdcrates/biome_css_analyze/src/lint/suspicious/no_useless_escape_in_string.rscrates/biome_css_analyze/tests/specs/suspicious/noUselessEscapeInString/invalid.csscrates/biome_css_analyze/tests/specs/suspicious/noUselessEscapeInString/valid.css
|
|
||
| .a::after { | ||
| content: /*before*/ "useless \a" /*after*/ | ||
| content: /*before*/ "useless \z" /*after*/ |
There was a problem hiding this comment.
Stylelint will trip on the inline comments.
Line 4 violates comment-whitespace-inside because of /*before*/ and /*after*/. If the exact spacing is not part of the range test, add the inner spaces and refresh the snapshot.
🧰 Tools
🪛 Stylelint (17.4.0)
[error] 4-4: Expected whitespace after "/*" (comment-whitespace-inside)
(comment-whitespace-inside)
[error] 4-4: Expected whitespace before "*/" (comment-whitespace-inside)
(comment-whitespace-inside)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In
`@crates/biome_css_analyze/tests/specs/suspicious/noUselessEscapeInString/invalid.css`
at line 4, The test CSS contains inline comments without inner whitespace around
the comment text (the line with content: /*before*/ "useless \z" /*after*/),
which trips stylelint's comment-whitespace-inside; update the test string to add
spaces inside those comments (e.g., change /*before*/ to /* before */ and
/*after*/ to /* after */) so it conforms to comment-whitespace-inside, then
refresh the snapshot; if the test intentionally ignores inner spacing,
alternatively update the test's expected snapshot to match the exact current
spacing.
Merging this PR will not alter performance
Comparing Footnotes
|
Summary
Closes #9385
Test Plan
Added a test and updated the current ones
Docs
N/A