feat(css_formatter): media and container queries #1294
Merged
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.
Summary
#1285. whew there are a bunch of nodes for at rules with queries. Thankfully they're all pretty straightforward and combine well.
Checking with Prettier, it looks like they don't really do any parsing of media and container queries and just print them out almost verbatim. They use a
fill
and effectively treat it just like a normal selector list (each entry is comma separated, everything within the entry is anotherfill
with space separators). I think this implementation gets pretty close to that, but we'll have to write some stress/fuzz tests to compare against Prettier for full compatibility, since their tests don't really cover everything in great detail.Test Plan
The
@media
tests from Prettier are actually pretty good! So I just copied that over as the spec test, then copied over the parser tests for@container
and added some variations to cover whitespace and newlines in there.