+
Skip to content

Conversation

dyc3
Copy link
Contributor

@dyc3 dyc3 commented Jul 30, 2025

Summary

There are some base names in tailwind that contain dashes, like border-spacing. There are also named values like red-500 that contain dashes. In order to consistently parse these base names with dashes, we need to maintain a list of base names with dashes in them, at the minimum. I was hoping to be able to use binary_search instead of rfind, but the constraint that we need to find the longest match makes that a little difficult. Open to suggestions.

I think that eventually, we will need to parse the user's tailwind config before parsing, but that's a problem for later. :)

Test Plan

Added tests.

Docs

Summary by CodeRabbit

  • New Features

    • Improved parsing of Tailwind CSS utility classes that contain dashes in their base names for more accurate recognition.
    • Expanded support for Tailwind CSS utility class metadata, enhancing detection and parsing capabilities.
  • Tests

    • Added new test cases to validate parsing of utility classes with dashes, custom color values, and bracket notation.
    • Included tests for advanced gradient and border spacing utilities.
  • Documentation

    • Introduced comprehensive static metadata for Tailwind CSS utility classes, aiding future enhancements and reference.

Copy link

changeset-bot bot commented Jul 30, 2025

⚠️ No Changeset found

Latest commit: 9925207

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions github-actions bot added the A-Parser Area: parser label Jul 30, 2025
Copy link

codspeed-hq bot commented Jul 30, 2025

CodSpeed Performance Report

Merging #7068 will not alter performance

Comparing tailwind-dashed-bases (e41cc72) with main (137d111)

Summary

✅ 128 untouched benchmarks

@dyc3 dyc3 requested review from a team August 3, 2025 17:17
Copy link
Contributor

coderabbitai bot commented Aug 9, 2025

Walkthrough

This update introduces a new metadata module to the Tailwind syntax crate, providing large constant arrays of known utility class names and base names with dashes. The Tailwind parser’s lexer is modified to use a longest-prefix match against these base names when parsing, improving accuracy for class names containing dashes. Several new test cases are added to verify correct parsing of utility classes, particularly those with dashes and custom values. No changes are made to public function signatures or control flow outside the targeted lexer logic.

Changes

Cohort / File(s) Change Summary
Lexer Enhancement
crates/biome_tailwind_parser/src/lexer/mod.rs
Modified consume_base method to prioritize longest-prefix matching against BASENAMES_WITH_DASHES before fallback parsing. Imported BASENAMES_WITH_DASHES from new metadata module.
Metadata Module Addition
crates/biome_tailwind_syntax/src/lib.rs, crates/biome_tailwind_syntax/src/metadata.rs
Added new public metadata module with constants: BASENAMES_WITH_DASHES, KNOWN_STATIC_UTILITIES, and KNOWN_FUNCTIONAL_UTILITIES. Included a test to verify sorting of base names.
New Test Cases
crates/biome_tailwind_parser/tests/tailwind_specs/ok/brackets/gradient.txt, crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/base-has-dash-0.txt, base-has-dash-1.txt, base-has-dash-2.txt
Added new test cases covering utility classes with dashes, custom hex colors, custom values with brackets, and background gradients with position and color stops.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐇
In dashes deep, the bases hide,
A longest match now is our guide.
With gradients bright and shadows cast,
Our parser’s swift, it’s built to last.
New tests hop in, all neat and spry,
Tailwind’s dance beneath the sky! 🌿✨

Note

🔌 MCP (Model Context Protocol) integration is now available in Early Access!

Pro users can now connect to remote MCP servers under the Integrations page to get reviews and chat conversations that understand additional development context.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9925207 and e41cc72.

⛔ Files ignored due to path filters (5)
  • crates/biome_tailwind_parser/tests/tailwind_specs/ok/brackets/gradient.txt.snap is excluded by !**/*.snap
  • crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/base-has-dash-0.txt.snap is excluded by !**/*.snap
  • crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/base-has-dash-1.txt.snap is excluded by !**/*.snap
  • crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/base-has-dash-2.txt.snap is excluded by !**/*.snap
  • crates/biome_tailwind_parser/tests/tailwind_specs/ok/stress/stress-2.txt.snap is excluded by !**/*.snap
📒 Files selected for processing (7)
  • crates/biome_tailwind_parser/src/lexer/mod.rs (2 hunks)
  • crates/biome_tailwind_parser/tests/tailwind_specs/ok/brackets/gradient.txt (1 hunks)
  • crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/base-has-dash-0.txt (1 hunks)
  • crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/base-has-dash-1.txt (1 hunks)
  • crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/base-has-dash-2.txt (1 hunks)
  • crates/biome_tailwind_syntax/src/lib.rs (1 hunks)
  • crates/biome_tailwind_syntax/src/metadata.rs (1 hunks)
✅ Files skipped from review due to trivial changes (2)
  • crates/biome_tailwind_syntax/src/lib.rs
  • crates/biome_tailwind_syntax/src/metadata.rs
🚧 Files skipped from review as they are similar to previous changes (5)
  • crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/base-has-dash-1.txt
  • crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/base-has-dash-2.txt
  • crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/base-has-dash-0.txt
  • crates/biome_tailwind_parser/tests/tailwind_specs/ok/brackets/gradient.txt
  • crates/biome_tailwind_parser/src/lexer/mod.rs
⏰ 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). (24)
  • GitHub Check: Documentation
  • GitHub Check: Test (depot-ubuntu-24.04-arm-16)
  • GitHub Check: Test (depot-windows-2022-16)
  • GitHub Check: Lint project (depot-ubuntu-24.04-arm-16)
  • GitHub Check: Lint project (depot-windows-2022)
  • GitHub Check: Bench (biome_package)
  • GitHub Check: Check Dependencies
  • GitHub Check: Bench (biome_configuration)
  • GitHub Check: Bench (biome_module_graph)
  • GitHub Check: Bench (biome_html_formatter)
  • GitHub Check: Bench (biome_html_parser)
  • GitHub Check: Bench (biome_json_formatter)
  • GitHub Check: Bench (biome_graphql_formatter)
  • GitHub Check: Bench (biome_graphql_parser)
  • GitHub Check: Bench (biome_json_parser)
  • GitHub Check: Bench (biome_js_analyze)
  • GitHub Check: Bench (biome_json_analyze)
  • GitHub Check: Bench (biome_css_parser)
  • GitHub Check: Bench (biome_css_analyze)
  • GitHub Check: Bench (biome_css_formatter)
  • GitHub Check: Bench (biome_js_parser)
  • GitHub Check: Bench (biome_js_formatter)
  • GitHub Check: Test Node.js API
  • GitHub Check: autofix
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch tailwind-dashed-bases

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (4)
crates/biome_tailwind_syntax/src/metadata.rs (4)

139-141: Use rustdoc for public constants

These are public APIs; prefer rustdoc so they show up in docs.

-// Static utilities that don't take parameters
+/// Static utilities that don't take parameters
 pub const KNOWN_STATIC_UTILITIES: &[&str] = &[

986-988: Use rustdoc for public constants

Same here, make the description discoverable in docs.

-// Functional utilities that take parameters (like w-*, bg-*, etc.)
+/// Functional utilities that take parameters (like w-*, bg-*, etc.)
 pub const KNOWN_FUNCTIONAL_UTILITIES: &[&str] = &[

2-137: Optional: store a length-descending view if you rely on longest-prefix scans

If the lexer scans this list linearly to find the longest match, a length-descending slice (or a trie) can cut comparisons. Can be built once at compile time or via codegen without touching parser logic.


1326-1336: Great invariant test; consider adding uniqueness checks

Sorting is covered. Also consider asserting no duplicates across each list to avoid accidental drift.

Example:

let mut set = std::collections::BTreeSet::new();
for &s in KNOWN_STATIC_UTILITIES {
    assert!(set.insert(s), "Duplicate in KNOWN_STATIC_UTILITIES: {s}");
}
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1a14a59 and 9925207.

⛔ Files ignored due to path filters (5)
  • crates/biome_tailwind_parser/tests/tailwind_specs/ok/brackets/gradient.txt.snap is excluded by !**/*.snap
  • crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/base-has-dash-0.txt.snap is excluded by !**/*.snap
  • crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/base-has-dash-1.txt.snap is excluded by !**/*.snap
  • crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/base-has-dash-2.txt.snap is excluded by !**/*.snap
  • crates/biome_tailwind_parser/tests/tailwind_specs/ok/stress/stress-2.txt.snap is excluded by !**/*.snap
📒 Files selected for processing (7)
  • crates/biome_tailwind_parser/src/lexer/mod.rs (2 hunks)
  • crates/biome_tailwind_parser/tests/tailwind_specs/ok/brackets/gradient.txt (1 hunks)
  • crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/base-has-dash-0.txt (1 hunks)
  • crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/base-has-dash-1.txt (1 hunks)
  • crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/base-has-dash-2.txt (1 hunks)
  • crates/biome_tailwind_syntax/src/lib.rs (1 hunks)
  • crates/biome_tailwind_syntax/src/metadata.rs (1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
crates/biome_*/**/*

📄 CodeRabbit Inference Engine (CLAUDE.md)

Core crates must be located in /crates/biome_*/

Files:

  • crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/base-has-dash-1.txt
  • crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/base-has-dash-0.txt
  • crates/biome_tailwind_syntax/src/lib.rs
  • crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/base-has-dash-2.txt
  • crates/biome_tailwind_parser/tests/tailwind_specs/ok/brackets/gradient.txt
  • crates/biome_tailwind_parser/src/lexer/mod.rs
  • crates/biome_tailwind_syntax/src/metadata.rs
**/*.{rs,toml}

📄 CodeRabbit Inference Engine (CLAUDE.md)

Format code (Rust + TOML) using just format

Format Rust and TOML files using just f (alias for just format).

Files:

  • crates/biome_tailwind_syntax/src/lib.rs
  • crates/biome_tailwind_parser/src/lexer/mod.rs
  • crates/biome_tailwind_syntax/src/metadata.rs
**/*.rs

📄 CodeRabbit Inference Engine (CONTRIBUTING.md)

Update documentation for new features or changes, using inline rustdoc for rules, assists, and their options.

Files:

  • crates/biome_tailwind_syntax/src/lib.rs
  • crates/biome_tailwind_parser/src/lexer/mod.rs
  • crates/biome_tailwind_syntax/src/metadata.rs
🧠 Learnings (35)
📓 Common learnings
Learnt from: CR
PR: biomejs/biome#0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:49:35.574Z
Learning: Applies to crates/biome_lint_rules/**/*.rs : Linter rules must have a `version` metadata field in their implementation, set to "next" for new rules and updated to the new version when releasing.
Learnt from: CR
PR: biomejs/biome#0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:49:35.574Z
Learning: Applies to **/*.rs : Update documentation for new features or changes, using inline rustdoc for rules, assists, and their options.
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:56.365Z
Learning: Applies to crates/biome_formatter/**/Cargo.toml : Update the `Cargo.toml` file to include the specified `[dev-dependencies]` for testing utilities.
📚 Learning: 2025-08-05T14:50:56.365Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:56.365Z
Learning: Applies to crates/biome_formatter/tests/specs/html/**/*.html : Create your first `.html` test file inside `tests/specs/html`, preferably organizing tests into subfolders by kind.

Applied to files:

  • crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/base-has-dash-1.txt
  • crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/base-has-dash-0.txt
  • crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/base-has-dash-2.txt
  • crates/biome_tailwind_parser/tests/tailwind_specs/ok/brackets/gradient.txt
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/tests/specs/*/*/{invalid*,valid*}* : Snapshot tests for rules should be placed in `tests/specs/<group>/<rule_name>/` with files prefixed by `invalid` or `valid`.

Applied to files:

  • crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/base-has-dash-1.txt
  • crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/base-has-dash-0.txt
  • crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/base-has-dash-2.txt
📚 Learning: 2025-08-05T14:50:56.365Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:56.365Z
Learning: Applies to crates/biome_formatter/tests/{spec_test.rs,spec_tests.rs,language.rs} : Inside the `biome_html_formatter` crate, create a `tests` folder containing a `specs` folder and the files `spec_test.rs`, `spec_tests.rs`, and `language.rs` for test infrastructure.

Applied to files:

  • crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/base-has-dash-0.txt
  • crates/biome_tailwind_parser/tests/tailwind_specs/ok/brackets/gradient.txt
  • crates/biome_tailwind_syntax/src/metadata.rs
📚 Learning: 2025-08-05T14:50:56.365Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:56.365Z
Learning: Applies to crates/biome_formatter/tests/spec_tests.rs : Update the `spec_tests.rs` file to generate a test function for each `.html` file found inside `tests/specs/html` using the `tests_macros::gen_tests!` macro.

Applied to files:

  • crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/base-has-dash-0.txt
  • crates/biome_tailwind_parser/tests/tailwind_specs/ok/brackets/gradient.txt
  • crates/biome_tailwind_syntax/src/metadata.rs
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/tests/specs/*/*/*.jsonc : Files ending with `.jsonc` in snapshot tests should contain arrays of code snippets for script environments.

Applied to files:

  • crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/base-has-dash-0.txt
📚 Learning: 2025-08-05T14:51:59.193Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_service/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:59.193Z
Learning: Applies to crates/biome_service/src/workspace/watcher.tests.rs : Add tests for watcher workspace methods in watcher.tests.rs (src/workspace/watcher.tests.rs)

Applied to files:

  • crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/base-has-dash-0.txt
📚 Learning: 2025-08-05T14:50:56.365Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:56.365Z
Learning: Applies to crates/biome_formatter/**/lib.rs : Add the provided formatting infrastructure code inside your `lib.rs` file when creating a new formatter crate for a language (e.g., biome_html_formatter).

Applied to files:

  • crates/biome_tailwind_syntax/src/lib.rs
  • crates/biome_tailwind_syntax/src/metadata.rs
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/*.rs : If a lint rule is ported from another ecosystem (e.g., ESLint), add a `sources` metadata field in `declare_lint_rule!` referencing the original rule.

Applied to files:

  • crates/biome_tailwind_syntax/src/lib.rs
  • crates/biome_tailwind_syntax/src/metadata.rs
📚 Learning: 2025-08-05T14:49:35.574Z
Learnt from: CR
PR: biomejs/biome#0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:49:35.574Z
Learning: Applies to crates/biome_lint_rules/**/*.rs : Linter rules must have a `version` metadata field in their implementation, set to "next" for new rules and updated to the new version when releasing.

Applied to files:

  • crates/biome_tailwind_syntax/src/lib.rs
  • crates/biome_tailwind_syntax/src/metadata.rs
📚 Learning: 2025-08-05T14:50:35.163Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_diagnostics/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:35.163Z
Learning: Applies to crates/biome_diagnostics/crates/biome_diagnostics_categories/src/categories.rs : When declaring a new diagnostic category, add it to crates/biome_diagnostics_categories/src/categories.rs to ensure it is statically registered.

Applied to files:

  • crates/biome_tailwind_syntax/src/lib.rs
  • crates/biome_tailwind_syntax/src/metadata.rs
📚 Learning: 2025-08-05T14:50:25.072Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_aria_metadata/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:25.072Z
Learning: Applies to crates/biome_aria_metadata/**/build.rs : The `build.rs` script uses `aria-data.json` to generate ARIA metadata.

Applied to files:

  • crates/biome_tailwind_syntax/src/lib.rs
  • crates/biome_tailwind_syntax/src/metadata.rs
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/*.rs : The `declare_lint_rule!` macro must be used to declare an analyzer rule type and implement the RuleMeta trait.

Applied to files:

  • crates/biome_tailwind_syntax/src/lib.rs
📚 Learning: 2025-08-05T14:51:51.355Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:51.355Z
Learning: Applies to crates/biome_parser/crates/biome_*/src/generated/ : Create a `generated/` folder inside the `src/` folder of each new language crate (e.g., `crates/biome_html_syntax/src/generated/`).

Applied to files:

  • crates/biome_tailwind_syntax/src/lib.rs
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/*.rs : If a rule provides a code action, add the `fix_kind` metadata to the `declare_lint_rule!` macro and implement the `action` function.

Applied to files:

  • crates/biome_tailwind_syntax/src/lib.rs
📚 Learning: 2025-08-05T14:50:56.365Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:56.365Z
Learning: Applies to crates/biome_formatter/**/Cargo.toml : Update the `Cargo.toml` file to include the specified `[dev-dependencies]` for testing utilities.

Applied to files:

  • crates/biome_tailwind_syntax/src/lib.rs
📚 Learning: 2025-08-05T14:51:51.355Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:51.355Z
Learning: Applies to crates/biome_parser/**/language_kind.rs : Add a new prefix (e.g., `html_`) to `LANGUAGE_PREFIXES` in `language_kind.rs` for each new language.

Applied to files:

  • crates/biome_tailwind_syntax/src/lib.rs
  • crates/biome_tailwind_parser/src/lexer/mod.rs
  • crates/biome_tailwind_syntax/src/metadata.rs
📚 Learning: 2025-08-05T14:51:51.355Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:51.355Z
Learning: Applies to crates/biome_parser/crates/biome_*/**/*.rs : Use conditional syntax handling to add diagnostics if a syntax is not supported in the current file or context, and wrap invalid syntax in a `BOGUS` node if necessary.

Applied to files:

  • crates/biome_tailwind_syntax/src/lib.rs
  • crates/biome_tailwind_parser/src/lexer/mod.rs
📚 Learning: 2025-08-05T14:51:05.640Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:05.640Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : For tokens that are not mandatory, use the provided helper functions when formatting AST nodes.

Applied to files:

  • crates/biome_tailwind_syntax/src/lib.rs
  • crates/biome_tailwind_parser/src/lexer/mod.rs
📚 Learning: 2025-08-05T14:51:51.355Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:51.355Z
Learning: Applies to crates/biome_parser/xtask/codegen/*.ungram : Nodes for enclosing syntax errors must have the word `Bogus` in their name (e.g., `HtmlBogusAttribute`).

Applied to files:

  • crates/biome_tailwind_syntax/src/lib.rs
📚 Learning: 2025-08-05T14:51:05.640Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:05.640Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : Import the `FormatNode` trait and implement it for your Node when creating a new AST node formatter.

Applied to files:

  • crates/biome_tailwind_syntax/src/lib.rs
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/*.rs : When a rule needs to query multiple node types, use the `declare_node_union!` macro to define a union type.

Applied to files:

  • crates/biome_tailwind_syntax/src/lib.rs
📚 Learning: 2025-08-05T14:50:56.365Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:56.365Z
Learning: Applies to crates/biome_formatter/**/cst.rs : Define the `FormatHtmlSyntaxNode` type inside a file called `cst.rs` and implement the required formatting traits and plumbing for CST formatting.

Applied to files:

  • crates/biome_tailwind_syntax/src/lib.rs
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/*.rs : When implementing custom syntax tree visitors, define a `Visitor` struct and implement the `Visitor` trait for efficient traversal.

Applied to files:

  • crates/biome_tailwind_syntax/src/lib.rs
📚 Learning: 2025-08-05T14:51:51.355Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:51.355Z
Learning: Applies to crates/biome_parser/crates/biome_*/**/token_source*.rs : Implement a token source as a thin layer wrapping the lexer, supporting lookahead, re-lexing, and checkpoint features.

Applied to files:

  • crates/biome_tailwind_parser/src/lexer/mod.rs
📚 Learning: 2025-08-05T14:51:51.355Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:51.355Z
Learning: Applies to crates/biome_parser/crates/biome_*/lexer/mod.rs : Implement the `Lexer` trait from the `biome_parser` crate for your language-specific lexer struct.

Applied to files:

  • crates/biome_tailwind_parser/src/lexer/mod.rs
📚 Learning: 2025-08-05T14:51:51.355Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:51.355Z
Learning: Applies to crates/biome_parser/crates/biome_*/lexer/mod.rs : Create a `lexer/mod.rs` file inside the parser crate for each language to implement the lexer.

Applied to files:

  • crates/biome_tailwind_parser/src/lexer/mod.rs
📚 Learning: 2025-08-05T14:51:51.355Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:51.355Z
Learning: Applies to crates/biome_parser/crates/biome_*/**/*.rs : Parse rule functions must be prefixed with `parse_` and use the name defined in the grammar file (e.g., `parse_for_statement`).

Applied to files:

  • crates/biome_tailwind_parser/src/lexer/mod.rs
📚 Learning: 2025-08-05T14:51:05.640Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:05.640Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : When formatting AST nodes, if a token is mandatory and the AST has that information, use the token from the AST node (e.g., `node.l_paren_token().format()`) instead of hardcoding the token (e.g., `token("(")`).

Applied to files:

  • crates/biome_tailwind_parser/src/lexer/mod.rs
📚 Learning: 2025-08-05T14:51:51.355Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:51.355Z
Learning: Applies to crates/biome_parser/crates/biome_*/**/*.rs : When parsing lists, perform error recovery to avoid infinite loops, using the provided parser infrastructure.

Applied to files:

  • crates/biome_tailwind_parser/src/lexer/mod.rs
📚 Learning: 2025-08-05T14:51:51.355Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:51.355Z
Learning: Applies to crates/biome_parser/crates/biome_*/**/*.rs : Consult the grammar to identify the appropriate `BOGUS` node for error recovery in your parse rule.

Applied to files:

  • crates/biome_tailwind_parser/src/lexer/mod.rs
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/*.rs : Avoid unnecessary string allocations by comparing against `&str` or `TokenText` instead of calling `to_string()`.

Applied to files:

  • crates/biome_tailwind_parser/src/lexer/mod.rs
📚 Learning: 2025-08-05T13:25:32.395Z
Learnt from: CR
PR: biomejs/biome#0
File: CLAUDE.md:0-0
Timestamp: 2025-08-05T13:25:32.395Z
Learning: Each language crate must follow the structure: biome_{lang}_syntax, biome_{lang}_parser, biome_{lang}_formatter, biome_{lang}_analyze, biome_{lang}_factory, biome_{lang}_semantic (where applicable)

Applied to files:

  • crates/biome_tailwind_parser/src/lexer/mod.rs
📚 Learning: 2025-08-05T14:49:35.574Z
Learnt from: CR
PR: biomejs/biome#0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:49:35.574Z
Learning: Applies to **/*.rs : Update documentation for new features or changes, using inline rustdoc for rules, assists, and their options.

Applied to files:

  • crates/biome_tailwind_syntax/src/metadata.rs
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_rule_options/lib/*.rs : Use boxed slices (`Box<[Box<str>]>`) instead of `Vec<String>` for string arrays in rule options to save memory.

Applied to files:

  • crates/biome_tailwind_syntax/src/metadata.rs
⏰ 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). (25)
  • GitHub Check: Documentation
  • GitHub Check: End-to-end tests
  • GitHub Check: Test (depot-ubuntu-24.04-arm-16)
  • GitHub Check: Test (depot-windows-2022-16)
  • GitHub Check: Bench (biome_configuration)
  • GitHub Check: Bench (biome_module_graph)
  • GitHub Check: Bench (biome_html_formatter)
  • GitHub Check: Bench (biome_package)
  • GitHub Check: Lint project (depot-windows-2022)
  • GitHub Check: Bench (biome_graphql_formatter)
  • GitHub Check: Bench (biome_html_parser)
  • GitHub Check: Lint project (depot-ubuntu-24.04-arm-16)
  • GitHub Check: Bench (biome_graphql_parser)
  • GitHub Check: Bench (biome_json_analyze)
  • GitHub Check: Bench (biome_json_parser)
  • GitHub Check: Bench (biome_json_formatter)
  • GitHub Check: Bench (biome_css_parser)
  • GitHub Check: Check Dependencies
  • GitHub Check: Bench (biome_css_formatter)
  • GitHub Check: Bench (biome_js_analyze)
  • GitHub Check: Bench (biome_css_analyze)
  • GitHub Check: Bench (biome_js_parser)
  • GitHub Check: Bench (biome_js_formatter)
  • GitHub Check: Test Node.js API
  • GitHub Check: autofix
🔇 Additional comments (9)
crates/biome_tailwind_syntax/src/metadata.rs (2)

2-137: Nice: curated dashed basenames and a sort invariant

List reads sane and the dedicated sort test below guards drift. Good defensive move for prefix matching.


1257-1258: Verify @container as a utility token

@container is an at-rule in CSS. As a Tailwind “utility” token it’s unusual. If this is intended for query variants, fine—otherwise it risks false positives.

Would you confirm intended usage in the parser? If needed, I can cross-check against current Tailwind docs and adjust the list.

crates/biome_tailwind_syntax/src/lib.rs (1)

5-5: Expose metadata module — LGTM

Clean and minimal. Consider adding a brief rustdoc on the module in metadata.rs (you’ve mostly done that) so consumers understand its purpose.

crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/base-has-dash-1.txt (1)

1-1: Good coverage for dashed base + bracketed value

This exercises the tricky path nicely.

crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/base-has-dash-2.txt (1)

1-1: Covers border-spacing-y with custom value

Solid addition to catch regressions on dashed basenames.

crates/biome_tailwind_parser/tests/tailwind_specs/ok/simple/base-has-dash-0.txt (1)

1-1: Happy path for drop-shadow-red-500

Keeps the lexer honest on dashed basenames with named tokens.

crates/biome_tailwind_parser/tests/tailwind_specs/ok/brackets/gradient.txt (2)

1-1: Test case looks good

Captures a realistic dashed-base + bracketed value scenario.


2-2: No stray “2” – gradient.txt is a valid one-line spec
The file only contains a single line:

bg-radial-[at_50%_75%] from-sky-200 via-blue-400 to-indigo-900 to-90%

There is no second line or stray token. All OK specs are one-liners, so no change is needed.

Likely an incorrect or invalid review comment.

crates/biome_tailwind_parser/src/lexer/mod.rs (1)

9-9: Import looks fine

Directly pulling in the metadata constant is clear and localises the change.

@dyc3 dyc3 force-pushed the tailwind-dashed-bases branch from 9925207 to e41cc72 Compare August 9, 2025 21:56
@dyc3 dyc3 merged commit c1af91d into main Aug 9, 2025
30 checks passed
@dyc3 dyc3 deleted the tailwind-dashed-bases branch August 9, 2025 23:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Parser Area: parser

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载