-
-
Notifications
You must be signed in to change notification settings - Fork 810
refactor(core): document services #8327
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
|
CodSpeed Performance ReportMerging #8327 will not alter performanceComparing Summary
Footnotes
|
Parser conformance results onjs/262
jsx/babel
symbols/microsoft
ts/babel
ts/microsoft
|
WalkthroughThis PR adds a service-driven CSS analysis flow: a new public Possibly related PRs
Suggested labels
Suggested reviewers
Pre-merge checks and finishing touches✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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
🧹 Nitpick comments (2)
crates/biome_css_semantic/src/semantic_model/builder.rs (1)
122-126: Consider documenting theexpect()invariant.The
expect("To be a root node")relies onself.rootalways being a valid root. SinceSemanticModelBuilder::newaccepts aCssRoot, this invariant should hold. However, a brief doc comment on the struct or method explaining this assumption would help future maintainers.crates/biome_service/src/file_handlers/css.rs (1)
714-726: Consider hoistingcss_servicesconstruction outside the loop.
css_servicesis recreated on each iteration, but neithersemantic_modelnorfile_sourcechanges between iterations. While cloning anArcis cheap, moving the construction before theloopwould be slightly cleaner.+ let css_services = CssAnalyzerServices { + semantic_model: params + .document_services + .as_css_services() + .and_then(|services| services.semantic_model.clone()), + file_source, + }; + loop { - let css_services = CssAnalyzerServices { - semantic_model: params - .document_services - .as_css_services() - .and_then(|services| services.semantic_model.clone()), - file_source, - }; - let (action, _) = analyze( &tree, filter, &analyzer_options, - css_services, + css_services.clone(), ¶ms.plugins, |signal| process_fix_all.process_signal(signal), );This requires
CssAnalyzerServicesto deriveClone, which it likely already does given theArcandCopyfields.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
Cargo.lockis excluded by!**/*.lockand included by**
📒 Files selected for processing (23)
crates/biome_css_analyze/benches/css_analyzer.rs(2 hunks)crates/biome_css_analyze/src/lib.rs(11 hunks)crates/biome_css_analyze/src/lint/correctness/no_missing_var_function.rs(3 hunks)crates/biome_css_analyze/src/lint/style/no_descending_specificity.rs(4 hunks)crates/biome_css_analyze/src/lint/suspicious/no_duplicate_custom_properties.rs(1 hunks)crates/biome_css_analyze/src/lint/suspicious/no_duplicate_properties.rs(1 hunks)crates/biome_css_analyze/src/services/semantic.rs(4 hunks)crates/biome_css_analyze/tests/quick_test.rs(3 hunks)crates/biome_css_analyze/tests/spec_tests.rs(3 hunks)crates/biome_css_semantic/src/format_semantic_model.rs(2 hunks)crates/biome_css_semantic/src/semantic_model/builder.rs(10 hunks)crates/biome_css_semantic/src/semantic_model/model.rs(8 hunks)crates/biome_service/src/file_handlers/css.rs(7 hunks)crates/biome_service/src/file_handlers/graphql.rs(1 hunks)crates/biome_service/src/file_handlers/html.rs(6 hunks)crates/biome_service/src/file_handlers/javascript.rs(2 hunks)crates/biome_service/src/file_handlers/json.rs(1 hunks)crates/biome_service/src/file_handlers/mod.rs(5 hunks)crates/biome_service/src/workspace.rs(2 hunks)crates/biome_service/src/workspace/document.rs(6 hunks)crates/biome_service/src/workspace/server.rs(22 hunks)xtask/rules_check/Cargo.toml(1 hunks)xtask/rules_check/src/lib.rs(3 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
**/*.rs
📄 CodeRabbit inference engine (CONTRIBUTING.md)
**/*.rs: Use thedbg!()macro for debugging output during testing, and pass the--show-outputflag tocargoto view debug output
Usecargo torcargo testto run tests; for a single test, pass the test name after thetestcommand
Use snapshot testing with theinstacrate; runcargo insta accept,cargo insta reject, orcargo insta reviewto manage snapshot changes
Write doctests as doc comments with code blocks; the code inside code blocks will be run during the testing phase
Usejust f(alias forjust format) to format Rust and TOML files before committing
Files:
crates/biome_service/src/file_handlers/graphql.rscrates/biome_css_analyze/src/lint/correctness/no_missing_var_function.rscrates/biome_css_analyze/src/lint/suspicious/no_duplicate_custom_properties.rsxtask/rules_check/src/lib.rscrates/biome_service/src/file_handlers/json.rscrates/biome_service/src/workspace.rscrates/biome_css_analyze/src/lint/style/no_descending_specificity.rscrates/biome_css_analyze/benches/css_analyzer.rscrates/biome_css_analyze/src/lib.rscrates/biome_service/src/file_handlers/css.rscrates/biome_css_analyze/tests/spec_tests.rscrates/biome_service/src/file_handlers/javascript.rscrates/biome_service/src/file_handlers/mod.rscrates/biome_css_analyze/tests/quick_test.rscrates/biome_service/src/file_handlers/html.rscrates/biome_css_semantic/src/format_semantic_model.rscrates/biome_service/src/workspace/document.rscrates/biome_css_analyze/src/services/semantic.rscrates/biome_css_semantic/src/semantic_model/builder.rscrates/biome_service/src/workspace/server.rscrates/biome_css_analyze/src/lint/suspicious/no_duplicate_properties.rscrates/biome_css_semantic/src/semantic_model/model.rs
**/*.toml
📄 CodeRabbit inference engine (CONTRIBUTING.md)
Use
just f(alias forjust format) to format TOML files before committing
Files:
xtask/rules_check/Cargo.toml
crates/biome_service/src/workspace*.rs
📄 CodeRabbit inference engine (crates/biome_service/CONTRIBUTING.md)
Implement the Workspace trait in the Biome Service to manage internal state of projects, including open documents, project layout instances, and module graph instances
Files:
crates/biome_service/src/workspace.rs
crates/biome_service/src/workspace/server.rs
📄 CodeRabbit inference engine (crates/biome_service/CONTRIBUTING.md)
Use WorkspaceServer implementation for maintaining workspace state in daemon mode and CLI daemonless mode
Files:
crates/biome_service/src/workspace/server.rs
🧠 Learnings (69)
📓 Common learnings
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_service/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:12.048Z
Learning: Applies to crates/biome_service/src/workspace*.rs : Implement the Workspace trait in the Biome Service to manage internal state of projects, including open documents, project layout instances, and module graph instances
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use `Semantic<T>` query type instead of `Ast<T>` when a rule needs to access the semantic model for binding references and scope information
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : When using multiple services in a rule, use `ctx.get_service::<ServiceType>()` to retrieve services running in the second phase when query runs during that phase
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Code actions must specify a `fix_kind` field in the `declare_lint_rule!` macro as either `FixKind::Safe` or `FixKind::Unsafe` to indicate whether fixes always preserve program behavior
Applied to files:
crates/biome_service/src/file_handlers/graphql.rscrates/biome_service/src/file_handlers/json.rscrates/biome_service/src/file_handlers/css.rscrates/biome_css_analyze/tests/spec_tests.rscrates/biome_service/src/file_handlers/javascript.rscrates/biome_service/src/file_handlers/mod.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Check if a variable is global before banning it to avoid false positives when the variable is redeclared in local scope; use the semantic model to verify global scope
Applied to files:
crates/biome_css_analyze/src/lint/correctness/no_missing_var_function.rscrates/biome_css_analyze/src/lint/suspicious/no_duplicate_custom_properties.rsxtask/rules_check/src/lib.rscrates/biome_css_analyze/benches/css_analyzer.rscrates/biome_css_analyze/src/lib.rscrates/biome_css_analyze/tests/spec_tests.rscrates/biome_css_analyze/tests/quick_test.rscrates/biome_css_analyze/src/services/semantic.rscrates/biome_css_semantic/src/semantic_model/builder.rscrates/biome_css_analyze/src/lint/suspicious/no_duplicate_properties.rscrates/biome_css_semantic/src/semantic_model/model.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noUndeclared` prefix for rules that report undefined entities (e.g., `noUndeclaredVariables`)
Applied to files:
crates/biome_css_analyze/src/lint/correctness/no_missing_var_function.rscrates/biome_css_analyze/src/lint/suspicious/no_duplicate_custom_properties.rscrates/biome_css_analyze/src/lint/style/no_descending_specificity.rscrates/biome_css_analyze/benches/css_analyzer.rscrates/biome_css_semantic/src/semantic_model/builder.rscrates/biome_css_analyze/src/lint/suspicious/no_duplicate_properties.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use `Semantic<T>` query type instead of `Ast<T>` when a rule needs to access the semantic model for binding references and scope information
Applied to files:
crates/biome_css_analyze/src/lint/correctness/no_missing_var_function.rscrates/biome_css_analyze/src/lint/suspicious/no_duplicate_custom_properties.rsxtask/rules_check/src/lib.rsxtask/rules_check/Cargo.tomlcrates/biome_css_analyze/benches/css_analyzer.rscrates/biome_css_analyze/src/lib.rscrates/biome_service/src/file_handlers/css.rscrates/biome_css_analyze/tests/spec_tests.rscrates/biome_service/src/file_handlers/mod.rscrates/biome_css_analyze/tests/quick_test.rscrates/biome_service/src/file_handlers/html.rscrates/biome_css_semantic/src/format_semantic_model.rscrates/biome_css_analyze/src/services/semantic.rscrates/biome_css_semantic/src/semantic_model/builder.rscrates/biome_css_analyze/src/lint/suspicious/no_duplicate_properties.rscrates/biome_css_semantic/src/semantic_model/model.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noRedundant` prefix for rules that report redundant code (e.g., `noRedundantUseStrict`)
Applied to files:
crates/biome_css_analyze/src/lint/correctness/no_missing_var_function.rscrates/biome_css_analyze/src/lint/suspicious/no_duplicate_custom_properties.rscrates/biome_css_analyze/src/lint/style/no_descending_specificity.rscrates/biome_css_analyze/src/lint/suspicious/no_duplicate_properties.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : When navigating CST nodes that return `Result`, use the try operator `?` to convert to `Option`, or use `let else` pattern for `Vec` return types in rule run functions
Applied to files:
crates/biome_css_analyze/src/lint/correctness/no_missing_var_function.rscrates/biome_css_analyze/src/lib.rscrates/biome_css_analyze/tests/spec_tests.rscrates/biome_css_analyze/tests/quick_test.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noUnused` prefix for rules that report unused entities (e.g., `noUnusedVariables`)
Applied to files:
crates/biome_css_analyze/src/lint/correctness/no_missing_var_function.rscrates/biome_css_analyze/src/lint/suspicious/no_duplicate_custom_properties.rscrates/biome_css_analyze/src/lint/suspicious/no_duplicate_properties.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noEmpty` prefix for rules that report empty code (e.g., `noEmptyBlockStatements`)
Applied to files:
crates/biome_css_analyze/src/lint/correctness/no_missing_var_function.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noConstant` prefix for rules that report computations always evaluated to the same value (e.g., `noConstantMathMinMaxClamp`)
Applied to files:
crates/biome_css_analyze/src/lint/correctness/no_missing_var_function.rscrates/biome_css_analyze/src/lint/style/no_descending_specificity.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `useConsistent` prefix for rules that ensure consistency across the codebase (e.g., `useConsistentArrayType`)
Applied to files:
crates/biome_css_analyze/src/lint/correctness/no_missing_var_function.rsxtask/rules_check/src/lib.rscrates/biome_css_analyze/benches/css_analyzer.rscrates/biome_service/src/file_handlers/css.rscrates/biome_css_analyze/tests/spec_tests.rscrates/biome_css_analyze/tests/quick_test.rscrates/biome_css_analyze/src/lint/suspicious/no_duplicate_properties.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noUnknown` prefix for rules that report mistyped entities in CSS (e.g., `noUnknownUnit`)
Applied to files:
crates/biome_css_analyze/src/lint/correctness/no_missing_var_function.rscrates/biome_css_analyze/src/lint/suspicious/no_duplicate_custom_properties.rsxtask/rules_check/src/lib.rsxtask/rules_check/Cargo.tomlcrates/biome_css_analyze/src/lint/style/no_descending_specificity.rscrates/biome_css_analyze/benches/css_analyzer.rscrates/biome_css_analyze/src/lib.rscrates/biome_service/src/file_handlers/css.rscrates/biome_css_analyze/tests/spec_tests.rscrates/biome_css_analyze/tests/quick_test.rscrates/biome_service/src/file_handlers/html.rscrates/biome_css_semantic/src/format_semantic_model.rscrates/biome_css_semantic/src/semantic_model/builder.rscrates/biome_css_analyze/src/lint/suspicious/no_duplicate_properties.rscrates/biome_css_semantic/src/semantic_model/model.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noDuplicate` prefix for rules that report duplication overriding previous occurrences (e.g., `noDuplicateObjectKeys`)
Applied to files:
crates/biome_css_analyze/src/lint/suspicious/no_duplicate_custom_properties.rscrates/biome_css_analyze/src/lint/style/no_descending_specificity.rscrates/biome_css_analyze/src/lint/suspicious/no_duplicate_properties.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Implement custom `Queryable` types and `Visitor` traits for rules requiring deep AST inspection to avoid redundant traversal passes
Applied to files:
crates/biome_css_analyze/src/lint/suspicious/no_duplicate_custom_properties.rsxtask/rules_check/src/lib.rscrates/biome_css_analyze/benches/css_analyzer.rscrates/biome_css_analyze/src/lib.rscrates/biome_css_analyze/tests/spec_tests.rscrates/biome_css_analyze/tests/quick_test.rscrates/biome_service/src/file_handlers/html.rscrates/biome_css_analyze/src/services/semantic.rscrates/biome_css_semantic/src/semantic_model/builder.rscrates/biome_service/src/workspace/server.rscrates/biome_css_semantic/src/semantic_model/model.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noRestricted` prefix for rules that report user-banned entities (e.g., `noRestrictedGlobals`)
Applied to files:
crates/biome_css_analyze/src/lint/suspicious/no_duplicate_custom_properties.rscrates/biome_css_analyze/src/lint/style/no_descending_specificity.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : For rules ported from other ecosystems like ESLint or Clippy, add a `sources` field with `RuleSource` metadata using `.same()` for identical behavior or `.inspired()` for different behavior
Applied to files:
crates/biome_css_analyze/src/lint/suspicious/no_duplicate_custom_properties.rsxtask/rules_check/src/lib.rsxtask/rules_check/Cargo.tomlcrates/biome_css_analyze/benches/css_analyzer.rscrates/biome_css_analyze/src/lib.rscrates/biome_service/src/file_handlers/css.rscrates/biome_css_analyze/tests/spec_tests.rscrates/biome_css_analyze/tests/quick_test.rscrates/biome_service/src/file_handlers/html.rscrates/biome_css_semantic/src/format_semantic_model.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : The `run` function of a lint rule should return `Option<Self::State>` or an iterable like `Vec<Self::State>` or `Box<[Self::State]>` to signal zero or more diagnostics
Applied to files:
crates/biome_css_analyze/src/lint/suspicious/no_duplicate_custom_properties.rscrates/biome_service/src/file_handlers/css.rscrates/biome_service/src/file_handlers/mod.rscrates/biome_css_analyze/tests/quick_test.rscrates/biome_css_analyze/src/lint/suspicious/no_duplicate_properties.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Lint rules must be implemented using the `Rule` trait with type parameters: `Query` (node type to analyze), `State` (information for signals), `Signals` (return type from run function), and `Options` (rule configuration)
Applied to files:
xtask/rules_check/src/lib.rscrates/biome_css_analyze/src/lib.rscrates/biome_service/src/file_handlers/css.rscrates/biome_css_analyze/tests/quick_test.rscrates/biome_css_analyze/src/services/semantic.rscrates/biome_css_semantic/src/semantic_model/builder.rscrates/biome_css_semantic/src/semantic_model/model.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Set rule severity to `error` for correctness/security/a11y rules, `warn` for suspicious/performance rules, `info` for style/complexity rules, and `info` for actions
Applied to files:
xtask/rules_check/src/lib.rscrates/biome_css_analyze/benches/css_analyzer.rscrates/biome_css_analyze/src/lib.rscrates/biome_service/src/file_handlers/css.rscrates/biome_css_analyze/tests/spec_tests.rscrates/biome_service/src/file_handlers/mod.rscrates/biome_css_analyze/tests/quick_test.rscrates/biome_service/src/file_handlers/html.rscrates/biome_css_semantic/src/format_semantic_model.rscrates/biome_css_semantic/src/semantic_model/builder.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Framework-specific rules should be named using the `use` or `no` prefix followed by the framework name (e.g., `noVueReservedProps`)
Applied to files:
xtask/rules_check/src/lib.rscrates/biome_css_analyze/benches/css_analyzer.rscrates/biome_css_analyze/src/lib.rscrates/biome_service/src/file_handlers/css.rscrates/biome_css_analyze/tests/spec_tests.rscrates/biome_css_analyze/tests/quick_test.rscrates/biome_service/src/file_handlers/html.rscrates/biome_css_analyze/src/lint/suspicious/no_duplicate_properties.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use language tags in documentation code blocks (js, ts, tsx, json, css) and order properties consistently as: language, then `expect_diagnostic`, then options modifiers, then `ignore`, then `file=path`
Applied to files:
xtask/rules_check/src/lib.rscrates/biome_service/src/file_handlers/json.rscrates/biome_css_analyze/src/lib.rscrates/biome_service/src/file_handlers/css.rscrates/biome_css_analyze/tests/spec_tests.rscrates/biome_service/src/file_handlers/javascript.rscrates/biome_css_analyze/tests/quick_test.rscrates/biome_service/src/file_handlers/html.rscrates/biome_service/src/workspace/document.rs
📚 Learning: 2025-11-28T09:08:10.077Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-11-28T09:08:10.077Z
Learning: Applies to Cargo.toml : Use workspace dependencies in the root Cargo.toml; internal crates should use `workspace = true` for dependencies and path dependencies for dev-dependencies
Applied to files:
xtask/rules_check/Cargo.tomlcrates/biome_service/src/workspace.rs
📚 Learning: 2025-11-24T18:06:12.048Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_service/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:12.048Z
Learning: Applies to crates/biome_service/src/workspace*.rs : Implement the Workspace trait in the Biome Service to manage internal state of projects, including open documents, project layout instances, and module graph instances
Applied to files:
xtask/rules_check/Cargo.tomlcrates/biome_service/src/file_handlers/json.rscrates/biome_service/src/workspace.rscrates/biome_service/src/file_handlers/javascript.rscrates/biome_service/src/file_handlers/mod.rscrates/biome_service/src/file_handlers/html.rscrates/biome_service/src/workspace/document.rscrates/biome_service/src/workspace/server.rs
📚 Learning: 2025-11-24T18:05:20.371Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:20.371Z
Learning: Applies to crates/biome_formatter/**/biome_*_formatter/Cargo.toml : Include development dependencies in `Cargo.toml` for formatter tests: `biome_formatter_test`, `biome_<language>_factory`, `biome_<language>_parser`, `biome_parser`, `biome_service`, `countme`, `iai`, `quickcheck`, `quickcheck_macros`, and `tests_macros`
Applied to files:
xtask/rules_check/Cargo.toml
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/nursery/**/*.rs : New rules must be placed inside the `nursery` group as an incubation space exempt from semantic versioning, with promotion to appropriate groups done during minor/major releases
Applied to files:
xtask/rules_check/Cargo.tomlcrates/biome_css_analyze/tests/spec_tests.rscrates/biome_css_semantic/src/format_semantic_model.rscrates/biome_css_semantic/src/semantic_model/model.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Commit rule changes with message format: `feat(biome_<crate>): <ruleName>` to follow Biome's conventional commit style
Applied to files:
xtask/rules_check/Cargo.toml
📚 Learning: 2025-11-24T18:06:12.048Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_service/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:12.048Z
Learning: Applies to crates/biome_service/src/workspace/watcher.tests.rs : Implement watcher tests for workspace methods in watcher.tests.rs and end-to-end tests in LSP tests
Applied to files:
xtask/rules_check/Cargo.tomlcrates/biome_service/src/workspace.rscrates/biome_service/src/file_handlers/mod.rscrates/biome_css_analyze/tests/quick_test.rscrates/biome_service/src/file_handlers/html.rscrates/biome_service/src/workspace/server.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/src/**/*.rs : Wrap optional rule option fields in `Option<_>` to properly track set vs unset options during configuration merging
Applied to files:
xtask/rules_check/Cargo.tomlcrates/biome_service/src/file_handlers/json.rscrates/biome_service/src/workspace.rscrates/biome_css_analyze/benches/css_analyzer.rscrates/biome_service/src/file_handlers/javascript.rscrates/biome_service/src/file_handlers/mod.rscrates/biome_service/src/file_handlers/html.rscrates/biome_css_semantic/src/format_semantic_model.rscrates/biome_css_semantic/src/semantic_model/builder.rs
📚 Learning: 2025-11-24T18:06:12.048Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_service/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:12.048Z
Learning: Debug the WorkspaceWatcher by starting the daemon with cargo run --bin=biome -- start and running commands such as cargo run --bin=biome -- lint --use-server <path>
Applied to files:
xtask/rules_check/Cargo.toml
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/src/**/*.rs : Rule options struct fields should use `#[serde(rename_all = "camelCase")]`, `#[serde(deny_unknown_fields)]`, and `#[serde(default)]` attributes for proper JSON serialization
Applied to files:
crates/biome_service/src/file_handlers/json.rscrates/biome_service/src/file_handlers/javascript.rscrates/biome_css_semantic/src/format_semantic_model.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Document rules with a one-line brief description in the first paragraph of the doc comment, followed by detailed paragraphs, `## Examples` section with `### Invalid` and `### Valid` subsections, and optional `## Options` section
Applied to files:
crates/biome_service/src/file_handlers/json.rs
📚 Learning: 2025-11-24T18:06:12.048Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_service/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:12.048Z
Learning: Applies to crates/biome_service/src/workspace/server.rs : Use WorkspaceServer implementation for maintaining workspace state in daemon mode and CLI daemonless mode
Applied to files:
crates/biome_service/src/workspace.rs
📚 Learning: 2025-11-24T18:05:42.356Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.356Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : Use `TypeReference` instead of `Arc` for types that reference other types to avoid stale cache issues when modules are replaced
Applied to files:
crates/biome_service/src/workspace.rscrates/biome_service/src/file_handlers/javascript.rscrates/biome_css_analyze/src/services/semantic.rscrates/biome_css_semantic/src/semantic_model/builder.rscrates/biome_css_semantic/src/semantic_model/model.rs
📚 Learning: 2025-11-24T18:06:12.048Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_service/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:12.048Z
Learning: Applies to crates/biome_service/src/workspace/client.rs : Use WorkspaceClient implementation for creating connections to the daemon and communicating with WorkspaceServer
Applied to files:
crates/biome_service/src/workspace.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noUnsafe` prefix for rules that report code leading to runtime failures (e.g., `noUnsafeOptionalChaining`)
Applied to files:
crates/biome_css_analyze/src/lint/style/no_descending_specificity.rscrates/biome_css_analyze/src/lint/suspicious/no_duplicate_properties.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noExcessive` prefix for rules that report code exceeding configurable limits (e.g., `noExcessiveNestedTestSuites`)
Applied to files:
crates/biome_css_analyze/src/lint/style/no_descending_specificity.rscrates/biome_css_analyze/src/lib.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Deprecate rules by adding a `deprecated` field to the `declare_lint_rule!` macro with a message explaining the reason for deprecation (e.g., 'Use the rule noAnotherVar')
Applied to files:
crates/biome_css_analyze/src/lint/style/no_descending_specificity.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noUseless` prefix for rules that report unnecessary code that could be removed or simplified (e.g., `noUselessConstructor`)
Applied to files:
crates/biome_css_analyze/src/lint/style/no_descending_specificity.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Avoid unnecessary string allocations by comparing against `&str` or `TokenText` instead of calling `to_string()` which allocates heap memory
Applied to files:
crates/biome_css_analyze/benches/css_analyzer.rscrates/biome_css_analyze/tests/quick_test.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use `rule_category!()` macro instead of dynamic string parsing to refer to rule diagnostic categories for compile-time validation
Applied to files:
crates/biome_css_analyze/benches/css_analyzer.rscrates/biome_css_analyze/src/lib.rscrates/biome_css_analyze/tests/spec_tests.rscrates/biome_css_analyze/tests/quick_test.rscrates/biome_css_semantic/src/format_semantic_model.rscrates/biome_css_semantic/src/semantic_model/builder.rs
📚 Learning: 2025-11-24T18:06:03.545Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:03.545Z
Learning: Applies to crates/biome_parser/**/src/**/*.rs : A parser struct must implement the `Parser` trait and save the token source, parser context, and optional parser options
Applied to files:
crates/biome_css_analyze/benches/css_analyzer.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Use quick testing via `tests/quick_test.rs` by removing the `#[ignore]` macro and modifying the `SOURCE` variable to rapidly validate rule behavior during development
Applied to files:
crates/biome_css_analyze/benches/css_analyzer.rscrates/biome_css_analyze/src/lib.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/src/**/*.rs : Rule options must be defined in the `biome_rule_options` crate and implement traits: `Deserializable`, `Merge`, `Serialize`, `Deserialize`, and `JsonSchema`
Applied to files:
crates/biome_css_analyze/benches/css_analyzer.rscrates/biome_css_semantic/src/format_semantic_model.rscrates/biome_css_semantic/src/semantic_model/model.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : When using multiple services in a rule, use `ctx.get_service::<ServiceType>()` to retrieve services running in the second phase when query runs during that phase
Applied to files:
crates/biome_css_analyze/src/lib.rscrates/biome_service/src/file_handlers/css.rscrates/biome_css_analyze/src/services/semantic.rscrates/biome_service/src/workspace/server.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : The `action` function must return a `JsRuleAction` (or equivalent language-specific action type) with category `ctx.action_category(ctx.category(), ctx.group())` and applicability from `ctx.metadata().applicability()`
Applied to files:
crates/biome_css_analyze/src/lib.rscrates/biome_service/src/file_handlers/css.rscrates/biome_css_analyze/tests/spec_tests.rscrates/biome_service/src/file_handlers/html.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Rules should use the `use` prefix naming convention when the sole intention is to mandate a single concept (e.g., `useValidLang` to enforce valid HTML lang attribute values)
Applied to files:
crates/biome_css_analyze/src/lib.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Avoid using `unwrap()` or `expect()` on `Result` and `Option` types; instead use helper functions like `map`, `filter`, `and_then` to maintain code clarity and avoid panics
Applied to files:
crates/biome_css_analyze/src/lib.rscrates/biome_service/src/file_handlers/mod.rscrates/biome_css_analyze/tests/quick_test.rscrates/biome_css_analyze/src/lint/suspicious/no_duplicate_properties.rs
📚 Learning: 2025-11-24T18:05:27.810Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:27.810Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : Import the `FormatNode` trait and implement it for your Node when creating formatters in biome_js_formatter
Applied to files:
crates/biome_service/src/file_handlers/css.rscrates/biome_css_semantic/src/format_semantic_model.rscrates/biome_service/src/workspace/document.rscrates/biome_css_semantic/src/semantic_model/builder.rs
📚 Learning: 2025-11-24T18:05:20.371Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:20.371Z
Learning: Applies to crates/biome_formatter/**/biome_*_formatter/src/lib.rs : Expose a public `format_node` function that accepts formatting options and a root syntax node, returning a `FormatResult<Formatted<Context>>` with appropriate documentation
Applied to files:
crates/biome_service/src/file_handlers/css.rscrates/biome_css_semantic/src/format_semantic_model.rscrates/biome_service/src/workspace/document.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : The `diagnostic` function must return a `RuleDiagnostic` that defines the message reported to the user using the `markup!` macro
Applied to files:
crates/biome_service/src/file_handlers/css.rscrates/biome_service/src/file_handlers/mod.rscrates/biome_css_analyze/tests/quick_test.rs
📚 Learning: 2025-11-24T18:05:27.810Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:27.810Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : Do not attempt to 'fix' the code; if a token/node is known to be mandatory but is missing, return `None` instead
Applied to files:
crates/biome_service/src/file_handlers/javascript.rscrates/biome_service/src/workspace/document.rs
📚 Learning: 2025-11-24T18:04:57.309Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_diagnostics/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:57.309Z
Learning: Applies to crates/biome_diagnostics/**/*.rs : Use helper types from the biome_diagnostics::v2 module (CodeFrameAdvice, CommandAdvice, DiffAdvice, LogAdvice) or implement the Advices trait yourself for custom advice handling
Applied to files:
crates/biome_service/src/file_handlers/javascript.rs
📚 Learning: 2025-11-28T09:08:10.077Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-11-28T09:08:10.077Z
Learning: Internal crate changes that don't affect user-facing behavior do not require changesets; changesets are only for user-facing changes
Applied to files:
crates/biome_service/src/file_handlers/javascript.rs
📚 Learning: 2025-11-24T18:05:42.356Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.356Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : Store type data in linear vectors instead of using recursive data structures with `Arc` for improved data locality and performance
Applied to files:
crates/biome_service/src/file_handlers/javascript.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : In rule documentation code blocks, mark invalid examples with the `expect_diagnostic` property and valid examples without it; each invalid example must emit exactly one diagnostic
Applied to files:
crates/biome_css_analyze/tests/quick_test.rs
📚 Learning: 2025-11-24T18:05:27.810Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:27.810Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : When formatting AST nodes, use mandatory tokens from the AST instead of hardcoding token strings (e.g., use `node.l_paren_token().format()` instead of `token("(")`)
Applied to files:
crates/biome_css_semantic/src/format_semantic_model.rscrates/biome_css_semantic/src/semantic_model/builder.rs
📚 Learning: 2025-11-24T18:05:20.371Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:20.371Z
Learning: Define `FormatHtmlSyntaxNode` struct in a `cst.rs` file implementing `FormatRule<HtmlSyntaxNode>`, `AsFormat<HtmlFormatContext>`, and `IntoFormat<HtmlFormatContext>` traits using the provided boilerplate code
Applied to files:
crates/biome_css_semantic/src/format_semantic_model.rscrates/biome_service/src/workspace/document.rscrates/biome_css_semantic/src/semantic_model/builder.rscrates/biome_css_semantic/src/semantic_model/model.rs
📚 Learning: 2025-11-24T18:05:20.371Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:20.371Z
Learning: Applies to crates/biome_formatter/**/biome_*_formatter/src/context.rs : Define `<Language>FormatContext` struct in a `context.rs` file containing `comments` and `source_map` fields, implementing `FormatContext` and `CstFormatContext` traits
Applied to files:
crates/biome_css_semantic/src/format_semantic_model.rscrates/biome_service/src/workspace/document.rs
📚 Learning: 2025-11-24T18:06:03.545Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:03.545Z
Learning: Applies to crates/biome_parser/**/src/**/*.rs : Parse rule functions must be prefixed with `parse_` and use the name defined in the grammar file, e.g., `parse_for_statement` or `parse_expression`
Applied to files:
crates/biome_css_semantic/src/format_semantic_model.rs
📚 Learning: 2025-11-24T18:05:20.371Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:20.371Z
Learning: Implement the `FormatNodeRule<N>` trait with `fmt_fields` as the only required method; default implementations of `fmt`, `is_suppressed`, `fmt_leading_comments`, `fmt_dangling_comments`, and `fmt_trailing_comments` are provided
Applied to files:
crates/biome_css_semantic/src/format_semantic_model.rs
📚 Learning: 2025-11-24T18:05:27.810Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:27.810Z
Learning: The formatter foundation relies on using the generic `Format` trait and `FormatNode` for nodes, with creation of an intermediate IR via a series of helpers
Applied to files:
crates/biome_css_semantic/src/format_semantic_model.rs
📚 Learning: 2025-11-24T18:05:20.371Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:20.371Z
Learning: Applies to crates/biome_formatter/**/biome_*_formatter/src/lib.rs : Define a type alias `<Language>Formatter<'buf>` as `Formatter<'buf, <Language>FormatContext>` in the main formatter crate
Applied to files:
crates/biome_service/src/workspace/document.rs
📚 Learning: 2025-11-24T18:05:20.371Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:20.371Z
Learning: Applies to crates/biome_formatter/**/biome_*_formatter/tests/language.rs : Implement `TestFormatLanguage` trait in `tests/language.rs` for the formatter's test language
Applied to files:
crates/biome_service/src/workspace/document.rs
📚 Learning: 2025-11-24T18:06:03.545Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:03.545Z
Learning: Applies to crates/biome_parser/**/src/**/*.rs : Use `ConditionalParsedSyntax` for syntax that is only valid in specific contexts (e.g., strict mode, file types, language versions) and call `or_invalid_to_bogus()` to convert to a bogus node if not supported
Applied to files:
crates/biome_service/src/workspace/document.rscrates/biome_css_semantic/src/semantic_model/builder.rs
📚 Learning: 2025-11-24T18:05:20.371Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:20.371Z
Learning: Applies to crates/biome_formatter/**/biome_*_formatter/src/comments.rs : Define `<Language>CommentStyle` as a public type alias for `Comments<<Language>Language>` in a `comments.rs` file
Applied to files:
crates/biome_service/src/workspace/document.rs
📚 Learning: 2025-11-24T18:06:03.545Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:03.545Z
Learning: Applies to crates/biome_parser/**/src/**/*.rs : Parse rules must take a mutable reference to the parser as their only parameter and return a `ParsedSyntax`
Applied to files:
crates/biome_css_semantic/src/semantic_model/builder.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/src/**/*.rs : Use `Box<[T]>` instead of `Vec<T>` for rule options array fields to save memory (boxed slices and boxed str use 2 words instead of three words)
Applied to files:
crates/biome_css_semantic/src/semantic_model/builder.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/src/**/*.rs : Implement the `Merge` trait for rule options to define how options from extended configuration merge with user configuration (usually reset instead of extend)
Applied to files:
crates/biome_css_semantic/src/semantic_model/builder.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `declare_node_union!` macro to query multiple node types at once by joining them into an enum with `Any*Like` naming convention
Applied to files:
crates/biome_css_semantic/src/semantic_model/model.rs
🧬 Code graph analysis (12)
crates/biome_css_analyze/src/lint/correctness/no_missing_var_function.rs (1)
crates/biome_css_semantic/src/semantic_model/model.rs (2)
root(34-36)root(35-35)
crates/biome_css_analyze/src/lint/suspicious/no_duplicate_custom_properties.rs (1)
crates/biome_css_semantic/src/semantic_model/model.rs (5)
root(34-36)root(35-35)node(143-145)node(227-229)declaration(310-312)
xtask/rules_check/src/lib.rs (2)
crates/biome_css_analyze/src/lib.rs (1)
analyze(58-79)crates/biome_css_semantic/src/semantic_model/model.rs (2)
root(34-36)root(35-35)
crates/biome_css_analyze/src/lint/style/no_descending_specificity.rs (2)
crates/biome_css_semantic/src/semantic_model/model.rs (4)
root(34-36)root(35-35)new(27-32)new(385-389)crates/biome_css_semantic/src/semantic_model/builder.rs (1)
new(29-40)
crates/biome_css_analyze/benches/css_analyzer.rs (1)
crates/biome_css_analyze/src/lib.rs (1)
analyze(58-79)
crates/biome_css_analyze/src/lib.rs (3)
crates/biome_css_analyze/src/services/semantic.rs (1)
model(15-17)crates/biome_css_semantic/src/semantic_model/model.rs (5)
root(34-36)root(35-35)new(27-32)new(385-389)text(231-233)crates/biome_css_syntax/src/file_source.rs (1)
css(35-39)
crates/biome_service/src/file_handlers/css.rs (1)
crates/biome_css_analyze/src/lib.rs (1)
analyze(58-79)
crates/biome_css_analyze/tests/spec_tests.rs (2)
crates/biome_css_semantic/src/semantic_model/model.rs (4)
root(34-36)root(35-35)from(345-347)from(351-353)crates/biome_css_analyze/src/lib.rs (1)
analyze(58-79)
crates/biome_css_semantic/src/format_semantic_model.rs (1)
crates/biome_css_semantic/src/semantic_model/model.rs (8)
selectors(154-156)root(34-36)root(35-35)range(147-152)range(235-240)text(231-233)specificity(170-172)specificity(242-244)
crates/biome_css_analyze/src/services/semantic.rs (2)
crates/biome_css_semantic/src/semantic_model/builder.rs (1)
new(29-40)crates/biome_css_semantic/src/semantic_model/model.rs (2)
new(27-32)new(385-389)
crates/biome_css_semantic/src/semantic_model/builder.rs (1)
crates/biome_css_semantic/src/semantic_model/model.rs (5)
new(27-32)new(385-389)node(143-145)node(227-229)property(314-316)
crates/biome_css_analyze/src/lint/suspicious/no_duplicate_properties.rs (1)
crates/biome_css_semantic/src/semantic_model/model.rs (5)
root(34-36)root(35-35)node(143-145)node(227-229)declaration(310-312)
⏰ 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: Bench (biome_tailwind_parser)
- GitHub Check: Parser conformance
- GitHub Check: End-to-end tests
- GitHub Check: Test (depot-windows-2022-16)
- GitHub Check: Documentation
- GitHub Check: Test (depot-ubuntu-24.04-arm-16)
- GitHub Check: Lint project (depot-ubuntu-24.04-arm-16)
- GitHub Check: Lint project (depot-windows-2022)
- GitHub Check: Check Dependencies
- GitHub Check: Bench (biome_module_graph)
- GitHub Check: Bench (biome_configuration)
- GitHub Check: Bench (biome_js_parser)
- GitHub Check: Bench (biome_package)
- GitHub Check: Bench (biome_js_formatter)
- GitHub Check: Bench (biome_js_analyze)
- GitHub Check: Bench (biome_graphql_formatter)
- 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: Bench (biome_css_analyze)
- GitHub Check: Bench (biome_css_formatter)
- GitHub Check: Test Node.js API
- GitHub Check: autofix
5c447eb to
65bff06
Compare
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: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
crates/biome_service/src/file_handlers/json.rs (1)
558-586: Fix use-after-move ofparamsincode_actionsThe destructuring
let CodeActionsParams { .. } = params;moves fields out ofparams, so later reads ofparams.path,params.languageandparams.settingsare using a partially-moved value and will not compile.You already have the necessary locals (
path,language,workspace), so just use those instead ofparams.*.fn code_actions(params: CodeActionsParams) -> PullActionsResult { let CodeActionsParams { parse, range, - settings: workspace, - path, + settings: workspace, + path, module_graph: _, project_layout, language, @@ - let tree: JsonRoot = parse.tree(); - let analyzer_options = workspace.analyzer_options::<JsonLanguage>( - params.path, - ¶ms.language, - suppression_reason.as_deref(), - ); + let tree: JsonRoot = parse.tree(); + let analyzer_options = workspace.analyzer_options::<JsonLanguage>( + path, + &language, + suppression_reason.as_deref(), + ); @@ - let (enabled_rules, disabled_rules, analyzer_options) = - AnalyzerVisitorBuilder::new(params.settings, analyzer_options) + let (enabled_rules, disabled_rules, analyzer_options) = + AnalyzerVisitorBuilder::new(workspace, analyzer_options)
🧹 Nitpick comments (4)
xtask/rules_check/src/lib.rs (1)
16-16: CSS semantic services wiring forassert_lintlooks goodThe new CSS arm correctly builds a
SemanticModel, wraps it inCssAnalyzerServicestogether with theCssFileSource, and passes that intobiome_css_analyze::analyze, mirroring the JS/JSON flow.If you fancy a tiny clean-up later, you could reuse the existing
rootinstead of callingparse.tree()a second time when building the semantic model:- let parse = biome_css_parser::parse_css(code, parse_options); + let parse = biome_css_parser::parse_css(code, parse_options); @@ - } else { - let root = parse.tree(); + } else { + let root = parse.tree(); @@ - let semantic_model = biome_css_semantic::semantic_model(&parse.tree()); + let semantic_model = biome_css_semantic::semantic_model(&root);Also applies to: 393-421
crates/biome_service/src/file_handlers/css.rs (1)
714-726: Consider hoistingCssAnalyzerServicesconstruction outside the loop.Since
file_sourceis immutable anddocument_servicesdoes not change between iterations, reconstructingcss_serviceson each pass appears redundant. Unless the semantic model must reflect tree mutations (which doesn't seem to be the case here), you could create it once before the loop.+ let css_services = CssAnalyzerServices { + semantic_model: params + .document_services + .as_css_services() + .and_then(|services| services.semantic_model.clone()), + file_source, + }; + loop { - let css_services = CssAnalyzerServices { - semantic_model: params - .document_services - .as_css_services() - .and_then(|services| services.semantic_model.clone()), - file_source, - }; - let (action, _) = analyze( &tree, filter, &analyzer_options, - css_services, + css_services.clone(), ¶ms.plugins, |signal| process_fix_all.process_signal(signal), );crates/biome_css_analyze/src/lib.rs (2)
20-25: CssAnalyzerServices shape and defaultsThe
CssAnalyzerServicescontainer and tiny builder methods look sensible for threading file source + semantic model into the analyser. TheDefaultderive implicitly picks whateverCssFileSource::default()is; if there’s no “obvious” default, consider whether you actually wantDefaulthere or prefer forcing callers to setfile_sourceexplicitly.Also applies to: 34-53
179-265: Tests exercise both semantic and non‑semantic pathsThe updated tests constructing
CssAnalyzerServiceswithsemantic_model: Some(_)andNonecover both “semantic available” and “syntax‑only” analysis flows, which is exactly what this refactor needs. The boilerplate struct literals are clear enough; factoring a tiny helper to buildCssAnalyzerServicesfor tests would be purely a nicety.Also applies to: 286-309, 337-359, 384-407, 428-448
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
Cargo.lockis excluded by!**/*.lockand included by**
📒 Files selected for processing (23)
crates/biome_css_analyze/benches/css_analyzer.rs(2 hunks)crates/biome_css_analyze/src/lib.rs(11 hunks)crates/biome_css_analyze/src/lint/correctness/no_missing_var_function.rs(3 hunks)crates/biome_css_analyze/src/lint/style/no_descending_specificity.rs(4 hunks)crates/biome_css_analyze/src/lint/suspicious/no_duplicate_custom_properties.rs(1 hunks)crates/biome_css_analyze/src/lint/suspicious/no_duplicate_properties.rs(1 hunks)crates/biome_css_analyze/src/services/semantic.rs(4 hunks)crates/biome_css_analyze/tests/quick_test.rs(3 hunks)crates/biome_css_analyze/tests/spec_tests.rs(3 hunks)crates/biome_css_semantic/src/format_semantic_model.rs(2 hunks)crates/biome_css_semantic/src/semantic_model/builder.rs(10 hunks)crates/biome_css_semantic/src/semantic_model/model.rs(8 hunks)crates/biome_service/src/file_handlers/css.rs(7 hunks)crates/biome_service/src/file_handlers/graphql.rs(1 hunks)crates/biome_service/src/file_handlers/html.rs(6 hunks)crates/biome_service/src/file_handlers/javascript.rs(2 hunks)crates/biome_service/src/file_handlers/json.rs(1 hunks)crates/biome_service/src/file_handlers/mod.rs(5 hunks)crates/biome_service/src/workspace.rs(2 hunks)crates/biome_service/src/workspace/document.rs(6 hunks)crates/biome_service/src/workspace/server.rs(22 hunks)xtask/rules_check/Cargo.toml(1 hunks)xtask/rules_check/src/lib.rs(3 hunks)
🚧 Files skipped from review as they are similar to previous changes (5)
- crates/biome_service/src/file_handlers/javascript.rs
- crates/biome_service/src/file_handlers/graphql.rs
- crates/biome_css_analyze/src/lint/suspicious/no_duplicate_properties.rs
- crates/biome_css_analyze/src/lint/suspicious/no_duplicate_custom_properties.rs
- crates/biome_css_analyze/benches/css_analyzer.rs
🧰 Additional context used
📓 Path-based instructions (4)
**/*.rs
📄 CodeRabbit inference engine (CONTRIBUTING.md)
**/*.rs: Use thedbg!()macro for debugging output during testing, and pass the--show-outputflag tocargoto view debug output
Usecargo torcargo testto run tests; for a single test, pass the test name after thetestcommand
Use snapshot testing with theinstacrate; runcargo insta accept,cargo insta reject, orcargo insta reviewto manage snapshot changes
Write doctests as doc comments with code blocks; the code inside code blocks will be run during the testing phase
Usejust f(alias forjust format) to format Rust and TOML files before committing
Files:
xtask/rules_check/src/lib.rscrates/biome_css_analyze/src/lint/correctness/no_missing_var_function.rscrates/biome_css_analyze/src/lint/style/no_descending_specificity.rscrates/biome_css_analyze/tests/quick_test.rscrates/biome_service/src/file_handlers/css.rscrates/biome_service/src/file_handlers/mod.rscrates/biome_css_analyze/tests/spec_tests.rscrates/biome_css_semantic/src/format_semantic_model.rscrates/biome_css_semantic/src/semantic_model/builder.rscrates/biome_css_analyze/src/services/semantic.rscrates/biome_service/src/file_handlers/html.rscrates/biome_css_analyze/src/lib.rscrates/biome_service/src/workspace.rscrates/biome_service/src/workspace/document.rscrates/biome_service/src/workspace/server.rscrates/biome_service/src/file_handlers/json.rscrates/biome_css_semantic/src/semantic_model/model.rs
crates/biome_service/src/workspace*.rs
📄 CodeRabbit inference engine (crates/biome_service/CONTRIBUTING.md)
Implement the Workspace trait in the Biome Service to manage internal state of projects, including open documents, project layout instances, and module graph instances
Files:
crates/biome_service/src/workspace.rs
**/*.toml
📄 CodeRabbit inference engine (CONTRIBUTING.md)
Use
just f(alias forjust format) to format TOML files before committing
Files:
xtask/rules_check/Cargo.toml
crates/biome_service/src/workspace/server.rs
📄 CodeRabbit inference engine (crates/biome_service/CONTRIBUTING.md)
Use WorkspaceServer implementation for maintaining workspace state in daemon mode and CLI daemonless mode
Files:
crates/biome_service/src/workspace/server.rs
🧠 Learnings (62)
📓 Common learnings
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_service/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:12.048Z
Learning: Applies to crates/biome_service/src/workspace*.rs : Implement the Workspace trait in the Biome Service to manage internal state of projects, including open documents, project layout instances, and module graph instances
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use `Semantic<T>` query type instead of `Ast<T>` when a rule needs to access the semantic model for binding references and scope information
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : When using multiple services in a rule, use `ctx.get_service::<ServiceType>()` to retrieve services running in the second phase when query runs during that phase
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use `Semantic<T>` query type instead of `Ast<T>` when a rule needs to access the semantic model for binding references and scope information
Applied to files:
xtask/rules_check/src/lib.rscrates/biome_css_analyze/src/lint/style/no_descending_specificity.rscrates/biome_css_analyze/tests/quick_test.rscrates/biome_service/src/file_handlers/css.rscrates/biome_service/src/file_handlers/mod.rscrates/biome_css_analyze/tests/spec_tests.rscrates/biome_css_semantic/src/format_semantic_model.rscrates/biome_css_semantic/src/semantic_model/builder.rscrates/biome_css_analyze/src/services/semantic.rscrates/biome_service/src/file_handlers/html.rscrates/biome_css_analyze/src/lib.rsxtask/rules_check/Cargo.tomlcrates/biome_css_semantic/src/semantic_model/model.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : For rules ported from other ecosystems like ESLint or Clippy, add a `sources` field with `RuleSource` metadata using `.same()` for identical behavior or `.inspired()` for different behavior
Applied to files:
xtask/rules_check/src/lib.rscrates/biome_css_analyze/tests/quick_test.rscrates/biome_css_analyze/tests/spec_tests.rscrates/biome_service/src/file_handlers/html.rscrates/biome_css_analyze/src/lib.rsxtask/rules_check/Cargo.toml
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noUnknown` prefix for rules that report mistyped entities in CSS (e.g., `noUnknownUnit`)
Applied to files:
xtask/rules_check/src/lib.rscrates/biome_css_analyze/src/lint/correctness/no_missing_var_function.rscrates/biome_css_analyze/src/lint/style/no_descending_specificity.rscrates/biome_css_analyze/tests/quick_test.rscrates/biome_service/src/file_handlers/css.rscrates/biome_css_analyze/tests/spec_tests.rscrates/biome_css_semantic/src/format_semantic_model.rscrates/biome_css_semantic/src/semantic_model/builder.rscrates/biome_service/src/file_handlers/html.rscrates/biome_css_analyze/src/lib.rsxtask/rules_check/Cargo.tomlcrates/biome_css_semantic/src/semantic_model/model.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Check if a variable is global before banning it to avoid false positives when the variable is redeclared in local scope; use the semantic model to verify global scope
Applied to files:
xtask/rules_check/src/lib.rscrates/biome_css_analyze/src/lint/correctness/no_missing_var_function.rscrates/biome_css_analyze/src/lint/style/no_descending_specificity.rscrates/biome_css_analyze/tests/quick_test.rscrates/biome_service/src/file_handlers/css.rscrates/biome_css_analyze/tests/spec_tests.rscrates/biome_css_semantic/src/semantic_model/builder.rscrates/biome_css_analyze/src/services/semantic.rscrates/biome_css_analyze/src/lib.rsxtask/rules_check/Cargo.tomlcrates/biome_css_semantic/src/semantic_model/model.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Set rule severity to `error` for correctness/security/a11y rules, `warn` for suspicious/performance rules, `info` for style/complexity rules, and `info` for actions
Applied to files:
xtask/rules_check/src/lib.rscrates/biome_css_analyze/tests/quick_test.rscrates/biome_service/src/file_handlers/css.rscrates/biome_service/src/file_handlers/mod.rscrates/biome_css_analyze/tests/spec_tests.rscrates/biome_css_semantic/src/format_semantic_model.rscrates/biome_css_semantic/src/semantic_model/builder.rscrates/biome_service/src/file_handlers/html.rscrates/biome_css_analyze/src/lib.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Lint rules must be implemented using the `Rule` trait with type parameters: `Query` (node type to analyze), `State` (information for signals), `Signals` (return type from run function), and `Options` (rule configuration)
Applied to files:
xtask/rules_check/src/lib.rscrates/biome_css_analyze/tests/quick_test.rscrates/biome_service/src/file_handlers/css.rscrates/biome_css_semantic/src/semantic_model/builder.rscrates/biome_css_analyze/src/services/semantic.rscrates/biome_css_analyze/src/lib.rscrates/biome_css_semantic/src/semantic_model/model.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Implement custom `Queryable` types and `Visitor` traits for rules requiring deep AST inspection to avoid redundant traversal passes
Applied to files:
xtask/rules_check/src/lib.rscrates/biome_css_analyze/src/lint/style/no_descending_specificity.rscrates/biome_css_analyze/tests/quick_test.rscrates/biome_css_analyze/tests/spec_tests.rscrates/biome_css_semantic/src/format_semantic_model.rscrates/biome_css_semantic/src/semantic_model/builder.rscrates/biome_css_analyze/src/services/semantic.rscrates/biome_service/src/file_handlers/html.rscrates/biome_css_analyze/src/lib.rscrates/biome_service/src/workspace/server.rscrates/biome_css_semantic/src/semantic_model/model.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `useConsistent` prefix for rules that ensure consistency across the codebase (e.g., `useConsistentArrayType`)
Applied to files:
xtask/rules_check/src/lib.rscrates/biome_css_analyze/tests/quick_test.rscrates/biome_service/src/file_handlers/css.rscrates/biome_css_analyze/tests/spec_tests.rscrates/biome_css_semantic/src/semantic_model/model.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Framework-specific rules should be named using the `use` or `no` prefix followed by the framework name (e.g., `noVueReservedProps`)
Applied to files:
xtask/rules_check/src/lib.rscrates/biome_css_analyze/tests/quick_test.rscrates/biome_service/src/file_handlers/css.rscrates/biome_css_analyze/tests/spec_tests.rscrates/biome_service/src/file_handlers/html.rscrates/biome_css_analyze/src/lib.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use language tags in documentation code blocks (js, ts, tsx, json, css) and order properties consistently as: language, then `expect_diagnostic`, then options modifiers, then `ignore`, then `file=path`
Applied to files:
xtask/rules_check/src/lib.rscrates/biome_css_analyze/tests/quick_test.rscrates/biome_service/src/file_handlers/css.rscrates/biome_css_analyze/tests/spec_tests.rscrates/biome_service/src/file_handlers/html.rscrates/biome_css_analyze/src/lib.rscrates/biome_service/src/workspace/document.rscrates/biome_service/src/file_handlers/json.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noUndeclared` prefix for rules that report undefined entities (e.g., `noUndeclaredVariables`)
Applied to files:
crates/biome_css_analyze/src/lint/correctness/no_missing_var_function.rscrates/biome_css_analyze/src/lint/style/no_descending_specificity.rscrates/biome_css_semantic/src/semantic_model/builder.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noUnused` prefix for rules that report unused entities (e.g., `noUnusedVariables`)
Applied to files:
crates/biome_css_analyze/src/lint/correctness/no_missing_var_function.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noInvalid` prefix for rules that report runtime errors from mistyping (e.g., `noInvalidConstructorSuper`)
Applied to files:
crates/biome_css_analyze/src/lint/correctness/no_missing_var_function.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : When navigating CST nodes that return `Result`, use the try operator `?` to convert to `Option`, or use `let else` pattern for `Vec` return types in rule run functions
Applied to files:
crates/biome_css_analyze/src/lint/correctness/no_missing_var_function.rscrates/biome_css_analyze/tests/quick_test.rscrates/biome_css_analyze/tests/spec_tests.rscrates/biome_css_analyze/src/lib.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noEmpty` prefix for rules that report empty code (e.g., `noEmptyBlockStatements`)
Applied to files:
crates/biome_css_analyze/src/lint/correctness/no_missing_var_function.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noUnsafe` prefix for rules that report code leading to runtime failures (e.g., `noUnsafeOptionalChaining`)
Applied to files:
crates/biome_css_analyze/src/lint/correctness/no_missing_var_function.rscrates/biome_css_analyze/src/lint/style/no_descending_specificity.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noConstant` prefix for rules that report computations always evaluated to the same value (e.g., `noConstantMathMinMaxClamp`)
Applied to files:
crates/biome_css_analyze/src/lint/correctness/no_missing_var_function.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noRedundant` prefix for rules that report redundant code (e.g., `noRedundantUseStrict`)
Applied to files:
crates/biome_css_analyze/src/lint/correctness/no_missing_var_function.rscrates/biome_css_analyze/src/lint/style/no_descending_specificity.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noDuplicate` prefix for rules that report duplication overriding previous occurrences (e.g., `noDuplicateObjectKeys`)
Applied to files:
crates/biome_css_analyze/src/lint/style/no_descending_specificity.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noExcessive` prefix for rules that report code exceeding configurable limits (e.g., `noExcessiveNestedTestSuites`)
Applied to files:
crates/biome_css_analyze/src/lint/style/no_descending_specificity.rscrates/biome_css_analyze/src/lib.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noUseless` prefix for rules that report unnecessary code that could be removed or simplified (e.g., `noUselessConstructor`)
Applied to files:
crates/biome_css_analyze/src/lint/style/no_descending_specificity.rs
📚 Learning: 2025-11-24T18:06:12.048Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_service/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:12.048Z
Learning: Applies to crates/biome_service/src/workspace/watcher.tests.rs : Implement watcher tests for workspace methods in watcher.tests.rs and end-to-end tests in LSP tests
Applied to files:
crates/biome_css_analyze/tests/quick_test.rscrates/biome_service/src/file_handlers/mod.rscrates/biome_service/src/file_handlers/html.rscrates/biome_service/src/workspace.rsxtask/rules_check/Cargo.tomlcrates/biome_service/src/workspace/server.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : When using multiple services in a rule, use `ctx.get_service::<ServiceType>()` to retrieve services running in the second phase when query runs during that phase
Applied to files:
crates/biome_css_analyze/tests/quick_test.rscrates/biome_service/src/file_handlers/css.rscrates/biome_css_analyze/src/services/semantic.rscrates/biome_css_analyze/src/lib.rscrates/biome_service/src/workspace/server.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use `rule_category!()` macro instead of dynamic string parsing to refer to rule diagnostic categories for compile-time validation
Applied to files:
crates/biome_css_analyze/tests/quick_test.rscrates/biome_css_analyze/tests/spec_tests.rscrates/biome_css_semantic/src/format_semantic_model.rscrates/biome_css_semantic/src/semantic_model/builder.rscrates/biome_css_analyze/src/lib.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Avoid using `unwrap()` or `expect()` on `Result` and `Option` types; instead use helper functions like `map`, `filter`, `and_then` to maintain code clarity and avoid panics
Applied to files:
crates/biome_css_analyze/tests/quick_test.rscrates/biome_service/src/file_handlers/mod.rscrates/biome_css_analyze/src/lib.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : In rule documentation code blocks, mark invalid examples with the `expect_diagnostic` property and valid examples without it; each invalid example must emit exactly one diagnostic
Applied to files:
crates/biome_css_analyze/tests/quick_test.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : The `diagnostic` function must return a `RuleDiagnostic` that defines the message reported to the user using the `markup!` macro
Applied to files:
crates/biome_css_analyze/tests/quick_test.rscrates/biome_service/src/file_handlers/css.rscrates/biome_service/src/file_handlers/mod.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : The `run` function of a lint rule should return `Option<Self::State>` or an iterable like `Vec<Self::State>` or `Box<[Self::State]>` to signal zero or more diagnostics
Applied to files:
crates/biome_css_analyze/tests/quick_test.rscrates/biome_service/src/file_handlers/css.rscrates/biome_service/src/file_handlers/mod.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Code actions must specify a `fix_kind` field in the `declare_lint_rule!` macro as either `FixKind::Safe` or `FixKind::Unsafe` to indicate whether fixes always preserve program behavior
Applied to files:
crates/biome_service/src/file_handlers/css.rscrates/biome_service/src/file_handlers/mod.rscrates/biome_css_analyze/tests/spec_tests.rscrates/biome_service/src/file_handlers/json.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : The `action` function must return a `JsRuleAction` (or equivalent language-specific action type) with category `ctx.action_category(ctx.category(), ctx.group())` and applicability from `ctx.metadata().applicability()`
Applied to files:
crates/biome_service/src/file_handlers/css.rscrates/biome_css_analyze/tests/spec_tests.rscrates/biome_service/src/file_handlers/html.rscrates/biome_css_analyze/src/lib.rs
📚 Learning: 2025-11-24T18:05:27.810Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:27.810Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : Import the `FormatNode` trait and implement it for your Node when creating formatters in biome_js_formatter
Applied to files:
crates/biome_service/src/file_handlers/css.rscrates/biome_css_semantic/src/format_semantic_model.rscrates/biome_css_semantic/src/semantic_model/builder.rscrates/biome_service/src/workspace/document.rs
📚 Learning: 2025-11-24T18:05:20.371Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:20.371Z
Learning: Applies to crates/biome_formatter/**/biome_*_formatter/src/lib.rs : Expose a public `format_node` function that accepts formatting options and a root syntax node, returning a `FormatResult<Formatted<Context>>` with appropriate documentation
Applied to files:
crates/biome_service/src/file_handlers/css.rscrates/biome_css_semantic/src/format_semantic_model.rscrates/biome_service/src/workspace/document.rs
📚 Learning: 2025-11-24T18:06:12.048Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_service/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:12.048Z
Learning: Applies to crates/biome_service/src/workspace*.rs : Implement the Workspace trait in the Biome Service to manage internal state of projects, including open documents, project layout instances, and module graph instances
Applied to files:
crates/biome_service/src/file_handlers/mod.rscrates/biome_service/src/file_handlers/html.rscrates/biome_service/src/workspace.rsxtask/rules_check/Cargo.tomlcrates/biome_service/src/workspace/document.rscrates/biome_service/src/workspace/server.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/src/**/*.rs : Wrap optional rule option fields in `Option<_>` to properly track set vs unset options during configuration merging
Applied to files:
crates/biome_service/src/file_handlers/mod.rscrates/biome_css_semantic/src/format_semantic_model.rscrates/biome_css_semantic/src/semantic_model/builder.rscrates/biome_service/src/file_handlers/html.rs
📚 Learning: 2025-11-24T18:05:20.371Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:20.371Z
Learning: Define `FormatHtmlSyntaxNode` struct in a `cst.rs` file implementing `FormatRule<HtmlSyntaxNode>`, `AsFormat<HtmlFormatContext>`, and `IntoFormat<HtmlFormatContext>` traits using the provided boilerplate code
Applied to files:
crates/biome_css_semantic/src/format_semantic_model.rscrates/biome_css_semantic/src/semantic_model/builder.rscrates/biome_service/src/workspace/document.rscrates/biome_css_semantic/src/semantic_model/model.rs
📚 Learning: 2025-11-24T18:05:20.371Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:20.371Z
Learning: Applies to crates/biome_formatter/**/biome_*_formatter/src/context.rs : Define `<Language>FormatContext` struct in a `context.rs` file containing `comments` and `source_map` fields, implementing `FormatContext` and `CstFormatContext` traits
Applied to files:
crates/biome_css_semantic/src/format_semantic_model.rscrates/biome_service/src/workspace/document.rs
📚 Learning: 2025-11-24T18:05:27.810Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:27.810Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : When formatting AST nodes, use mandatory tokens from the AST instead of hardcoding token strings (e.g., use `node.l_paren_token().format()` instead of `token("(")`)
Applied to files:
crates/biome_css_semantic/src/format_semantic_model.rscrates/biome_css_semantic/src/semantic_model/builder.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/nursery/**/*.rs : New rules must be placed inside the `nursery` group as an incubation space exempt from semantic versioning, with promotion to appropriate groups done during minor/major releases
Applied to files:
crates/biome_css_semantic/src/format_semantic_model.rsxtask/rules_check/Cargo.tomlcrates/biome_css_semantic/src/semantic_model/model.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/src/**/*.rs : Rule options must be defined in the `biome_rule_options` crate and implement traits: `Deserializable`, `Merge`, `Serialize`, `Deserialize`, and `JsonSchema`
Applied to files:
crates/biome_css_semantic/src/format_semantic_model.rscrates/biome_css_semantic/src/semantic_model/model.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/src/**/*.rs : Rule options struct fields should use `#[serde(rename_all = "camelCase")]`, `#[serde(deny_unknown_fields)]`, and `#[serde(default)]` attributes for proper JSON serialization
Applied to files:
crates/biome_css_semantic/src/format_semantic_model.rscrates/biome_service/src/file_handlers/json.rs
📚 Learning: 2025-11-24T18:06:03.545Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:03.545Z
Learning: Applies to crates/biome_parser/**/src/**/*.rs : Parse rule functions must be prefixed with `parse_` and use the name defined in the grammar file, e.g., `parse_for_statement` or `parse_expression`
Applied to files:
crates/biome_css_semantic/src/format_semantic_model.rs
📚 Learning: 2025-11-24T18:05:20.371Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:20.371Z
Learning: Implement the `FormatNodeRule<N>` trait with `fmt_fields` as the only required method; default implementations of `fmt`, `is_suppressed`, `fmt_leading_comments`, `fmt_dangling_comments`, and `fmt_trailing_comments` are provided
Applied to files:
crates/biome_css_semantic/src/format_semantic_model.rs
📚 Learning: 2025-11-24T18:05:27.810Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:27.810Z
Learning: The formatter foundation relies on using the generic `Format` trait and `FormatNode` for nodes, with creation of an intermediate IR via a series of helpers
Applied to files:
crates/biome_css_semantic/src/format_semantic_model.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `useShorthand` prefix for rules that report syntax rewritable using equivalent compact syntax (e.g., `useShorthandAssign`)
Applied to files:
crates/biome_css_semantic/src/semantic_model/builder.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/src/**/*.rs : Use `Box<[T]>` instead of `Vec<T>` for rule options array fields to save memory (boxed slices and boxed str use 2 words instead of three words)
Applied to files:
crates/biome_css_semantic/src/semantic_model/builder.rs
📚 Learning: 2025-11-24T18:06:03.545Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:03.545Z
Learning: Applies to crates/biome_parser/**/src/**/*.rs : Use `ConditionalParsedSyntax` for syntax that is only valid in specific contexts (e.g., strict mode, file types, language versions) and call `or_invalid_to_bogus()` to convert to a bogus node if not supported
Applied to files:
crates/biome_css_semantic/src/semantic_model/builder.rscrates/biome_service/src/workspace/document.rs
📚 Learning: 2025-11-24T18:05:42.356Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.356Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : Use `TypeReference` instead of `Arc` for types that reference other types to avoid stale cache issues when modules are replaced
Applied to files:
crates/biome_css_semantic/src/semantic_model/builder.rscrates/biome_css_analyze/src/services/semantic.rscrates/biome_service/src/workspace.rscrates/biome_css_semantic/src/semantic_model/model.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/src/**/*.rs : Implement the `Merge` trait for rule options to define how options from extended configuration merge with user configuration (usually reset instead of extend)
Applied to files:
crates/biome_css_semantic/src/semantic_model/builder.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Rules should use the `use` prefix naming convention when the sole intention is to mandate a single concept (e.g., `useValidLang` to enforce valid HTML lang attribute values)
Applied to files:
crates/biome_css_analyze/src/lib.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Use quick testing via `tests/quick_test.rs` by removing the `#[ignore]` macro and modifying the `SOURCE` variable to rapidly validate rule behavior during development
Applied to files:
crates/biome_css_analyze/src/lib.rs
📚 Learning: 2025-11-28T09:08:10.077Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-11-28T09:08:10.077Z
Learning: Applies to Cargo.toml : Use workspace dependencies in the root Cargo.toml; internal crates should use `workspace = true` for dependencies and path dependencies for dev-dependencies
Applied to files:
crates/biome_service/src/workspace.rsxtask/rules_check/Cargo.toml
📚 Learning: 2025-11-24T18:06:12.048Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_service/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:12.048Z
Learning: Applies to crates/biome_service/src/workspace/server.rs : Use WorkspaceServer implementation for maintaining workspace state in daemon mode and CLI daemonless mode
Applied to files:
crates/biome_service/src/workspace.rs
📚 Learning: 2025-11-24T18:06:12.048Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_service/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:12.048Z
Learning: Applies to crates/biome_service/src/workspace/client.rs : Use WorkspaceClient implementation for creating connections to the daemon and communicating with WorkspaceServer
Applied to files:
crates/biome_service/src/workspace.rs
📚 Learning: 2025-11-24T18:05:20.371Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:20.371Z
Learning: Applies to crates/biome_formatter/**/biome_*_formatter/Cargo.toml : Include development dependencies in `Cargo.toml` for formatter tests: `biome_formatter_test`, `biome_<language>_factory`, `biome_<language>_parser`, `biome_parser`, `biome_service`, `countme`, `iai`, `quickcheck`, `quickcheck_macros`, and `tests_macros`
Applied to files:
xtask/rules_check/Cargo.toml
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Commit rule changes with message format: `feat(biome_<crate>): <ruleName>` to follow Biome's conventional commit style
Applied to files:
xtask/rules_check/Cargo.toml
📚 Learning: 2025-11-24T18:06:12.048Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_service/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:12.048Z
Learning: Debug the WorkspaceWatcher by starting the daemon with cargo run --bin=biome -- start and running commands such as cargo run --bin=biome -- lint --use-server <path>
Applied to files:
xtask/rules_check/Cargo.toml
📚 Learning: 2025-11-24T18:05:20.371Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:20.371Z
Learning: Applies to crates/biome_formatter/**/biome_*_formatter/src/lib.rs : Define a type alias `<Language>Formatter<'buf>` as `Formatter<'buf, <Language>FormatContext>` in the main formatter crate
Applied to files:
crates/biome_service/src/workspace/document.rs
📚 Learning: 2025-11-24T18:05:20.371Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:20.371Z
Learning: Applies to crates/biome_formatter/**/biome_*_formatter/tests/language.rs : Implement `TestFormatLanguage` trait in `tests/language.rs` for the formatter's test language
Applied to files:
crates/biome_service/src/workspace/document.rs
📚 Learning: 2025-11-24T18:05:20.371Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:20.371Z
Learning: Applies to crates/biome_formatter/**/biome_*_formatter/src/comments.rs : Define `<Language>CommentStyle` as a public type alias for `Comments<<Language>Language>` in a `comments.rs` file
Applied to files:
crates/biome_service/src/workspace/document.rs
📚 Learning: 2025-11-24T18:05:27.810Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:27.810Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : Do not attempt to 'fix' the code; if a token/node is known to be mandatory but is missing, return `None` instead
Applied to files:
crates/biome_service/src/workspace/document.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `declare_node_union!` macro to query multiple node types at once by joining them into an enum with `Any*Like` naming convention
Applied to files:
crates/biome_css_semantic/src/semantic_model/model.rs
🧬 Code graph analysis (11)
xtask/rules_check/src/lib.rs (2)
crates/biome_css_analyze/src/lib.rs (1)
analyze(58-79)crates/biome_css_semantic/src/semantic_model/model.rs (2)
root(34-36)root(35-35)
crates/biome_css_analyze/src/lint/correctness/no_missing_var_function.rs (1)
crates/biome_css_semantic/src/semantic_model/model.rs (2)
root(34-36)root(35-35)
crates/biome_css_analyze/src/lint/style/no_descending_specificity.rs (2)
crates/biome_css_semantic/src/semantic_model/model.rs (4)
root(34-36)root(35-35)new(27-32)new(385-389)crates/biome_css_semantic/src/semantic_model/builder.rs (1)
new(29-40)
crates/biome_css_analyze/tests/quick_test.rs (1)
crates/biome_css_analyze/src/lib.rs (1)
analyze(58-79)
crates/biome_service/src/file_handlers/css.rs (1)
crates/biome_css_analyze/src/lib.rs (1)
analyze(58-79)
crates/biome_css_analyze/tests/spec_tests.rs (3)
crates/biome_css_semantic/src/semantic_model/model.rs (4)
root(34-36)root(35-35)from(345-347)from(351-353)crates/biome_css_analyze/src/lib.rs (1)
analyze(58-79)crates/biome_test_utils/src/lib.rs (1)
code_fix_to_string(344-355)
crates/biome_css_semantic/src/format_semantic_model.rs (2)
crates/biome_css_semantic/src/semantic_model/mod.rs (5)
model(328-328)model(351-351)model(372-372)model(388-388)selector(218-225)crates/biome_css_semantic/src/semantic_model/model.rs (8)
selectors(154-156)root(34-36)root(35-35)range(147-152)range(235-240)text(231-233)specificity(170-172)specificity(242-244)
crates/biome_css_semantic/src/semantic_model/builder.rs (1)
crates/biome_css_semantic/src/semantic_model/model.rs (7)
new(27-32)new(385-389)node(143-145)node(227-229)property(314-316)value(318-320)value(328-335)
crates/biome_css_analyze/src/services/semantic.rs (2)
crates/biome_css_semantic/src/semantic_model/builder.rs (1)
new(29-40)crates/biome_css_semantic/src/semantic_model/model.rs (2)
new(27-32)new(385-389)
crates/biome_service/src/workspace/document.rs (2)
crates/biome_css_semantic/src/semantic_model/model.rs (4)
node(143-145)node(227-229)root(34-36)root(35-35)crates/biome_parser/src/lib.rs (5)
into_serde_diagnostics(738-743)into_serde_diagnostics(913-924)into_serde_diagnostics(958-969)root(884-886)root(950-952)
crates/biome_service/src/workspace/server.rs (2)
crates/biome_service/src/workspace/document.rs (4)
none(278-280)parse(88-94)parse(184-184)parse(189-196)crates/biome_service/src/file_handlers/mod.rs (1)
can_parse(373-385)
⏰ 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: Bench (biome_json_analyze)
- GitHub Check: Bench (biome_json_formatter)
- GitHub Check: Bench (biome_json_parser)
- GitHub Check: Bench (biome_configuration)
- GitHub Check: Test (depot-windows-2022-16)
- GitHub Check: Documentation
- GitHub Check: Test Node.js API
- GitHub Check: End-to-end tests
- GitHub Check: Check Dependencies
- GitHub Check: Test (depot-ubuntu-24.04-arm-16)
- GitHub Check: Lint project (depot-windows-2022)
- GitHub Check: Lint project (depot-ubuntu-24.04-arm-16)
- GitHub Check: autofix
- GitHub Check: Bench (biome_graphql_parser)
- GitHub Check: Bench (biome_graphql_formatter)
- GitHub Check: Parser conformance
- GitHub Check: Bench (biome_tailwind_parser)
- GitHub Check: Bench (biome_module_graph)
- GitHub Check: Bench (biome_css_analyze)
- GitHub Check: Bench (biome_js_parser)
- GitHub Check: Bench (biome_css_formatter)
- GitHub Check: Bench (biome_js_analyze)
- GitHub Check: Bench (biome_css_parser)
- GitHub Check: Bench (biome_js_formatter)
- GitHub Check: Bench (biome_package)
arendjr
left a 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.
Phew, that's some heavy lifting! Left some questions, but looks good to me!
| root: &LanguageRoot<CssLanguage>, | ||
| filter: AnalysisFilter, | ||
| options: &'a AnalyzerOptions, | ||
| services: CssAnalyzerServices, |
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.
I think we may want to pass the services by reference instead of by value, so we can avoid a lot of cloning. Are there reasons why the analyser needs to mutate services, maybe? If so, we may want to resolve that in a separate PR, but I feel it would be a good idea to do before scaling up to other services.
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.
You're right, there's no reason to pass the service by value at the moment. We can pass references
| /// ``` | ||
| pub struct SemanticServices { | ||
| model: SemanticModel, | ||
| model: Arc<SemanticModel>, |
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.
Question: If we pass the services to the analyser by reference, do you think wrapping these in Arc is still necessary?
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.
Probably not!
| /// stored with [biome_rowan::AstPtr]. The service needs to accept the language root so | ||
| /// the pointer can be retrieved with its typed counter part. | ||
| #[derive(Clone, Debug)] | ||
| pub enum DocumentServices { |
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.
Not an immediate concern, but do you think we'll have services that are language-agnostic?
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.
Theoretically, we already could! For example we have the biome_aria that is used by two analyzer crates already. Are you onto something?
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.
Nah, I was just thinking whether an enum is appropriate to store the services longer term, but even if it requires a little duplication it’s fine.
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: 0
🧹 Nitpick comments (2)
crates/biome_service/src/file_handlers/css.rs (1)
713-727: Consider hoistingCssAnalyzerServicesconstruction outside the loop.
CssAnalyzerServicesis reconstructed on every iteration, butfile_sourceand the semantic model reference don't change between iterations. Moving this construction before the loop would avoid redundant work.+ let css_services = CssAnalyzerServices { + semantic_model: params + .document_services + .as_css_services() + .and_then(|services| services.semantic_model.as_ref()), + file_source, + }; + loop { - let css_services = CssAnalyzerServices { - semantic_model: params - .document_services - .as_css_services() - .and_then(|services| services.semantic_model.as_ref()), - file_source, - }; - let (action, _) = analyze( &tree, filter, &analyzer_options, - css_services, + css_services.clone(), ¶ms.plugins, |signal| process_fix_all.process_signal(signal), );crates/biome_css_analyze/src/lib.rs (1)
34-53: Add documentation for the new public API.
CssAnalyzerServicesis a new public type but lacks doc comments. Please document the struct and its methods to explain their purpose and usage, particularly noting whensemantic_modelshould be provided.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (7)
crates/biome_css_analyze/benches/css_analyzer.rs(2 hunks)crates/biome_css_analyze/src/lib.rs(11 hunks)crates/biome_css_analyze/src/services/semantic.rs(4 hunks)crates/biome_css_analyze/tests/quick_test.rs(3 hunks)crates/biome_css_analyze/tests/spec_tests.rs(3 hunks)crates/biome_service/src/file_handlers/css.rs(7 hunks)xtask/rules_check/src/lib.rs(3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- xtask/rules_check/src/lib.rs
🧰 Additional context used
📓 Path-based instructions (1)
**/*.rs
📄 CodeRabbit inference engine (CONTRIBUTING.md)
**/*.rs: Use thedbg!()macro for debugging output during testing, and pass the--show-outputflag tocargoto view debug output
Usecargo torcargo testto run tests; for a single test, pass the test name after thetestcommand
Use snapshot testing with theinstacrate; runcargo insta accept,cargo insta reject, orcargo insta reviewto manage snapshot changes
Write doctests as doc comments with code blocks; the code inside code blocks will be run during the testing phase
Usejust f(alias forjust format) to format Rust and TOML files before committing
Files:
crates/biome_css_analyze/tests/spec_tests.rscrates/biome_css_analyze/tests/quick_test.rscrates/biome_service/src/file_handlers/css.rscrates/biome_css_analyze/benches/css_analyzer.rscrates/biome_css_analyze/src/lib.rscrates/biome_css_analyze/src/services/semantic.rs
🧠 Learnings (32)
📓 Common learnings
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_service/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:12.048Z
Learning: Applies to crates/biome_service/src/workspace*.rs : Implement the Workspace trait in the Biome Service to manage internal state of projects, including open documents, project layout instances, and module graph instances
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use `Semantic<T>` query type instead of `Ast<T>` when a rule needs to access the semantic model for binding references and scope information
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : When using multiple services in a rule, use `ctx.get_service::<ServiceType>()` to retrieve services running in the second phase when query runs during that phase
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use `Semantic<T>` query type instead of `Ast<T>` when a rule needs to access the semantic model for binding references and scope information
Applied to files:
crates/biome_css_analyze/tests/spec_tests.rscrates/biome_css_analyze/tests/quick_test.rscrates/biome_service/src/file_handlers/css.rscrates/biome_css_analyze/benches/css_analyzer.rscrates/biome_css_analyze/src/lib.rscrates/biome_css_analyze/src/services/semantic.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use language tags in documentation code blocks (js, ts, tsx, json, css) and order properties consistently as: language, then `expect_diagnostic`, then options modifiers, then `ignore`, then `file=path`
Applied to files:
crates/biome_css_analyze/tests/spec_tests.rscrates/biome_css_analyze/tests/quick_test.rscrates/biome_service/src/file_handlers/css.rscrates/biome_css_analyze/src/lib.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noUnknown` prefix for rules that report mistyped entities in CSS (e.g., `noUnknownUnit`)
Applied to files:
crates/biome_css_analyze/tests/spec_tests.rscrates/biome_css_analyze/tests/quick_test.rscrates/biome_service/src/file_handlers/css.rscrates/biome_css_analyze/benches/css_analyzer.rscrates/biome_css_analyze/src/lib.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Check if a variable is global before banning it to avoid false positives when the variable is redeclared in local scope; use the semantic model to verify global scope
Applied to files:
crates/biome_css_analyze/tests/spec_tests.rscrates/biome_css_analyze/tests/quick_test.rscrates/biome_service/src/file_handlers/css.rscrates/biome_css_analyze/benches/css_analyzer.rscrates/biome_css_analyze/src/lib.rscrates/biome_css_analyze/src/services/semantic.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use `rule_category!()` macro instead of dynamic string parsing to refer to rule diagnostic categories for compile-time validation
Applied to files:
crates/biome_css_analyze/tests/spec_tests.rscrates/biome_css_analyze/tests/quick_test.rscrates/biome_css_analyze/benches/css_analyzer.rscrates/biome_css_analyze/src/lib.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Implement custom `Queryable` types and `Visitor` traits for rules requiring deep AST inspection to avoid redundant traversal passes
Applied to files:
crates/biome_css_analyze/tests/spec_tests.rscrates/biome_css_analyze/tests/quick_test.rscrates/biome_css_analyze/benches/css_analyzer.rscrates/biome_css_analyze/src/lib.rscrates/biome_css_analyze/src/services/semantic.rs
📚 Learning: 2025-11-24T18:04:57.309Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_diagnostics/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:57.309Z
Learning: Applies to crates/biome_diagnostics/**/*.rs : Use helper types from the biome_diagnostics::v2 module (CodeFrameAdvice, CommandAdvice, DiffAdvice, LogAdvice) or implement the Advices trait yourself for custom advice handling
Applied to files:
crates/biome_css_analyze/tests/spec_tests.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : In rule documentation code blocks, mark invalid examples with the `expect_diagnostic` property and valid examples without it; each invalid example must emit exactly one diagnostic
Applied to files:
crates/biome_css_analyze/tests/spec_tests.rscrates/biome_css_analyze/tests/quick_test.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Set rule severity to `error` for correctness/security/a11y rules, `warn` for suspicious/performance rules, `info` for style/complexity rules, and `info` for actions
Applied to files:
crates/biome_css_analyze/tests/spec_tests.rscrates/biome_css_analyze/tests/quick_test.rscrates/biome_service/src/file_handlers/css.rscrates/biome_css_analyze/src/lib.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noExcessive` prefix for rules that report code exceeding configurable limits (e.g., `noExcessiveNestedTestSuites`)
Applied to files:
crates/biome_css_analyze/tests/spec_tests.rscrates/biome_css_analyze/src/lib.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Framework-specific rules should be named using the `use` or `no` prefix followed by the framework name (e.g., `noVueReservedProps`)
Applied to files:
crates/biome_css_analyze/tests/spec_tests.rscrates/biome_css_analyze/tests/quick_test.rscrates/biome_service/src/file_handlers/css.rscrates/biome_css_analyze/src/lib.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `useConsistent` prefix for rules that ensure consistency across the codebase (e.g., `useConsistentArrayType`)
Applied to files:
crates/biome_css_analyze/tests/spec_tests.rscrates/biome_service/src/file_handlers/css.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : The `action` function must return a `JsRuleAction` (or equivalent language-specific action type) with category `ctx.action_category(ctx.category(), ctx.group())` and applicability from `ctx.metadata().applicability()`
Applied to files:
crates/biome_css_analyze/tests/spec_tests.rscrates/biome_service/src/file_handlers/css.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : When navigating CST nodes that return `Result`, use the try operator `?` to convert to `Option`, or use `let else` pattern for `Vec` return types in rule run functions
Applied to files:
crates/biome_css_analyze/tests/spec_tests.rscrates/biome_css_analyze/tests/quick_test.rscrates/biome_css_analyze/src/lib.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : For rules ported from other ecosystems like ESLint or Clippy, add a `sources` field with `RuleSource` metadata using `.same()` for identical behavior or `.inspired()` for different behavior
Applied to files:
crates/biome_css_analyze/tests/spec_tests.rscrates/biome_css_analyze/tests/quick_test.rscrates/biome_css_analyze/benches/css_analyzer.rscrates/biome_css_analyze/src/lib.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Code actions must specify a `fix_kind` field in the `declare_lint_rule!` macro as either `FixKind::Safe` or `FixKind::Unsafe` to indicate whether fixes always preserve program behavior
Applied to files:
crates/biome_css_analyze/tests/spec_tests.rscrates/biome_service/src/file_handlers/css.rs
📚 Learning: 2025-11-24T18:06:12.048Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_service/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:12.048Z
Learning: Applies to crates/biome_service/src/workspace/watcher.tests.rs : Implement watcher tests for workspace methods in watcher.tests.rs and end-to-end tests in LSP tests
Applied to files:
crates/biome_css_analyze/tests/quick_test.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : When using multiple services in a rule, use `ctx.get_service::<ServiceType>()` to retrieve services running in the second phase when query runs during that phase
Applied to files:
crates/biome_css_analyze/tests/quick_test.rscrates/biome_service/src/file_handlers/css.rscrates/biome_css_analyze/benches/css_analyzer.rscrates/biome_css_analyze/src/lib.rscrates/biome_css_analyze/src/services/semantic.rs
📚 Learning: 2025-11-24T18:05:20.371Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:20.371Z
Learning: Applies to crates/biome_formatter/**/biome_*_formatter/Cargo.toml : Include development dependencies in `Cargo.toml` for formatter tests: `biome_formatter_test`, `biome_<language>_factory`, `biome_<language>_parser`, `biome_parser`, `biome_service`, `countme`, `iai`, `quickcheck`, `quickcheck_macros`, and `tests_macros`
Applied to files:
crates/biome_css_analyze/tests/quick_test.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Avoid using `unwrap()` or `expect()` on `Result` and `Option` types; instead use helper functions like `map`, `filter`, `and_then` to maintain code clarity and avoid panics
Applied to files:
crates/biome_css_analyze/tests/quick_test.rscrates/biome_css_analyze/src/lib.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : The `diagnostic` function must return a `RuleDiagnostic` that defines the message reported to the user using the `markup!` macro
Applied to files:
crates/biome_css_analyze/tests/quick_test.rscrates/biome_service/src/file_handlers/css.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Lint rules must be implemented using the `Rule` trait with type parameters: `Query` (node type to analyze), `State` (information for signals), `Signals` (return type from run function), and `Options` (rule configuration)
Applied to files:
crates/biome_css_analyze/tests/quick_test.rscrates/biome_service/src/file_handlers/css.rscrates/biome_css_analyze/src/lib.rscrates/biome_css_analyze/src/services/semantic.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : The `run` function of a lint rule should return `Option<Self::State>` or an iterable like `Vec<Self::State>` or `Box<[Self::State]>` to signal zero or more diagnostics
Applied to files:
crates/biome_css_analyze/tests/quick_test.rscrates/biome_service/src/file_handlers/css.rs
📚 Learning: 2025-11-24T18:05:27.810Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:27.810Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : Import the `FormatNode` trait and implement it for your Node when creating formatters in biome_js_formatter
Applied to files:
crates/biome_service/src/file_handlers/css.rs
📚 Learning: 2025-11-24T18:05:20.371Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:20.371Z
Learning: Applies to crates/biome_formatter/**/biome_*_formatter/src/lib.rs : Expose a public `format_node` function that accepts formatting options and a root syntax node, returning a `FormatResult<Formatted<Context>>` with appropriate documentation
Applied to files:
crates/biome_service/src/file_handlers/css.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/src/**/*.rs : Wrap optional rule option fields in `Option<_>` to properly track set vs unset options during configuration merging
Applied to files:
crates/biome_css_analyze/benches/css_analyzer.rs
📚 Learning: 2025-11-24T18:06:03.545Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:03.545Z
Learning: Applies to crates/biome_parser/**/src/**/*.rs : A parser struct must implement the `Parser` trait and save the token source, parser context, and optional parser options
Applied to files:
crates/biome_css_analyze/benches/css_analyzer.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Use quick testing via `tests/quick_test.rs` by removing the `#[ignore]` macro and modifying the `SOURCE` variable to rapidly validate rule behavior during development
Applied to files:
crates/biome_css_analyze/benches/css_analyzer.rscrates/biome_css_analyze/src/lib.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/src/**/*.rs : Rule options must be defined in the `biome_rule_options` crate and implement traits: `Deserializable`, `Merge`, `Serialize`, `Deserialize`, and `JsonSchema`
Applied to files:
crates/biome_css_analyze/benches/css_analyzer.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Rules should use the `use` prefix naming convention when the sole intention is to mandate a single concept (e.g., `useValidLang` to enforce valid HTML lang attribute values)
Applied to files:
crates/biome_css_analyze/src/lib.rs
📚 Learning: 2025-11-24T18:05:20.371Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:20.371Z
Learning: Applies to crates/biome_formatter/**/biome_*_formatter/src/context.rs : Define `<Language>FormatContext` struct in a `context.rs` file containing `comments` and `source_map` fields, implementing `FormatContext` and `CstFormatContext` traits
Applied to files:
crates/biome_css_analyze/src/lib.rs
🧬 Code graph analysis (3)
crates/biome_css_analyze/tests/spec_tests.rs (2)
crates/biome_css_analyze/src/lib.rs (1)
analyze(58-79)crates/biome_test_utils/src/lib.rs (2)
diagnostic_to_string(270-275)code_fix_to_string(344-355)
crates/biome_css_analyze/tests/quick_test.rs (1)
crates/biome_css_analyze/src/lib.rs (1)
analyze(58-79)
crates/biome_css_analyze/src/lib.rs (2)
crates/biome_css_semantic/src/semantic_model/model.rs (2)
root(34-36)root(35-35)crates/biome_css_syntax/src/file_source.rs (1)
css(35-39)
⏰ 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: Bench (biome_module_graph)
- GitHub Check: Test Node.js API
- GitHub Check: Bench (biome_css_analyze)
- GitHub Check: Bench (biome_css_formatter)
- GitHub Check: Bench (biome_css_parser)
- GitHub Check: Documentation
- GitHub Check: End-to-end tests
- GitHub Check: Test (depot-windows-2022-16)
- GitHub Check: Test (depot-ubuntu-24.04-arm-16)
- GitHub Check: Bench (biome_configuration)
- GitHub Check: Lint project (depot-ubuntu-24.04-arm-16)
- GitHub Check: Check Dependencies
- GitHub Check: Lint project (depot-windows-2022)
- GitHub Check: autofix
- GitHub Check: Bench (biome_graphql_formatter)
- GitHub Check: Bench (biome_js_formatter)
- GitHub Check: Bench (biome_graphql_parser)
- GitHub Check: Bench (biome_js_analyze)
- GitHub Check: Bench (biome_js_parser)
- GitHub Check: Parser conformance
- GitHub Check: Bench (biome_tailwind_parser)
- GitHub Check: Bench (biome_json_parser)
- GitHub Check: Bench (biome_json_formatter)
- GitHub Check: Bench (biome_json_analyze)
- GitHub Check: Bench (biome_package)
🔇 Additional comments (12)
crates/biome_service/src/file_handlers/css.rs (4)
25-25: LGTM!Import of
CssAnalyzerServicesandanalyzealigns with the new service-driven analysis flow.
41-41: LGTM!Cleaned up unused tracing imports—tidy.
540-596: LGTM!The
lintfunction now correctly:
- Exits early when the language cannot yield a CSS file source
- Constructs
CssAnalyzerServiceswith the semantic model from document services- Passes services to
analyzeThe pattern of using
as_css_services().and_then(...)for optional semantic model access is appropriately defensive.
598-675: LGTM!The
code_actionsfunction now mirrors the lint flow with properCssAnalyzerServicesconstruction and passes it through to the analyzer. The mapping of analyzer signals toCodeActionentries is clear.crates/biome_css_analyze/benches/css_analyzer.rs (1)
60-69: LGTM!Semantic model is correctly computed once outside the benchmark loop, whilst
services.clone()inside the closure ensures each benchmark iteration gets a fresh clone. This is the right approach for accurate benchmarking.crates/biome_css_analyze/tests/quick_test.rs (1)
23-35: LGTM!Quick test correctly constructs
CssAnalyzerServicesusing the builder pattern and passes it toanalyze. This aligns with the updated API.crates/biome_css_analyze/tests/spec_tests.rs (2)
133-137: LGTM!The
analyze_and_snapfunction correctly constructs the semantic model andCssAnalyzerServicesusing the builder pattern with the appropriatesource_type.
137-187: LGTM!The callback logic properly handles both diagnostic-bearing signals and standalone actions, with appropriate separation of suppression vs. lint action paths. The control flow is clear and well-structured.
crates/biome_css_analyze/src/services/semantic.rs (3)
73-75: LGTM!The
build_visitorsimplification aligns with the new architecture where the semantic model is provided externally rather than built during analysis. OnlySyntaxVisitoris needed since the semantic model is pre-computed.
35-39: The Phase change fromPhases::SemantictoPhases::Syntaxis correct. The semantic model is now provided externally viaCssAnalyzerServicesand injected during analysis setup. Rules usingSemantic<N>(such asno_duplicate_properties,no_duplicate_custom_properties,no_missing_var_function, andno_descending_specificity) access the model through the service, not through phase sequencing. This design allows rules to run during the syntax phase while still having access to semantic information via dependency injection.
9-11: No changes needed. TheSemanticModelstill contains an internalArc<SemanticModelData>field and aGreenNode(which wrapsThinArc). CloningSemanticModelis already efficient because the heavy data is behindArc/ThinArcpointers. The current implementation is correct.Likely an incorrect or invalid review comment.
crates/biome_css_analyze/src/lib.rs (1)
62-62: This review comment is based on a misunderstanding of the design.
CssAnalyzerServicesis a lightweight struct that derivesCloneand contains only references (Option<&'a SemanticModel>) and a simple type (CssFileSource). Passing it by value is idiomatic Rust and incurs negligible overhead—cloning only increments reference counts. Similarly, at line 92,semantic_model.clone()clones a reference, which is cheap.The current design is correct and does not require changes.
Co-authored-by: arendjr <[email protected]>
Co-authored-by: arendjr <[email protected]>
Summary
This is an attempt to refactor how we use services inside Biome.
At the moment, the analyzer has the infrastructure that allows developers to create new services as they need. This is very useful, and services are created only when needed.
While this is neat, we're reaching a point (actually, we already did) where some services can't be isolated anymore. An example is the semantic model of the JavaScript files i.e. the
biome_js_semanticcrate. In fact, when we introduced the module graph and the type inference engine, we needed the JS semantic model, which led us to duplicate code (to avoid a major refactor).The reason why I decided to do this refactor is to solve two main problems:
noUnusedVariablesinside files like.vue,.astroand possibly.sveltetoo.This PR attempts to store some services in the
Workspaceand pass them down to the analyser.This PR moves the CSS semantic model into the
Workspace. I thought it was easier to start with a smaller, younger service, so we can then pass to other services.Having a service at the workspace level changes the whole architecture and how the APIs should be designed.
Make a service
SendandSyncThe main challenge of existing services is that they are designed with typed nodes in mind, i.e. any node that belongs so a specific language. Having these nodes makes those services not sharable across threads.
To make services thread-safe, we need to change how services are designed by using the following two solutions:
AstPtrWe added these new nodes a while back, when we started the work around embedded languages and snippets. These nodes were ported from
rust-analyzer/rowana while back, now we get to use them.This is an untyped node that:
That's how we "type" the nodes inside a workspace-level service:
The CSS semantic model was updated to use this type to make its nodes thread-safe. However, this requires that its public APIs be reviewed to retrieve its typed counterpart.
APIs must accept the root node
Based on the previous example, if we want to retrieve
CssString, we must useAstPtr::to_node, which needs&CssRoot.This works quite well because every time we use the semantic model, the root is available, so the changes were minimal and made within the lint rules.
Store services
Services are now stored in the
Documenttype, within an enum calledDocumentServices. LikeDocumentFileSource, it is organised by language.Document services are created the moment we open and store a file (notably,
open_fileandchange_file). This is probably a drawback of this new design, compared to what we have today.I tried to make services a
Option, so they are created when we most likely need them. For example, if linting or assist are disabled, we don't create them.However, this is a small price we need to pay to provide more powerful features, which are impossible at the moment.
Test Plan
This is an internal refactor, existing tests should pass.
Docs