feat(fmt): use lax-css for CSS, SCSS, and Less#35160
Open
bartlomieju wants to merge 11 commits into
Open
Conversation
Style blocks in HTML and components and CSS-in-JS tagged templates now go through lax-css as well; the @dpr1nt placeholders pass through all positions untouched, so the Less wrapper hack is no longer needed. Style attribute contents are kept as written. malva remains only for the indented Sass syntax, which now prints a deprecation warning.
Member
Author
|
I think we should remove support for Sass syntax and remove malva completely from dependency list. |
Per review feedback, drop the indented Sass (.sass) special case that was still routed through malva, and remove malva from the dependency list entirely. lax-css continues to handle CSS, SCSS, and Less. .sass is no longer a supported format: removed from the fmt extension dispatch, is_supported_ext_fmt, the --ext value list, the help text, and the LSP LanguageId enum (so editors treat it as Unknown rather than mis-formatting it as TypeScript).
.sass is no longer a supported format, so the LSP returns no formatting edits for it. Drop the sass fixture and its formatting assertion from the test, which now covers css, scss, and less.
bartlomieju
commented
Jun 13, 2026
Member
Author
There was a problem hiding this comment.
not sure about these, need to verify before landing
bartlomieju
commented
Jun 13, 2026
Member
Author
There was a problem hiding this comment.
ditto - why is this file changed?
bartlomieju
commented
Jun 13, 2026
Member
Author
There was a problem hiding this comment.
this should probably have semicolon at the end
lax-css 0.2.2 normalizes whitespace around selector combinators
(#app>.btn -> #app > .btn) and writes empty rules as {}, both matching
the previous malva output. Regenerates the affected CSS, markdown, and
svelte fixtures and the lsp empty-rule expectation.
# Conflicts: # Cargo.lock # Cargo.toml # cli/Cargo.toml
Inline style="" attributes were passed through unformatted, which left inconsistent output like `width : Xpx; height:1px`. Format them with lax-css's new singleLine mode (lax-css 0.2.3), which normalizes whitespace around colons and between declarations without inserting line breaks. Like the rest of the formatter it never invents or drops tokens.
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.
Routes CSS, SCSS, and Less formatting through lax-css instead of malva, and
removes malva from the dependency tree entirely. lax-css
(https://github.com/bartlomieju/lax) is built on the semantics-free parsing
model from CSS Syntax Level 3: it never reinterprets tokens, only adjusts
whitespace, so unknown at-rules, Tailwind arbitrary values, and future syntax
format correctly instead of being mangled or rejected. This fixes the property
casing loss in unknown at-rules (#26420) and the parse error on
::slotted(* + *)(#34582), neither of which can be fixed upstream in malva.Author line breaks inside values are preserved, which also addresses the value
collapsing complaints from #29326.
Style blocks in HTML and components and CSS-in-JS tagged templates also go
through lax-css; the
@dpr1ntplaceholders pass through all positionsuntouched, so the Less wrapper hack in
format_embedded_cssis gone. Inlinestyle=""attributes are formatted with lax-css's single-line mode, whichnormalizes whitespace around colons and between declarations without inserting
line breaks (line breaks are not allowed in an attribute value); like the rest
of the formatter it never invents or drops tokens, so a trailing
;the authoromitted is not added.
The indented Sass syntax (
.sass) is no longer supported: it was the onlyformat still routed through malva, and lax-css does not parse it. Prettier and
Biome do not support indented Sass either.
.sassis dropped from the fmtextension dispatch,
--ext, the help text, and the LSPLanguageIdenum, soeditors leave it untouched rather than mis-formatting it;
.scssisunaffected. Upgrade churn on files already formatted by deno fmt is near zero
except selector lists, which now always break one per line like Prettier and
Biome.
Fixes #26420
Fixes #34582