-
-
Notifications
You must be signed in to change notification settings - Fork 791
fix(parse/css): fix parsing tailwind source exclude syntax #7853
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
🦋 Changeset detectedLatest commit: 3c60b2f 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 |
Parser conformance results onjs/262
jsx/babel
symbols/microsoft
ts/babel
ts/microsoft
|
WalkthroughAdds support for Tailwind's Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro ⛔ Files ignored due to path filters (8)
📒 Files selected for processing (7)
🚧 Files skipped from review as they are similar to previous changes (5)
🧰 Additional context used📓 Path-based instructions (4)crates/biome_*_{syntax,parser,formatter,analyze,factory,semantic}/**📄 CodeRabbit inference engine (CLAUDE.md)
Files:
crates/biome_*/**📄 CodeRabbit inference engine (CLAUDE.md)
Files:
**/*.rs📄 CodeRabbit inference engine (CONTRIBUTING.md)
Files:
.changeset/*.md📄 CodeRabbit inference engine (CONTRIBUTING.md)
Files:
🧠 Learnings (1)📚 Learning: 2025-10-15T09:19:01.347ZApplied to files:
🪛 LanguageTool.changeset/soft-rules-feel.md[grammar] ~5-~5: There seems to be a noun/verb agreement error. Did you mean “excludes” or “excluded”? (SINGULAR_NOUN_VERB_AGREEMENT) ⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (12)
🔇 Additional comments (1)
Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (8)
crates/biome_css_factory/src/generated/node_factory.rsis excluded by!**/generated/**,!**/generated/**and included by**crates/biome_css_factory/src/generated/syntax_factory.rsis excluded by!**/generated/**,!**/generated/**and included by**crates/biome_css_formatter/tests/specs/css/atrule/tailwind/source-not.css.snapis excluded by!**/*.snapand included by**crates/biome_css_parser/tests/css_test_suite/ok/tailwind/simple.css.snapis excluded by!**/*.snapand included by**crates/biome_css_parser/tests/css_test_suite/ok/tailwind/source-not.css.snapis excluded by!**/*.snapand included by**crates/biome_css_parser/tests/css_test_suite/ok/tailwind/source.css.snapis excluded by!**/*.snapand included by**crates/biome_css_syntax/src/generated/nodes.rsis excluded by!**/generated/**,!**/generated/**and included by**crates/biome_css_syntax/src/generated/nodes_mut.rsis excluded by!**/generated/**,!**/generated/**and included by**
📒 Files selected for processing (7)
.changeset/soft-rules-feel.md(1 hunks)crates/biome_css_formatter/src/tailwind/statements/source_at_rule.rs(1 hunks)crates/biome_css_formatter/tests/specs/css/atrule/tailwind/options.json(1 hunks)crates/biome_css_formatter/tests/specs/css/atrule/tailwind/source-not.css(1 hunks)crates/biome_css_parser/src/syntax/at_rule/tailwind.rs(1 hunks)crates/biome_css_parser/tests/css_test_suite/ok/tailwind/source-not.css(1 hunks)xtask/codegen/css.ungram(1 hunks)
🧰 Additional context used
📓 Path-based instructions (6)
crates/biome_*_{syntax,parser,formatter,analyze,factory,semantic}/**
📄 CodeRabbit inference engine (CLAUDE.md)
Maintain the per-language crate structure: biome_{lang}_{syntax,parser,formatter,analyze,factory,semantic}
Files:
crates/biome_css_parser/src/syntax/at_rule/tailwind.rscrates/biome_css_formatter/tests/specs/css/atrule/tailwind/options.jsoncrates/biome_css_parser/tests/css_test_suite/ok/tailwind/source-not.csscrates/biome_css_formatter/src/tailwind/statements/source_at_rule.rscrates/biome_css_formatter/tests/specs/css/atrule/tailwind/source-not.css
crates/biome_*/**
📄 CodeRabbit inference engine (CLAUDE.md)
Place core crates under /crates/biome_*/
Files:
crates/biome_css_parser/src/syntax/at_rule/tailwind.rscrates/biome_css_formatter/tests/specs/css/atrule/tailwind/options.jsoncrates/biome_css_parser/tests/css_test_suite/ok/tailwind/source-not.csscrates/biome_css_formatter/src/tailwind/statements/source_at_rule.rscrates/biome_css_formatter/tests/specs/css/atrule/tailwind/source-not.css
**/*.rs
📄 CodeRabbit inference engine (CONTRIBUTING.md)
**/*.rs: Format Rust files before committing (e.g., viajust fwhich formats Rust)
Document rules, assists, and options with inline rustdoc in source
Files:
crates/biome_css_parser/src/syntax/at_rule/tailwind.rscrates/biome_css_formatter/src/tailwind/statements/source_at_rule.rs
**/tests/**
📄 CodeRabbit inference engine (CLAUDE.md)
Place test files under a tests/ directory in each crate
Files:
crates/biome_css_formatter/tests/specs/css/atrule/tailwind/options.jsoncrates/biome_css_parser/tests/css_test_suite/ok/tailwind/source-not.csscrates/biome_css_formatter/tests/specs/css/atrule/tailwind/source-not.css
xtask/codegen/*.ungram
📄 CodeRabbit inference engine (CLAUDE.md)
Define and modify language grammars in .ungram files; ASTs are generated from these
Files:
xtask/codegen/css.ungram
.changeset/*.md
📄 CodeRabbit inference engine (CONTRIBUTING.md)
.changeset/*.md: In changesets, only use #### or ##### headers; other header levels are not allowed
Changesets should cover user-facing changes only; internal changes do not need changesets
Use past tense for what you did and present tense for current Biome behavior in changesets
When fixing a bug in a changeset, start with an issue link (e.g., “Fixed #1234: …”)
When referencing a rule or assist in a changeset, include a link to its page on the website
Include code blocks in changesets when applicable to illustrate changes
End every sentence in a changeset with a period
Files:
.changeset/soft-rules-feel.md
🧠 Learnings (1)
📚 Learning: 2025-10-15T09:22:15.851Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:22:15.851Z
Learning: Applies to crates/biome_formatter/tests/specs/**/options.json : Use options.json files colocated with test inputs to override formatting options for all files in that folder
Applied to files:
crates/biome_css_formatter/tests/specs/css/atrule/tailwind/options.json
🧬 Code graph analysis (1)
crates/biome_css_formatter/src/tailwind/statements/source_at_rule.rs (1)
crates/biome_css_syntax/src/generated/nodes.rs (23)
source_token(7227-7229)not_token(820-822)not_token(1085-1087)not_token(3165-3167)not_token(6042-6044)not_token(7230-7232)path(6954-6956)path(7184-7186)path(7233-7235)semicolon_token(347-349)semicolon_token(1553-1555)semicolon_token(1684-1686)semicolon_token(2234-2236)semicolon_token(2788-2790)semicolon_token(3444-3446)semicolon_token(6489-6491)semicolon_token(6624-6626)semicolon_token(6912-6914)semicolon_token(6957-6959)semicolon_token(7051-7053)semicolon_token(7142-7144)semicolon_token(7187-7189)semicolon_token(7236-7238)
🪛 LanguageTool
.changeset/soft-rules-feel.md
[grammar] ~5-~5: There seems to be a noun/verb agreement error. Did you mean “excludes” or “excluded”?
Context: ...l now correctly parse tailwind's source exclude syntax: @source not "foo.css";
(SINGULAR_NOUN_VERB_AGREEMENT)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (12)
- GitHub Check: Lint project (depot-ubuntu-24.04-arm-16)
- GitHub Check: Test (depot-ubuntu-24.04-arm-16)
- GitHub Check: Documentation
- GitHub Check: Lint project (depot-windows-2022)
- GitHub Check: Test (depot-windows-2022-16)
- GitHub Check: Check Dependencies
- GitHub Check: Test Node.js API
- GitHub Check: Bench (biome_css_parser)
- GitHub Check: Bench (biome_css_formatter)
- GitHub Check: Parser conformance
- GitHub Check: Bench (biome_css_analyze)
- GitHub Check: autofix
🔇 Additional comments (6)
crates/biome_css_formatter/tests/specs/css/atrule/tailwind/source-not.css (1)
1-1: LGTM! Intentional whitespace for formatter testing.The excessive whitespace is appropriate for testing that the formatter correctly normalises the
@source notdirective.crates/biome_css_parser/tests/css_test_suite/ok/tailwind/source-not.css (1)
1-1: LGTM! Clean test case for the new syntax.The test correctly demonstrates the
@source notexclusion syntax as documented in Tailwind.crates/biome_css_parser/src/syntax/at_rule/tailwind.rs (1)
218-220: LGTM! Clean implementation of optionalnottoken parsing.The logic correctly handles the optional
notkeyword after thesourcetoken, matching the updated grammar definition.crates/biome_css_formatter/tests/specs/css/atrule/tailwind/options.json (1)
1-7: LGTM! Proper test configuration for Tailwind directives.The options file correctly enables
tailwindDirectivesparsing for the test suite, allowing the formatter to handle the new@source notsyntax.Based on learnings
crates/biome_css_formatter/src/tailwind/statements/source_at_rule.rs (1)
10-10: LGTM! Correct handling of optionalnot_tokenin formatting.The formatter properly destructures and conditionally emits the
not_tokenwhen present, maintaining correct spacing between tokens.Also applies to: 16-18
xtask/codegen/css.ungram (1)
1944-1944: LGTM! Grammar correctly reflects the optionalnottoken.The updated
TwSourceAtRuledefinition properly allows thenotkeyword to be optional aftersource, supporting both inclusion and exclusion syntax.
.changeset/soft-rules-feel.md
Outdated
| "@biomejs/biome": patch | ||
| --- | ||
|
|
||
| The css parser with `tailwindDirectives` enabled will now correctly parse tailwind's source exclude syntax: `@source not "foo.css";` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Grammar: Use "exclusion" instead of "exclude".
The phrase "source exclude syntax" is grammatically awkward.
Apply this diff:
-The css parser with `tailwindDirectives` enabled will now correctly parse tailwind's source exclude syntax: `@source not "foo.css";`
+The css parser with `tailwindDirectives` enabled will now correctly parse tailwind's source exclusion syntax: `@source not "foo.css";`📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| The css parser with `tailwindDirectives` enabled will now correctly parse tailwind's source exclude syntax: `@source not "foo.css";` | |
| The css parser with `tailwindDirectives` enabled will now correctly parse tailwind's source exclusion syntax: `@source not "foo.css";` |
🧰 Tools
🪛 LanguageTool
[grammar] ~5-~5: There seems to be a noun/verb agreement error. Did you mean “excludes” or “excluded”?
Context: ...l now correctly parse tailwind's source exclude syntax: @source not "foo.css";
(SINGULAR_NOUN_VERB_AGREEMENT)
🤖 Prompt for AI Agents
In .changeset/soft-rules-feel.md around line 5, change the phrase "source
exclude syntax" to "source exclusion syntax" so the sentence reads: "The css
parser with `tailwindDirectives` enabled will now correctly parse tailwind's
source exclusion syntax: `@source not \"foo.css\";`". Ensure only the wording is
updated and punctuation/formatting remains unchanged.
CodSpeed Performance ReportMerging #7853 will not alter performanceComparing Summary
Footnotes
|
f94466e to
3c60b2f
Compare
Summary
The css parser will now accept
@source not "foo.css";See also: https://tailwindcss.com/docs/detecting-classes-in-source-files#ignoring-specific-paths
fixes #7848
Test Plan
added snapshot tests
Docs