feat(fmt): use lax-css for formatting CSS, SCSS, and Less files#35160
Draft
bartlomieju wants to merge 3 commits into
Draft
feat(fmt): use lax-css for formatting CSS, SCSS, and Less files#35160bartlomieju wants to merge 3 commits into
bartlomieju wants to merge 3 commits into
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.
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.
lax-css (https://github.com/bartlomieju/dprint-plugin-css) 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 `@dpr1nt` placeholders pass through all positions
untouched, so the Less wrapper hack in `format_embedded_css` is gone.
Style attribute contents are kept as written. malva remains only for the
indented Sass syntax, which now prints a deprecation warning; Prettier and
Biome do not support it either. 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