Skip to content

fix(formatter_css): print Less detached-ruleset mixin calls verbatim - #29938

Closed
oxc-captain[bot] wants to merge 1 commit into
mainfrom
triagebot/fix-29932
Closed

oxc-captain[bot] wants to merge 1 commit into
mainfrom
triagebot/fix-29932

Conversation

@oxc-captain

@oxc-captain oxc-captain Bot commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

A Less mixin call with a detached-ruleset argument (.on-mobile({ ... })) printed its whole raw slice through the number/string normalization pass, which rewrites dotted number runs inside the ruleset body: url(img/a.1.2.png) became url(img/a.10.2.png) and gained another 0 on every run, so oxfmt --check never stabilized and relative image paths silently broke (404). Comment contents were rewritten the same way (1.2.3 → 1.20.3).

Such mixin calls now print verbatim: when an argument is a detached ruleset, or when the call slice contains a comment (Prettier's own selector-unknown fallback, so the reported input matches Prettier exactly and is idempotent). Prettier itself still corrupts the comment-free detached-ruleset case; since that breaks the idempotency contract and changes the emitted URL, we do not follow it there — recorded as less-mixin-detached-ruleset-verbatim in crates/oxc_formatter_css/DIVERGENCES.md. Plain mixin calls keep their Prettier-matched adjusted-verbatim output.

Closes #29932

Automated triagebot fix (AI-assisted).

@oxc-captain
oxc-captain Bot requested a review from leaysgur as a code owner November 20, 2026 08:58
@oxc-captain oxc-captain Bot added the triage: fix verified The proposed fix was verified label Nov 20, 2026
@github-actions github-actions Bot added A-formatter Area - Formatter (oxfmt). Add F-* labels for details F-lang-css Formatter > CSS / SCSS / Less, oxc_formatter_css labels Nov 20, 2026
@graphite-app graphite-app Bot closed this in b373412 Nov 20, 2026
@oxc-captain
oxc-captain Bot deleted the triagebot/fix-29932 branch November 20, 2026 10:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-formatter Area - Formatter (oxfmt). Add F-* labels for details F-lang-css Formatter > CSS / SCSS / Less, oxc_formatter_css triage: fix verified The proposed fix was verified

Projects

None yet

Development

Successfully merging this pull request may close these issues.

formatter: Diff with Prettier on Less mixin call with a detached-ruleset argument (numbers in url()/comments rewritten, non-idempotent)

0 participants