+
Skip to content

Conversation

ematipico
Copy link
Member

Summary

Closes #6880

Now --skip and --only support domains too! They work the same as when you pass a group. However, we need to rely to some codegen because domains work across groups, so we need to codegen the filters generated by those domains.

Test Plan

Added new tests

Docs

Updated the relative CLI commands. Docs will be updated automatically upon release.

Copy link

changeset-bot bot commented Sep 4, 2025

🦋 Changeset detected

Latest commit: 41b6196

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 15 packages
Name Type
@biomejs/biome Minor
@biomejs/plugin-api Major
@biomejs/cli-win32-x64 Minor
@biomejs/cli-win32-arm64 Minor
@biomejs/cli-darwin-x64 Minor
@biomejs/cli-darwin-arm64 Minor
@biomejs/cli-linux-x64 Minor
@biomejs/cli-linux-arm64 Minor
@biomejs/cli-linux-x64-musl Minor
@biomejs/cli-linux-arm64-musl Minor
@biomejs/wasm-web Minor
@biomejs/wasm-bundler Minor
@biomejs/wasm-nodejs Minor
@biomejs/backend-jsonrpc Patch
@biomejs/js-api Major

Not sure what this means? Click here to learn what changesets are.

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

Copy link
Contributor

coderabbitai bot commented Sep 4, 2025

Walkthrough

Adds domain-aware selector support across CLI, configuration, service, LSP, workspace, visitors and codegen. Introduces AnalyzerSelector (union of RuleSelector and DomainSelector) and DomainSelector parsing/serde/schema support. CLI lint options --only/--skip now accept domain names. Codegen emits a generated per-domain RuleFilter module to back domain selectors. Multiple public APIs and call sites were migrated from rule-based selectors to the new selectors model and conversions were added.

Assessment against linked issues

Objective Addressed Explanation
Introduce CLI to skip domain rules, e.g. project (#6880)

Assessment against linked issues: Out-of-scope changes

Code Change Explanation
Large API/type migration to AnalyzerSelector across service/workspace/LSP/visitors (e.g. crates/biome_service/src/file_handlers/mod.rs, crates/biome_service/src/workspace.rs) This is a broad public/type surface migration beyond the single CLI-flag objective.
Codegen: generate domain_selector module (xtask/codegen/src/generate_configuration.rs → crates/biome_configuration/src/generated/domain_selector.rs) Adds build-time generation and per-domain artifacts that are not strictly required to accept a domain string on the CLI.
New public types DomainSelector and AnalyzerSelector (crates/biome_configuration/src/analyzer/mod.rs) Introduces new public abstractions, serde and schema surface that extend the API beyond the CLI argument request.

Suggested labels

A-Core, L-JavaScript, L-CSS

Suggested reviewers

  • arendjr
  • dyc3
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/skip-only-domains

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

‼️ IMPORTANT
Auto-reply has been disabled for this repository in the CodeRabbit settings. The CodeRabbit bot will not respond to your replies unless it is explicitly tagged.

  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

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

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

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

Status, Documentation and Community

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

@ematipico ematipico requested review from a team and vladimir-ivanov September 4, 2025 09:13
@github-actions github-actions bot added A-CLI Area: CLI A-Project Area: project A-Linter Area: linter A-Tooling Area: internal tools A-LSP Area: language server protocol labels Sep 4, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (4)
crates/biome_service/src/configuration.rs (1)

732-739: domains.project in config forces project scan even when --skip=project is set.

If the config enables the project domain, you set requires_project_scan = true before considering CLI selectors. That negates the main perf goal of “skip project domain rules”.

Gate this block with CLI selectors, e.g. only set the flag when:

  • --skip does not include the project domain, and
  • either --only is empty or it includes the project domain.

Happy to draft a follow‑up patch once the AnalyzerSelector domain variant shape is confirmed.

crates/biome_service/src/file_handlers/mod.rs (3)

1058-1080: Unreachable branch prevents disabling recommended domain rules.

Early-return on “no configured domains” makes the subsequent “if recommended and has domains and no configured domains => disable” block dead code. Remove the early return so recommended domain rules can be disabled when no domain is configured.

Apply this diff:

@@ fn record_rule_from_domains<R, L>(&mut self, rule_filter: RuleFilter<'static>)
-        // no domains, no need to record the rule
-        if domains.as_ref().is_none_or(|d| d.is_empty()) {
-            return;
-        }

1129-1141: Bug: default config never applied when only is None.

has_only_filter = self.only.is_none_or(|only| !only.is_empty()) evaluates to true for None, so config rules are skipped in the common case. Intended meaning is “only present and non-empty”.

Apply this diff:

-        let has_only_filter = self.only.is_none_or(|only| !only.is_empty());
+        let has_only_filter = self.only.is_some_and(|only| !only.is_empty());

Please mirror this logic anywhere the same predicate is used.


1366-1376: Same only predicate bug in assists.

Replicate the fix for assists so configured assists aren’t dropped when only is None.

Apply this diff:

-        let has_only_filter = self.only.is_none_or(|only| !only.is_empty());
+        let has_only_filter = self.only.is_some_and(|only| !only.is_empty());
🧹 Nitpick comments (20)
crates/biome_analyze/src/rule.rs (2)

517-529: DRY up: have Display delegate to as_str.

Avoid duplicating the string mapping in two places.

You can simplify the Display impl (lines 438–452) to:

impl Display for RuleDomain {
    fn fmt(&self, fmt: &mut Formatter) -> std::io::Result<()> {
        fmt.write_str(self.as_str())
    }
}

Also consider a tiny round‑trip test ensuring from_str(x).unwrap().as_str() == x for all domains.

Happy to draft the tests if useful.


531-547: Make parsing case-insensitive and trim input; unify error text.

This will reduce CLI foot‑guns (e.g. --only=React).

Apply:

 impl FromStr for RuleDomain {
     type Err = &'static str;

     fn from_str(s: &str) -> Result<Self, Self::Err> {
-        match s {
+        let s = s.trim().to_ascii_lowercase();
+        match s.as_str() {
             "react" => Ok(Self::React),
             "test" => Ok(Self::Test),
             "solid" => Ok(Self::Solid),
             "next" => Ok(Self::Next),
             "qwik" => Ok(Self::Qwik),
             "vue" => Ok(Self::Vue),
             "project" => Ok(Self::Project),
             "tailwind" => Ok(Self::Tailwind),
-
-            _ => Err("Invalid rule domain"),
+            _ => Err("This domain doesn't exist."),
         }
     }
 }

The error message now matches crates/biome_configuration/src/analyzer/mod.rs for consistency.

.changeset/wet-results-talk.md (1)

5-19: Polish the changeset: punctuation + link the issue.

Keeps to the project’s “end sentences with a period” rule and references the issue.

-For example, the following command will only run the rules that belong to the [next](https://biomejs.dev/linter/domains/#next) domain:
+For example, run the following command to only run rules in the [next](https://biomejs.dev/linter/domains/#next) domain.
 
 ```shell
 biome lint --only=next

-Another example, the following command will skip the rules that belong to the project domain:
+For example, run the following command to skip rules in the project domain.

biome lint --skip=project

+Closes #6880.


</blockquote></details>
<details>
<summary>crates/biome_cli/tests/cases/linter_domains.rs (1)</summary><blockquote>

`359-414`: **Strengthen the “enable via CLI” test by disabling the domain in config**

To prove `--only=test` truly enables the domain irrespective of config, set the domain to `"none"` in `biome.json`. That avoids the config already enabling it.


Apply this minimal diff to the embedded JSON:

```diff
-        "domains": {
-            "test": "all"
-        }
+        "domains": {
+            "test": "none"
+        }
crates/biome_service/src/file_handlers/css.rs (1)

519-526: Rename local var to ‘selectors’ for clarity (avoids confusion with rule lists).

The field is still named enabled_rules, but you’re now passing selectors. Renaming the local binding improves readability.

-        enabled_rules: rules,
+        enabled_rules: selectors,
...
-            .with_enabled_selectors(&rules)
+            .with_enabled_selectors(&selectors)

Also applies to: 578-586, 624-631

crates/biome_service/src/configuration.rs (1)

904-912: Nice coverage, but add a domain‑selector case.

Please add a test proving that --skip=project avoids project scans even when the project domain is enabled via config.

Proposed test to add under this module’s tests:

#[test]
fn should_not_scan_project_when_project_domain_is_skipped_via_cli() {
    let configuration = Configuration {
        linter: Some(LinterConfiguration {
            // Simulate config that would otherwise require project analysis
            domains: {
                let mut d = FxHashMap::default();
                d.insert(RuleDomain::Project, RuleDomainValue::Recommended);
                Some(RuleDomains(d))
            },
            ..Default::default()
        }),
        ..Default::default()
    };

    // Skip the entire project domain via CLI
    let scan = ProjectScanComputer::new(&configuration)
        .with_rule_selectors(
            // Any Domain(Project) selector here
            &[
                // Replace with the actual constructor once available, e.g.:
                // AnalyzerSelector::from(DomainSelector::Project)
            ],
            &[],
        )
        .compute();

    assert_ne!(scan, ScanKind::Project, "skip=project should prevent project scan");
}

Once AnalyzerSelector domain construction is confirmed, I can wire the exact selector.

Also applies to: 933-941

crates/biome_service/src/file_handlers/javascript.rs (1)

765-769: Same naming nit as CSS: prefer ‘selectors’ over ‘rules’.

Avoids mixing the old “rules” wording with the new selector API.

-        enabled_rules: rules,
+        enabled_rules: selectors,
...
-            .with_enabled_selectors(&rules)
+            .with_enabled_selectors(&selectors)

Also applies to: 776-783

crates/biome_service/src/file_handlers/json.rs (2)

576-576: Minor naming mismatch: rules are selectors here.

enabled_rules: rules is now passed to with_enabled_selectors. Consider renaming the binding to selectors for clarity.

-        enabled_rules: rules,
+        enabled_rules: selectors,
...
-            .with_enabled_selectors(&rules)
+            .with_enabled_selectors(&selectors)

625-625: Consistent terminology in fix-all.

Same nit as above: params.enabled_rules now carries selectors. Consider renaming the field or local binding when you touch the API next to avoid cognitive load.

crates/biome_service/src/file_handlers/graphql.rs (2)

487-487: Rename the local for readability.

enabled_rules: rules → used as selectors. Renaming to selectors improves intent.

-        enabled_rules: rules,
+        enabled_rules: selectors,
...
-            .with_enabled_selectors(&rules)
+            .with_enabled_selectors(&selectors)

533-533: Same terminology nit in fix-all.

params.enabled_rules now represents selectors; consider harmonising names across handlers when feasible.

xtask/codegen/src/generate_configuration.rs (5)

22-25: Great addition: domain → rules index.

Nice choice of BTreeMap/BTreeSet for stable, deterministic output. Note: the doc says (<group>/<rule>, ...) but the type is actually (group, rule); tweak wording for precision when you’re nearby.

-    /// e.g next => (<group>/<rule>, <group>/<rule>)
+    /// e.g. next => ((<group>, <rule>), (<group>, <rule>))

43-48: Domain collection is JS-only; intentional?

You populate domains in the JS visitor only. If non-JS languages ever tag rules with domains, we’ll miss them. Low-effort future-proofing would be to mirror this loop in the JSON/CSS/GraphQL visitors.

 impl RegistryVisitor<JsonLanguage> for LintRulesVisitor {
@@
     fn record_rule<R>(&mut self)
     where
         R: Rule<Options: Default, Query: Queryable<Language = JsonLanguage, Output: Clone>>
             + 'static,
     {
         self.groups
             .entry(<R::Group as RuleGroup>::NAME)
             .or_default()
             .insert(R::METADATA.name, R::METADATA);
+        for domain in R::METADATA.domains.iter() {
+            self.domains
+                .entry(domain.as_str())
+                .or_default()
+                .insert((<R::Group as RuleGroup>::NAME, R::METADATA.name));
+        }
     }
 }

1143-1149: Prefer static slices over LazyLock<Vec<...>> for zero-allocation access.

The generated contents are compile-time known. You can emit &'static [RuleFilter] and avoid the runtime LazyLock and later clone.

-        lazy_locks.push(quote! {
-            static #domain_filters: LazyLock<Vec<RuleFilter<'static>>> = LazyLock::new(|| {
-                vec![
-                    #( #vector ),*
-                ]
-            });
-        });
+        lazy_locks.push(quote! {
+            static #domain_filters: &[RuleFilter<'static>] = &[
+                #( #vector ),*
+            ];
+        });

And then adjust call sites accordingly:

-            #domain_as_string => #domain_filters.clone()
+            #domain_as_string => #domain_filters.to_vec()

1160-1176: Nit: error message mentions DomainFilter.

The type here is DomainSelector. Minor copy edit.

-                    _ => unreachable!(
-                        "DomainFilter::as_rule_filters: domain {} not found",
+                    _ => unreachable!(
+                        "DomainSelector::as_rule_filters: domain {} not found",
                         self.0
                     )

1178-1187: Consistency: unknown domain branch.

Here it returns false, above it panics. Consider aligning behaviours (both unreachable! or both graceful), depending on how DomainSelector is constructed. If it’s validated on construction, unreachable! is fine.

-                    _ => false,
+                    _ => unreachable!("DomainSelector::match_rule: domain {} not found", self.0),
crates/biome_service/src/workspace.rs (2)

921-927: Prefer “selectors” terminology (rules or domains) in docs and names.

Fields now accept domains, but still read “enabled_rules”. Consider renaming to enabled_selectors in the public API on the next breaking bump; at minimum, update the docstrings now to avoid confusion.

Apply docstring tweak:

--- a/crates/biome_service/src/workspace.rs
+++ b/crates/biome_service/src/workspace.rs
@@
-    /// Rules to apply on top of the configuration
+    /// Selectors (rules or domains) to apply on top of the configuration
@@
-    /// Rules to apply to the file
+    /// Selectors (rules or domains) to apply to the file

Also applies to: 949-956, 1022-1028


1637-1651: Expose enabled_selectors in FileGuard::pull_diagnostics.

You added enabled_rules to PullDiagnosticsParams but the FileGuard wrapper drops it. Mirror pull_actions and thread it through.

Apply this diff:

@@ pub fn pull_diagnostics(
-    pub fn pull_diagnostics(
+    pub fn pull_diagnostics(
         &self,
         categories: RuleCategories,
         only: Vec<AnalyzerSelector>,
         skip: Vec<AnalyzerSelector>,
+        enabled_rules: Vec<AnalyzerSelector>,
         pull_code_actions: bool,
     ) -> Result<PullDiagnosticsResult, WorkspaceError> {
         self.workspace.pull_diagnostics(PullDiagnosticsParams {
             project_key: self.project_key,
             path: self.path.clone(),
             categories,
             only,
             skip,
-            enabled_rules: vec![],
+            enabled_rules,
             pull_code_actions,
         })
     }
crates/biome_service/src/file_handlers/mod.rs (1)

1465-1486: Nit: parameter name mismatch.

with_enabled_selectors takes enabled_rules. Rename the argument for clarity.

Apply:

-    pub(crate) fn with_enabled_selectors(mut self, enabled_rules: &'b [AnalyzerSelector]) -> Self {
-        self.enabled_selectors = Some(enabled_rules);
+    pub(crate) fn with_enabled_selectors(mut self, enabled_selectors: &'b [AnalyzerSelector]) -> Self {
+        self.enabled_selectors = Some(enabled_selectors);
         self
     }
crates/biome_configuration/src/analyzer/mod.rs (1)

699-748: DomainSelector serde is fine; tiny micro-optimisation available.

You can avoid format! in serialisation.

Apply:

-        serializer.serialize_str(&format!("{self}"))
+        serializer.serialize_str(self.0)
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between ebbddc4 and 2b75e56.

⛔ Files ignored due to path filters (6)
  • crates/biome_cli/tests/snapshots/main_cases_linter_domains/should_disable_domain_via_cli.snap is excluded by !**/*.snap and included by **
  • crates/biome_cli/tests/snapshots/main_cases_linter_domains/should_enable_domain_via_cli.snap is excluded by !**/*.snap and included by **
  • crates/biome_cli/tests/snapshots/main_commands_lint/lint_help.snap is excluded by !**/*.snap and included by **
  • crates/biome_cli/tests/snapshots/main_commands_lint/lint_only_rule_doesnt_exist.snap is excluded by !**/*.snap and included by **
  • crates/biome_configuration/src/generated/domain_selector.rs is excluded by !**/generated/**, !**/generated/** and included by **
  • packages/@biomejs/backend-jsonrpc/src/workspace.ts is excluded by !**/backend-jsonrpc/src/workspace.ts and included by **
📒 Files selected for processing (21)
  • .changeset/wet-results-talk.md (1 hunks)
  • crates/biome_analyze/src/rule.rs (2 hunks)
  • crates/biome_cli/src/commands/lint.rs (2 hunks)
  • crates/biome_cli/src/commands/mod.rs (2 hunks)
  • crates/biome_cli/src/commands/scan_kind.rs (1 hunks)
  • crates/biome_cli/src/execute/mod.rs (2 hunks)
  • crates/biome_cli/tests/cases/linter_domains.rs (1 hunks)
  • crates/biome_configuration/src/analyzer/mod.rs (5 hunks)
  • crates/biome_configuration/src/generated.rs (1 hunks)
  • crates/biome_lsp/src/handlers/analysis.rs (2 hunks)
  • crates/biome_lsp/src/server.tests.rs (7 hunks)
  • crates/biome_service/src/configuration.rs (6 hunks)
  • crates/biome_service/src/file_handlers/css.rs (3 hunks)
  • crates/biome_service/src/file_handlers/graphql.rs (3 hunks)
  • crates/biome_service/src/file_handlers/javascript.rs (3 hunks)
  • crates/biome_service/src/file_handlers/json.rs (3 hunks)
  • crates/biome_service/src/file_handlers/mod.rs (13 hunks)
  • crates/biome_service/src/workspace.rs (7 hunks)
  • crates/biome_service/src/workspace.tests.rs (1 hunks)
  • crates/biome_service/src/workspace/server.rs (1 hunks)
  • xtask/codegen/src/generate_configuration.rs (4 hunks)
🧰 Additional context used
📓 Path-based instructions (8)
**/*.{rs,toml}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Format Rust and TOML files before committing (use just f/just format).

Files:

  • crates/biome_cli/src/commands/lint.rs
  • crates/biome_cli/src/commands/scan_kind.rs
  • crates/biome_configuration/src/generated.rs
  • crates/biome_analyze/src/rule.rs
  • crates/biome_lsp/src/server.tests.rs
  • crates/biome_cli/src/execute/mod.rs
  • crates/biome_service/src/file_handlers/css.rs
  • crates/biome_service/src/workspace.rs
  • xtask/codegen/src/generate_configuration.rs
  • crates/biome_service/src/workspace.tests.rs
  • crates/biome_cli/tests/cases/linter_domains.rs
  • crates/biome_service/src/file_handlers/javascript.rs
  • crates/biome_service/src/file_handlers/graphql.rs
  • crates/biome_service/src/configuration.rs
  • crates/biome_service/src/file_handlers/json.rs
  • crates/biome_cli/src/commands/mod.rs
  • crates/biome_service/src/workspace/server.rs
  • crates/biome_lsp/src/handlers/analysis.rs
  • crates/biome_configuration/src/analyzer/mod.rs
  • crates/biome_service/src/file_handlers/mod.rs
crates/biome_*/**

📄 CodeRabbit inference engine (CLAUDE.md)

Place core crates under /crates/biome_*/

Files:

  • crates/biome_cli/src/commands/lint.rs
  • crates/biome_cli/src/commands/scan_kind.rs
  • crates/biome_configuration/src/generated.rs
  • crates/biome_analyze/src/rule.rs
  • crates/biome_lsp/src/server.tests.rs
  • crates/biome_cli/src/execute/mod.rs
  • crates/biome_service/src/file_handlers/css.rs
  • crates/biome_service/src/workspace.rs
  • crates/biome_service/src/workspace.tests.rs
  • crates/biome_cli/tests/cases/linter_domains.rs
  • crates/biome_service/src/file_handlers/javascript.rs
  • crates/biome_service/src/file_handlers/graphql.rs
  • crates/biome_service/src/configuration.rs
  • crates/biome_service/src/file_handlers/json.rs
  • crates/biome_cli/src/commands/mod.rs
  • crates/biome_service/src/workspace/server.rs
  • crates/biome_lsp/src/handlers/analysis.rs
  • crates/biome_configuration/src/analyzer/mod.rs
  • crates/biome_service/src/file_handlers/mod.rs
crates/biome_configuration/src/**

📄 CodeRabbit inference engine (CLAUDE.md)

Keep configuration sources under biome_configuration/src/

Files:

  • crates/biome_configuration/src/generated.rs
  • crates/biome_configuration/src/analyzer/mod.rs
crates/biome_service/../biome_lsp/src/server.tests.rs

📄 CodeRabbit inference engine (crates/biome_service/CONTRIBUTING.md)

Keep end-to-end LSP tests in biome_lsp’s server.tests.rs

Files:

  • crates/biome_lsp/src/server.tests.rs
crates/biome_service/src/workspace.rs

📄 CodeRabbit inference engine (crates/biome_service/CONTRIBUTING.md)

Implement the Workspace trait in src/workspace.rs

Files:

  • crates/biome_service/src/workspace.rs
**/tests/**

📄 CodeRabbit inference engine (CLAUDE.md)

Place test files under a tests/ directory in each crate

Files:

  • crates/biome_cli/tests/cases/linter_domains.rs
crates/biome_service/src/workspace/server.rs

📄 CodeRabbit inference engine (crates/biome_service/CONTRIBUTING.md)

Use WorkspaceServer (src/workspace/server.rs) to maintain workspace state in daemon and CLI daemonless modes

Files:

  • crates/biome_service/src/workspace/server.rs
.changeset/*.md

📄 CodeRabbit inference engine (CONTRIBUTING.md)

.changeset/*.md: Create changesets with just new-changeset; store them in .changeset/ with correct frontmatter (package keys and change type).
In changeset descriptions, follow content conventions: user-facing changes only; past tense for what you did; present tense for current behavior; link issues for fixes; link rules/assists; include representative code blocks; end every sentence with a period.
When adding headers in a changeset, only use #### or ##### levels.

Files:

  • .changeset/wet-results-talk.md
🧠 Learnings (17)
📓 Common learnings
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-17T08:56:30.831Z
Learning: Applies to crates/biome_analyze/crates/**/lib/src/**/nursery/**/*.rs : Use `domains` in `declare_lint_rule!` when applicable; recommended rules with domains enable only when the domain is active
📚 Learning: 2025-08-17T08:56:30.831Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-17T08:56:30.831Z
Learning: Applies to crates/biome_analyze/crates/**/lib/src/**/nursery/**/*.rs : When porting from other linters, declare `sources: &[RuleSource::<...>]` in `declare_lint_rule!` using `.same()` or `.inspired()` as appropriate

Applied to files:

  • crates/biome_cli/src/commands/lint.rs
  • crates/biome_cli/src/commands/scan_kind.rs
  • crates/biome_service/src/workspace.tests.rs
📚 Learning: 2025-08-17T08:56:30.831Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-17T08:56:30.831Z
Learning: Applies to crates/biome_analyze/crates/biome_js_analyze/lib/src/lint/nursery/*.rs : For new JavaScript lint rules generated by `just new-js-lintrule`, implement the rule in the generated file under `biome_js_analyze/lib/src/lint/nursery/`

Applied to files:

  • crates/biome_cli/src/commands/lint.rs
  • crates/biome_cli/src/execute/mod.rs
  • xtask/codegen/src/generate_configuration.rs
  • crates/biome_service/src/file_handlers/javascript.rs
  • crates/biome_cli/src/commands/mod.rs
📚 Learning: 2025-08-17T08:56:30.831Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-17T08:56:30.831Z
Learning: Applies to crates/biome_analyze/crates/**/lib/src/**/nursery/**/*.rs : Use `domains` in `declare_lint_rule!` when applicable; recommended rules with domains enable only when the domain is active

Applied to files:

  • crates/biome_cli/src/commands/lint.rs
  • crates/biome_cli/src/commands/scan_kind.rs
  • crates/biome_configuration/src/generated.rs
  • crates/biome_analyze/src/rule.rs
  • crates/biome_lsp/src/server.tests.rs
  • xtask/codegen/src/generate_configuration.rs
  • crates/biome_service/src/workspace.tests.rs
  • crates/biome_cli/tests/cases/linter_domains.rs
  • crates/biome_service/src/file_handlers/javascript.rs
  • crates/biome_service/src/configuration.rs
  • crates/biome_cli/src/commands/mod.rs
  • crates/biome_service/src/workspace/server.rs
  • crates/biome_configuration/src/analyzer/mod.rs
  • crates/biome_service/src/file_handlers/mod.rs
📚 Learning: 2025-08-17T08:56:30.831Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-17T08:56:30.831Z
Learning: Applies to crates/biome_analyze/crates/**/lib/src/**/nursery/**/*.rs : If a rule is deprecated, set the `deprecated:` field in `declare_lint_rule!` with a reason and alternative

Applied to files:

  • crates/biome_cli/src/commands/lint.rs
📚 Learning: 2025-08-17T08:56:30.831Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-17T08:56:30.831Z
Learning: Applies to crates/biome_analyze/crates/**/lib/src/**/nursery/**/*.rs : In `declare_lint_rule!` declarations, set `version: "next"`

Applied to files:

  • crates/biome_cli/src/commands/lint.rs
📚 Learning: 2025-08-17T08:56:30.831Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-17T08:56:30.831Z
Learning: Applies to crates/biome_analyze/crates/**/lib/src/**/nursery/**/*.rs : Choose an appropriate `severity` in `declare_lint_rule!` (default is info); use `Severity::Error` for hard errors, `Warning` for potential issues, `Information` for style

Applied to files:

  • crates/biome_cli/src/commands/lint.rs
📚 Learning: 2025-08-17T08:56:30.831Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-17T08:56:30.831Z
Learning: Applies to crates/biome_analyze/crates/biome_rule_options/lib/**/*.rs : Define per-rule options in the `biome_rule_options` crate under `lib/`, with serde- and schemars-compatible derives and `#[serde(rename_all = "camelCase", deny_unknown_fields, default)]`

Applied to files:

  • crates/biome_cli/src/commands/lint.rs
  • crates/biome_cli/src/commands/scan_kind.rs
  • crates/biome_analyze/src/rule.rs
  • crates/biome_lsp/src/server.tests.rs
  • crates/biome_cli/src/execute/mod.rs
  • crates/biome_service/src/workspace.rs
  • crates/biome_service/src/file_handlers/javascript.rs
  • crates/biome_service/src/configuration.rs
  • crates/biome_service/src/file_handlers/json.rs
  • crates/biome_cli/src/commands/mod.rs
  • crates/biome_configuration/src/analyzer/mod.rs
  • crates/biome_service/src/file_handlers/mod.rs
📚 Learning: 2025-08-17T08:56:30.831Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-17T08:56:30.831Z
Learning: Applies to crates/biome_analyze/crates/biome_js_analyze/tests/quick_test.rs : Use `biome_js_analyze/tests/quick_test.rs` for quick, ad-hoc testing; un-ignore the test and adjust the rule filter as needed

Applied to files:

  • crates/biome_cli/src/commands/scan_kind.rs
  • crates/biome_lsp/src/server.tests.rs
  • crates/biome_cli/src/execute/mod.rs
  • crates/biome_service/src/workspace.tests.rs
  • crates/biome_cli/tests/cases/linter_domains.rs
📚 Learning: 2025-08-17T08:56:30.831Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-17T08:56:30.831Z
Learning: Applies to crates/biome_analyze/crates/**/lib/src/**/nursery/**/*.rs : If a rule provides a code action, add `fix_kind` in `declare_lint_rule!` and use `ctx.action_category(ctx.category(), ctx.group())` and `ctx.metadata().applicability()` when constructing actions

Applied to files:

  • crates/biome_cli/src/commands/scan_kind.rs
  • crates/biome_lsp/src/server.tests.rs
  • crates/biome_configuration/src/analyzer/mod.rs
📚 Learning: 2025-08-11T11:48:27.774Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:48:27.774Z
Learning: Applies to crates/biome_formatter/biome_html_formatter/tests/spec_test.rs : Create tests/spec_test.rs implementing the run(spec_input_file, _expected_file, test_directory, _file_type) function as shown and include!("language.rs")

Applied to files:

  • crates/biome_cli/src/commands/scan_kind.rs
  • crates/biome_cli/tests/cases/linter_domains.rs
📚 Learning: 2025-08-11T11:53:15.299Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_service/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:53:15.299Z
Learning: Applies to crates/biome_service/../biome_lsp/src/server.tests.rs : Keep end-to-end LSP tests in biome_lsp’s server.tests.rs

Applied to files:

  • crates/biome_lsp/src/server.tests.rs
  • crates/biome_service/src/workspace.tests.rs
  • crates/biome_cli/tests/cases/linter_domains.rs
📚 Learning: 2025-08-17T08:56:30.831Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-17T08:56:30.831Z
Learning: Applies to crates/biome_analyze/crates/**/lib/src/**/nursery/**/*.rs : Use the local `rule_category!()` macro in diagnostics for the rule’s category, not string-parsed categories

Applied to files:

  • crates/biome_lsp/src/server.tests.rs
  • crates/biome_cli/src/execute/mod.rs
  • crates/biome_service/src/workspace.rs
  • crates/biome_service/src/workspace.tests.rs
  • crates/biome_lsp/src/handlers/analysis.rs
📚 Learning: 2025-08-11T11:46:05.836Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_diagnostics/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:46:05.836Z
Learning: Applies to crates/biome_diagnostics/**/*.rs : Use helper advice types from biome_diagnostics::v2 (CodeFrameAdvice, CommandAdvice, DiffAdvice, LogAdvice) when suitable

Applied to files:

  • crates/biome_lsp/src/server.tests.rs
  • crates/biome_cli/src/execute/mod.rs
  • crates/biome_service/src/workspace.tests.rs
  • crates/biome_configuration/src/analyzer/mod.rs
📚 Learning: 2025-08-11T11:46:05.836Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_diagnostics/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:46:05.836Z
Learning: Applies to crates/biome_diagnostics/**/*.rs : Specify category and severity using #[diagnostic(...)] on the type or derive them from fields

Applied to files:

  • crates/biome_cli/src/execute/mod.rs
  • crates/biome_service/src/workspace.rs
📚 Learning: 2025-08-11T11:46:05.836Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_diagnostics/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:46:05.836Z
Learning: Applies to crates/biome_diagnostics/**/*.rs : Types implementing Diagnostic must also implement Debug (e.g., use #[derive(Debug, Diagnostic)])

Applied to files:

  • crates/biome_cli/src/execute/mod.rs
📚 Learning: 2025-08-11T11:46:05.836Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_diagnostics/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:46:05.836Z
Learning: Applies to crates/biome_diagnostics/crates/biome_diagnostics_categories/src/categories.rs : When declaring a new diagnostic category, register it in crates/biome_diagnostics_categories/src/categories.rs

Applied to files:

  • crates/biome_cli/src/execute/mod.rs
🧬 Code graph analysis (5)
crates/biome_analyze/src/rule.rs (1)
crates/biome_configuration/src/analyzer/mod.rs (3)
  • from_str (452-457)
  • from_str (578-656)
  • from_str (716-722)
xtask/codegen/src/generate_configuration.rs (2)
crates/biome_analyze/src/rule.rs (4)
  • domains (601-604)
  • new (551-569)
  • new (1315-1326)
  • new (1440-1452)
xtask/codegen/src/lib.rs (1)
  • update (53-73)
crates/biome_cli/tests/cases/linter_domains.rs (4)
crates/biome_service/src/configuration.rs (2)
  • new (129-135)
  • new (707-716)
crates/biome_service/src/file_handlers/mod.rs (12)
  • new (515-528)
  • new (716-730)
  • new (985-1003)
  • new (1300-1314)
  • new (1453-1463)
  • from (88-90)
  • from (94-96)
  • from (100-102)
  • from (106-108)
  • from (112-114)
  • from (118-120)
  • from (124-126)
crates/biome_cli/tests/main.rs (1)
  • run_cli (332-347)
crates/biome_cli/tests/snap_test.rs (1)
  • assert_cli_snapshot (407-409)
crates/biome_service/src/configuration.rs (1)
crates/biome_service/src/file_handlers/mod.rs (2)
  • selector (1169-1169)
  • selector (1186-1186)
crates/biome_configuration/src/analyzer/mod.rs (1)
crates/biome_analyze/src/rule.rs (4)
  • fmt (72-78)
  • fmt (170-207)
  • fmt (439-451)
  • from_str (534-547)
⏰ 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). (23)
  • GitHub Check: Test (depot-windows-2022-16)
  • GitHub Check: Bench (biome_graphql_formatter)
  • GitHub Check: Lint project (depot-windows-2022)
  • GitHub Check: Bench (biome_json_formatter)
  • GitHub Check: Bench (biome_html_formatter)
  • GitHub Check: Test (depot-ubuntu-24.04-arm-16)
  • GitHub Check: Bench (biome_js_formatter)
  • GitHub Check: Bench (biome_module_graph)
  • GitHub Check: Documentation
  • GitHub Check: Bench (biome_configuration)
  • GitHub Check: Bench (biome_graphql_parser)
  • GitHub Check: Bench (biome_json_analyze)
  • GitHub Check: Bench (biome_package)
  • GitHub Check: autofix
  • GitHub Check: Bench (biome_css_analyze)
  • GitHub Check: Bench (biome_json_parser)
  • GitHub Check: Bench (biome_html_parser)
  • GitHub Check: Bench (biome_js_analyze)
  • GitHub Check: Lint project (depot-ubuntu-24.04-arm-16)
  • GitHub Check: Check Dependencies
  • GitHub Check: Bench (biome_css_parser)
  • GitHub Check: Bench (biome_css_formatter)
  • GitHub Check: Bench (biome_js_parser)
🔇 Additional comments (25)
crates/biome_analyze/src/rule.rs (1)

19-19: Import looks fine.

crates/biome_configuration/src/generated.rs (1)

2-2: Keep mod domain_selector; private
No external references to generated::domain_selector were found—visibility is correct.

crates/biome_cli/src/execute/mod.rs (1)

21-21: LGTM: switch to AnalyzerSelector unblocks domain selectors end‑to‑end.

crates/biome_cli/src/commands/lint.rs (2)

5-5: LGTM: correct import for the new selector type.


29-31: Resolve: --only/--skip help text and tests already support DOMAIN
The bpaf annotations use argument("GROUP|RULE|DOMAIN") for both --only and --skip (mod.rs lines 245/256) and there’s a linter_domains.rs test covering domains. No change needed.

crates/biome_lsp/src/handlers/analysis.rs (1)

10-10: Correctly switching from RuleSelector to AnalyzerSelector in LSP code actions

The conversion via AnalyzerSelector::from is the right way to keep LSP filters interoperable with the new selector type. No issues spotted.

Also applies to: 158-163

crates/biome_service/src/workspace/server.rs (1)

1311-1312: Plumbing updated to enabled_selectors looks sound

Passing enabled_rules (now Vec<AnalyzerSelector>) into LintParams { enabled_selectors: … } aligns with the new API. All good.

crates/biome_lsp/src/server.tests.rs (1)

3469-3470: Tests updated to .into() for AnalyzerSelector are correct

Using .into() from RuleSelector keeps tests readable and future-proof with the new union type. Nice and tidy.

Also applies to: 3499-3500, 3525-3526, 3680-3681, 3714-3715, 3745-3746

crates/biome_cli/tests/cases/linter_domains.rs (1)

416-455: CLI skip-by-domain scenario looks good

--skip=test with no domain enabled in config is a clear, focused check. Snapshot assertion is appropriate.

crates/biome_service/src/workspace.tests.rs (1)

276-279: LGTM on selector conversion in workspace tests

Switching to RuleSelector::Rule(...).into() matches the new AnalyzerSelector flow. No further changes needed here.

crates/biome_cli/src/commands/scan_kind.rs (1)

83-85: Test adapts cleanly to AnalyzerSelector. LGTM.

The Into on RuleSelector keeps the test concise and future‑proof.

Also applies to: 92-92

crates/biome_service/src/file_handlers/javascript.rs (1)

721-729: Selector migration looks good here.

The switch to with_enabled_selectors in lint is correct and consistent with the builder API.

crates/biome_cli/src/commands/mod.rs (2)

236-258: Clear CLI help and examples for DOMAIN support.

Nice touch including test/project examples; argument label widened to GROUP|RULE|DOMAIN reads well.


942-947: Passing CLI selectors into scan‑kind computation is the right hook.

This ensures the workspace scan respects --only/--skip from the start.

crates/biome_service/src/file_handlers/json.rs (1)

509-509: Switch to selectors API looks correct.

Good swap to .with_enabled_selectors(&params.enabled_selectors). Nothing else in this block changes behaviour.

crates/biome_service/src/file_handlers/graphql.rs (1)

429-429: Selectors API adoption LGTM.

.with_enabled_selectors(&params.enabled_selectors) aligns GraphQL with the new selector model.

xtask/codegen/src/generate_configuration.rs (2)

278-279: Codegen hook for domains: nice integration point.

Calling generate_for_domains here is clean and keeps the generation single-sourced with group generation.


1161-1164: No action required: MSRV 1.89.0 supports std::sync::LazyLock, and it’s already in use across multiple crates.

crates/biome_service/src/workspace.rs (2)

68-68: Import swap to AnalyzerSelector looks good.


1656-1672: LGTM on selector plumbing for actions/fixes.

Also applies to: 1708-1724

crates/biome_service/src/file_handlers/mod.rs (3)

21-22: Importing AnalyzerSelector and RuleDomainValue is correct.


415-430: Selector plumping LGTM.

Struct field changes and visitor params swapped to AnalyzerSelector read well.

Also applies to: 482-497, 608-623


1160-1174: Verify codegen inclusion for DomainSelector helpers
Ensure the crate’s build script or include! invocation in crates/biome_configuration/src/analyzer/mod.rs actually injects an impl DomainSelector containing both pub fn match_rule::<R>() and pub fn as_rule_filters(); without those methods the calls in file_handlers/mod.rs won’t compile.

crates/biome_configuration/src/analyzer/mod.rs (2)

416-447: Introducing AnalyzerSelector is sound.

The union, parsing, and serde shape look tidy.

Also applies to: 449-486


597-606: RuleSelector group-name check simplification: nice.

Copy link

codspeed-hq bot commented Sep 4, 2025

CodSpeed Performance Report

Merging #7392 will not alter performance

Comparing feat/skip-only-domains (41b6196) with next (ebbddc4)

Summary

✅ 133 untouched benchmarks

@ematipico ematipico requested review from a team and removed request for vladimir-ivanov September 4, 2025 10:05
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

♻️ Duplicate comments (1)
crates/biome_configuration/src/analyzer/mod.rs (1)

530-541: Doctests reference the wrong type (should use RuleSelector).

This will fail doctests; same note as earlier review.

-    /// use biome_configuration::analyzer::{AnalyzerSelector, RuleSelector};
+    /// use biome_configuration::analyzer::RuleSelector;
@@
-    /// let selector = AnalyzerSelector::from_lsp_filter(filter).unwrap();
-    /// assert_eq!(selector, RuleSelector::Rule("source", "useSortedKeys").into());
+    /// let selector = RuleSelector::from_lsp_filter(filter).unwrap();
+    /// assert_eq!(selector, RuleSelector::Rule("source", "useSortedKeys"));
@@
-    /// let selector = AnalyzerSelector::from_lsp_filter(filter).unwrap();
-    /// assert_eq!(selector, RuleSelector::Rule("style", "useConst").into());
+    /// let selector = RuleSelector::from_lsp_filter(filter).unwrap();
+    /// assert_eq!(selector, RuleSelector::Rule("style", "useConst"));
@@
-    /// let selector = AnalyzerSelector::from_lsp_filter(filter).unwrap();
-    /// assert_eq!(selector, RuleSelector::Rule("a11y", "useAltText").into());
+    /// let selector = RuleSelector::from_lsp_filter(filter).unwrap();
+    /// assert_eq!(selector, RuleSelector::Rule("a11y", "useAltText"));
🧹 Nitpick comments (2)
crates/biome_configuration/src/analyzer/mod.rs (2)

416-497: AnalyzerSelector design looks solid; make FromStr return more helpful errors.

Currently returns a generic message, losing RuleSelector’s detailed errors. Prefer bubbling up the specific rule error if domain parsing also fails.

 impl FromStr for AnalyzerSelector {
     type Err = &'static str;

     fn from_str(s: &str) -> Result<Self, Self::Err> {
-        RuleSelector::from_str(s)
-            .map(Self::Rule)
-            .or(DomainSelector::from_str(s).map(Self::Domain))
-            .or(Err("The rule, group or domain doesn't exist."))
+        match RuleSelector::from_str(s) {
+            Ok(rule) => Ok(Self::Rule(rule)),
+            Err(rule_err) => match DomainSelector::from_str(s) {
+                Ok(domain) => Ok(Self::Domain(domain)),
+                Err(_) => Err(rule_err),
+            },
+        }
     }
 }

699-748: DomainSelector looks good; tiny serialisation nit.

Avoid allocating via format! during serialisation.

 impl serde::Serialize for DomainSelector {
     fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
-        serializer.serialize_str(&format!("{self}"))
+        serializer.serialize_str(self.0)
     }
 }
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 2b75e56 and 2015e9b.

📒 Files selected for processing (1)
  • crates/biome_configuration/src/analyzer/mod.rs (5 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{rs,toml}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Format Rust and TOML files before committing (use just f/just format).

Files:

  • crates/biome_configuration/src/analyzer/mod.rs
crates/biome_*/**

📄 CodeRabbit inference engine (CLAUDE.md)

Place core crates under /crates/biome_*/

Files:

  • crates/biome_configuration/src/analyzer/mod.rs
crates/biome_configuration/src/**

📄 CodeRabbit inference engine (CLAUDE.md)

Keep configuration sources under biome_configuration/src/

Files:

  • crates/biome_configuration/src/analyzer/mod.rs
🧠 Learnings (6)
📓 Common learnings
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-17T08:56:30.831Z
Learning: Applies to crates/biome_analyze/crates/**/lib/src/**/nursery/**/*.rs : Use `domains` in `declare_lint_rule!` when applicable; recommended rules with domains enable only when the domain is active
📚 Learning: 2025-08-17T08:56:30.831Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-17T08:56:30.831Z
Learning: Applies to crates/biome_analyze/crates/biome_rule_options/lib/**/*.rs : Define per-rule options in the `biome_rule_options` crate under `lib/`, with serde- and schemars-compatible derives and `#[serde(rename_all = "camelCase", deny_unknown_fields, default)]`

Applied to files:

  • crates/biome_configuration/src/analyzer/mod.rs
📚 Learning: 2025-08-17T08:56:30.831Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-17T08:56:30.831Z
Learning: Applies to crates/biome_analyze/crates/biome_js_analyze/tests/quick_test.rs : Use `biome_js_analyze/tests/quick_test.rs` for quick, ad-hoc testing; un-ignore the test and adjust the rule filter as needed

Applied to files:

  • crates/biome_configuration/src/analyzer/mod.rs
📚 Learning: 2025-08-17T08:56:30.831Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-17T08:56:30.831Z
Learning: Applies to crates/biome_analyze/crates/**/lib/src/**/nursery/**/*.rs : If a rule provides a code action, add `fix_kind` in `declare_lint_rule!` and use `ctx.action_category(ctx.category(), ctx.group())` and `ctx.metadata().applicability()` when constructing actions

Applied to files:

  • crates/biome_configuration/src/analyzer/mod.rs
📚 Learning: 2025-08-17T08:56:30.831Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-17T08:56:30.831Z
Learning: Applies to crates/biome_analyze/crates/**/lib/src/**/nursery/**/*.rs : Use `domains` in `declare_lint_rule!` when applicable; recommended rules with domains enable only when the domain is active

Applied to files:

  • crates/biome_configuration/src/analyzer/mod.rs
📚 Learning: 2025-08-11T11:46:05.836Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_diagnostics/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:46:05.836Z
Learning: Applies to crates/biome_diagnostics/**/*.rs : Use helper advice types from biome_diagnostics::v2 (CodeFrameAdvice, CommandAdvice, DiffAdvice, LogAdvice) when suitable

Applied to files:

  • crates/biome_configuration/src/analyzer/mod.rs
🧬 Code graph analysis (1)
crates/biome_configuration/src/analyzer/mod.rs (1)
crates/biome_analyze/src/rule.rs (4)
  • fmt (72-78)
  • fmt (170-207)
  • fmt (439-451)
  • from_str (534-547)
⏰ 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). (8)
  • GitHub Check: Documentation
  • GitHub Check: Test (depot-ubuntu-24.04-arm-16)
  • GitHub Check: End-to-end tests
  • GitHub Check: Test (depot-windows-2022-16)
  • GitHub Check: Lint project (depot-windows-2022)
  • GitHub Check: Lint project (depot-ubuntu-24.04-arm-16)
  • GitHub Check: autofix
  • GitHub Check: Check Dependencies
🔇 Additional comments (2)
crates/biome_configuration/src/analyzer/mod.rs (2)

7-7: Import of RuleDomain is appropriate.

Needed for DomainSelector::from_str. All good.


603-611: Ignore is_none_or MSRV concern. This is the stable is_none_or extension from the is_none_or crate (not the nightly std API) and carries no MSRV implications. (docs.rs)

Likely an incorrect or invalid review comment.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
crates/biome_service/src/configuration.rs (1)

746-755: Gate --only scan by linter enabled

Wrap the for selector in self.only.iter() block in ProjectScanComputer under if self.configuration.is_linter_enabled() so that project‐level scanning isn’t forced when linting is disabled (crates/biome_service/src/configuration.rs lines 766–772).

crates/biome_configuration/src/analyzer/mod.rs (1)

623-637: Replace unstable Option::is_none_or usage
Option::is_none_or is a nightly-only API (unstable feature is_none_or, issue #126383) and won’t compile on the repo’s MSRV (Rust 1.89.0). Replace calls with

optional_group_name.map_or(true, |n| n == static_group_name)

to maintain compatibility.

♻️ Duplicate comments (1)
crates/biome_configuration/src/analyzer/mod.rs (1)

543-554: Doctest still references the wrong type here.

These examples sit under RuleSelector::from_lsp_filter but call AnalyzerSelector::from_lsp_filter. Unless that function definitely exists and is preferred here, this will fail or confuse readers. Use RuleSelector in the examples.

-    /// use biome_configuration::analyzer::{AnalyzerSelector, RuleSelector};
+    /// use biome_configuration::analyzer::RuleSelector;
@@
-    /// let selector = AnalyzerSelector::from_lsp_filter(filter).unwrap();
-    /// assert_eq!(selector, RuleSelector::Rule("source", "useSortedKeys").into());
+    /// let selector = RuleSelector::from_lsp_filter(filter).unwrap();
+    /// assert_eq!(selector, RuleSelector::Rule("source", "useSortedKeys"));
@@
-    /// let selector = AnalyzerSelector::from_lsp_filter(filter).unwrap();
-    /// assert_eq!(selector, RuleSelector::Rule("style", "useConst").into());
+    /// let selector = RuleSelector::from_lsp_filter(filter).unwrap();
+    /// assert_eq!(selector, RuleSelector::Rule("style", "useConst"));
@@
-    /// let selector = AnalyzerSelector::from_lsp_filter(filter).unwrap();
-    /// assert_eq!(selector, RuleSelector::Rule("a11y", "useAltText").into());
+    /// let selector = RuleSelector::from_lsp_filter(filter).unwrap();
+    /// assert_eq!(selector, RuleSelector::Rule("a11y", "useAltText"));
🧹 Nitpick comments (3)
crates/biome_service/src/configuration.rs (2)

720-722: API change is fine; consider minor ergonomics.

Accepting &[AnalyzerSelector] works. Optionally accept impl IntoIterator<Item = AnalyzerSelector> to avoid callers needing temporary vecs.

-    pub fn with_rule_selectors(
-        mut self,
-        skip: &'a [AnalyzerSelector],
-        only: &'a [AnalyzerSelector],
-    ) -> Self {
+    pub fn with_rule_selectors<I1, I2>(mut self, skip: I1, only: I2) -> Self
+    where
+        I1: IntoIterator<Item = AnalyzerSelector>,
+        I2: IntoIterator<Item = AnalyzerSelector>,
+    {
-        self.skip = skip;
-        self.only = only;
+        // store into owned Vecs if you go this route; adjust struct fields accordingly
+        // self.skip = skip.into_iter().collect();
+        // self.only = only.into_iter().collect();
         self
     }

949-971: Domain “only” tests are great; add a skip-domain case too?

Consider adding --skip=project coverage to show we avoid project scans when all project-domain rules are excluded.

+    #[test]
+    fn should_not_return_project_if_project_domain_is_skipped() {
+        let configuration = Configuration::default();
+        assert_eq!(
+            ProjectScanComputer::new(&configuration)
+                .with_rule_selectors(&[DomainSelector("project").into()], &[])
+                .compute(),
+            ScanKind::NoScanner
+        );
+    }
crates/biome_configuration/src/analyzer/mod.rs (1)

752-756: Avoid alloc in DomainSelector serialisation.

Use the inner &'static str directly.

 impl serde::Serialize for DomainSelector {
     fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
-        serializer.serialize_str(&format!("{self}"))
+        serializer.serialize_str(self.0)
     }
 }
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 2015e9b and f4f4807.

📒 Files selected for processing (2)
  • crates/biome_configuration/src/analyzer/mod.rs (7 hunks)
  • crates/biome_service/src/configuration.rs (7 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{rs,toml}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Format Rust and TOML files before committing (use just f/just format).

Files:

  • crates/biome_service/src/configuration.rs
  • crates/biome_configuration/src/analyzer/mod.rs
crates/biome_*/**

📄 CodeRabbit inference engine (CLAUDE.md)

Place core crates under /crates/biome_*/

Files:

  • crates/biome_service/src/configuration.rs
  • crates/biome_configuration/src/analyzer/mod.rs
crates/biome_configuration/src/**

📄 CodeRabbit inference engine (CLAUDE.md)

Keep configuration sources under biome_configuration/src/

Files:

  • crates/biome_configuration/src/analyzer/mod.rs
🧠 Learnings (10)
📓 Common learnings
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-17T08:56:30.831Z
Learning: Applies to crates/biome_analyze/crates/**/lib/src/**/nursery/**/*.rs : Use `domains` in `declare_lint_rule!` when applicable; recommended rules with domains enable only when the domain is active
📚 Learning: 2025-08-17T08:56:30.831Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-17T08:56:30.831Z
Learning: Applies to crates/biome_analyze/crates/**/lib/src/**/nursery/**/*.rs : Use `domains` in `declare_lint_rule!` when applicable; recommended rules with domains enable only when the domain is active

Applied to files:

  • crates/biome_service/src/configuration.rs
  • crates/biome_configuration/src/analyzer/mod.rs
📚 Learning: 2025-08-17T08:56:30.831Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-17T08:56:30.831Z
Learning: Applies to crates/biome_analyze/crates/biome_rule_options/lib/**/*.rs : Define per-rule options in the `biome_rule_options` crate under `lib/`, with serde- and schemars-compatible derives and `#[serde(rename_all = "camelCase", deny_unknown_fields, default)]`

Applied to files:

  • crates/biome_service/src/configuration.rs
  • crates/biome_configuration/src/analyzer/mod.rs
📚 Learning: 2025-08-17T08:56:30.831Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-17T08:56:30.831Z
Learning: Applies to crates/biome_analyze/crates/biome_js_analyze/tests/quick_test.rs : Use `biome_js_analyze/tests/quick_test.rs` for quick, ad-hoc testing; un-ignore the test and adjust the rule filter as needed

Applied to files:

  • crates/biome_service/src/configuration.rs
📚 Learning: 2025-08-11T11:53:15.299Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_service/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:53:15.299Z
Learning: Applies to crates/biome_service/../biome_lsp/src/server.tests.rs : Keep end-to-end LSP tests in biome_lsp’s server.tests.rs

Applied to files:

  • crates/biome_service/src/configuration.rs
📚 Learning: 2025-08-11T11:48:27.774Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:48:27.774Z
Learning: Applies to crates/biome_formatter/biome_html_formatter/tests/spec_test.rs : Create tests/spec_test.rs implementing the run(spec_input_file, _expected_file, test_directory, _file_type) function as shown and include!("language.rs")

Applied to files:

  • crates/biome_service/src/configuration.rs
📚 Learning: 2025-08-11T11:48:27.774Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:48:27.774Z
Learning: Applies to crates/biome_formatter/biome_html_formatter/tests/spec_tests.rs : Create tests/spec_tests.rs in the biome_html_formatter crate that generates tests via tests_macros::gen_tests! for all HTML files at tests/specs/html/**/*.html

Applied to files:

  • crates/biome_service/src/configuration.rs
📚 Learning: 2025-08-17T08:56:30.831Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-17T08:56:30.831Z
Learning: Applies to crates/biome_analyze/crates/**/lib/src/**/nursery/**/*.rs : Choose an appropriate `severity` in `declare_lint_rule!` (default is info); use `Severity::Error` for hard errors, `Warning` for potential issues, `Information` for style

Applied to files:

  • crates/biome_service/src/configuration.rs
📚 Learning: 2025-08-17T08:56:30.831Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-17T08:56:30.831Z
Learning: Applies to crates/biome_analyze/crates/**/lib/src/**/nursery/**/*.rs : If a rule provides a code action, add `fix_kind` in `declare_lint_rule!` and use `ctx.action_category(ctx.category(), ctx.group())` and `ctx.metadata().applicability()` when constructing actions

Applied to files:

  • crates/biome_configuration/src/analyzer/mod.rs
📚 Learning: 2025-08-11T11:46:05.836Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_diagnostics/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:46:05.836Z
Learning: Applies to crates/biome_diagnostics/**/*.rs : Use helper advice types from biome_diagnostics::v2 (CodeFrameAdvice, CommandAdvice, DiffAdvice, LogAdvice) when suitable

Applied to files:

  • crates/biome_configuration/src/analyzer/mod.rs
🧬 Code graph analysis (2)
crates/biome_service/src/configuration.rs (1)
crates/biome_service/src/file_handlers/mod.rs (8)
  • selector (1169-1169)
  • selector (1186-1186)
  • filter (1164-1164)
  • filter (1164-1164)
  • filter (1181-1181)
  • filter (1181-1181)
  • filter (1333-1333)
  • filter (1351-1351)
crates/biome_configuration/src/analyzer/mod.rs (3)
crates/biome_service/src/file_handlers/mod.rs (4)
  • domain (1338-1338)
  • domain (1356-1356)
  • fmt (375-405)
  • fmt (409-411)
crates/biome_analyze/src/rule.rs (4)
  • fmt (72-78)
  • fmt (170-207)
  • fmt (439-451)
  • from_str (534-547)
crates/biome_service/src/configuration.rs (1)
  • s (773-773)
⏰ 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). (21)
  • GitHub Check: Bench (biome_html_formatter)
  • GitHub Check: Bench (biome_configuration)
  • GitHub Check: Bench (biome_module_graph)
  • GitHub Check: Bench (biome_package)
  • GitHub Check: autofix
  • GitHub Check: Bench (biome_css_parser)
  • GitHub Check: Bench (biome_html_parser)
  • GitHub Check: Bench (biome_graphql_formatter)
  • GitHub Check: Bench (biome_json_parser)
  • GitHub Check: Bench (biome_json_analyze)
  • GitHub Check: Bench (biome_js_formatter)
  • GitHub Check: Bench (biome_css_formatter)
  • GitHub Check: Bench (biome_json_formatter)
  • GitHub Check: Bench (biome_css_analyze)
  • GitHub Check: Bench (biome_js_parser)
  • GitHub Check: Bench (biome_js_analyze)
  • GitHub Check: Bench (biome_graphql_parser)
  • GitHub Check: Documentation
  • GitHub Check: Test (depot-windows-2022-16)
  • GitHub Check: Test (depot-ubuntu-24.04-arm-16)
  • GitHub Check: Check Dependencies
🔇 Additional comments (9)
crates/biome_service/src/configuration.rs (6)

7-7: Import update aligns with new selector model.

Switch to AnalyzerSelector and RuleDomainValue looks correct.


702-704: Struct fields switched to AnalyzerSelector — good migration.

This unblocks domain-aware matching downstream.


765-775: Correct: selectors now honoured via match_rule (domains included).

This fixes the earlier bug where --skip/--only domain selectors had no effect on scan computation.


825-826: Test imports reflect new API.

Bringing DomainSelector into scope is expected with domain-aware tests.


912-914: Rule-only skip path covered.

Good regression test ensuring a project-domain rule can be skipped.


941-943: Rule-only “only” path covered.

Confirms “only rule” forces project scan — nice.

crates/biome_configuration/src/analyzer/mod.rs (3)

7-7: Import additions OK.

RuleDomain and RuleFilter are used below; all good.


417-471: New AnalyzerSelector abstraction is solid.

  • Enum + conversions cover both rules and domains.
  • FromStr, Display/Debug, serde, and schema implementations look consistent.
  • match_rule delegates appropriately.

Nice consolidation.


570-576: Helper RuleSelector::match_rule is neat.

Keeps call sites terse by deferring to RuleFilter.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (4)
crates/biome_configuration/src/analyzer/mod.rs (2)

543-554: Doc example: drop the unused AnalyzerSelector import.

Tiny nit: importing AnalyzerSelector here may confuse readers.

Apply:

-    /// use biome_configuration::analyzer::{AnalyzerSelector, RuleSelector};
+    /// use biome_configuration::analyzer::RuleSelector;

719-776: DomainSelector is lean; avoid alloc in Serialize.

Serialising via format!("{self}") allocates. Serialise the inner &'static str directly.

Apply:

 impl serde::Serialize for DomainSelector {
     fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
-        serializer.serialize_str(&format!("{self}"))
+        serializer.serialize_str(self.0)
     }
 }
crates/biome_service/src/configuration.rs (2)

765-775: Matching logic now honours domains.

This fixes the prior equality check blind spot for --skip/--only with domains.

You can simplify the “only” branch to mirror the “skip” style:

-        if !self.only.is_empty() {
-            for selector in self.only.iter() {
-                if selector.match_rule::<R>() {
-                    let domains = R::METADATA.domains;
-                    self.requires_project_scan |= domains.contains(&RuleDomain::Project);
-                    break;
-                }
-            }
+        if !self.only.is_empty() {
+            if self.only.iter().any(|s| s.match_rule::<R>()) {
+                let domains = R::METADATA.domains;
+                self.requires_project_scan |= domains.contains(&RuleDomain::Project);
+            }
         } else if !self.skip.iter().any(|s| s.match_rule::<R>())
             && self.enabled_rules.contains(&filter)
         {

961-971: Non-project domain test is good; optional API polish.

Minor: prefer parsing via DomainSelector::from_str("test").unwrap() to validate inputs in tests as well.

If preferred:

-                .with_rule_selectors(&[], &[DomainSelector("test").into()])
+                .with_rule_selectors(&[], &[DomainSelector::from_str("test").unwrap().into()])
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between f4f4807 and 6cb2113.

📒 Files selected for processing (2)
  • crates/biome_configuration/src/analyzer/mod.rs (7 hunks)
  • crates/biome_service/src/configuration.rs (7 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{rs,toml}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Format Rust and TOML files before committing (use just f/just format).

Files:

  • crates/biome_service/src/configuration.rs
  • crates/biome_configuration/src/analyzer/mod.rs
crates/biome_*/**

📄 CodeRabbit inference engine (CLAUDE.md)

Place core crates under /crates/biome_*/

Files:

  • crates/biome_service/src/configuration.rs
  • crates/biome_configuration/src/analyzer/mod.rs
crates/biome_configuration/src/**

📄 CodeRabbit inference engine (CLAUDE.md)

Keep configuration sources under biome_configuration/src/

Files:

  • crates/biome_configuration/src/analyzer/mod.rs
🧠 Learnings (10)
📓 Common learnings
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-17T08:56:30.831Z
Learning: Applies to crates/biome_analyze/crates/**/lib/src/**/nursery/**/*.rs : Use `domains` in `declare_lint_rule!` when applicable; recommended rules with domains enable only when the domain is active
📚 Learning: 2025-08-17T08:56:30.831Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-17T08:56:30.831Z
Learning: Applies to crates/biome_analyze/crates/**/lib/src/**/nursery/**/*.rs : Use `domains` in `declare_lint_rule!` when applicable; recommended rules with domains enable only when the domain is active

Applied to files:

  • crates/biome_service/src/configuration.rs
  • crates/biome_configuration/src/analyzer/mod.rs
📚 Learning: 2025-08-17T08:56:30.831Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-17T08:56:30.831Z
Learning: Applies to crates/biome_analyze/crates/biome_rule_options/lib/**/*.rs : Define per-rule options in the `biome_rule_options` crate under `lib/`, with serde- and schemars-compatible derives and `#[serde(rename_all = "camelCase", deny_unknown_fields, default)]`

Applied to files:

  • crates/biome_service/src/configuration.rs
  • crates/biome_configuration/src/analyzer/mod.rs
📚 Learning: 2025-08-17T08:56:30.831Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-17T08:56:30.831Z
Learning: Applies to crates/biome_analyze/crates/biome_js_analyze/tests/quick_test.rs : Use `biome_js_analyze/tests/quick_test.rs` for quick, ad-hoc testing; un-ignore the test and adjust the rule filter as needed

Applied to files:

  • crates/biome_service/src/configuration.rs
📚 Learning: 2025-08-11T11:53:15.299Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_service/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:53:15.299Z
Learning: Applies to crates/biome_service/../biome_lsp/src/server.tests.rs : Keep end-to-end LSP tests in biome_lsp’s server.tests.rs

Applied to files:

  • crates/biome_service/src/configuration.rs
📚 Learning: 2025-08-11T11:48:27.774Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:48:27.774Z
Learning: Applies to crates/biome_formatter/biome_html_formatter/tests/spec_tests.rs : Create tests/spec_tests.rs in the biome_html_formatter crate that generates tests via tests_macros::gen_tests! for all HTML files at tests/specs/html/**/*.html

Applied to files:

  • crates/biome_service/src/configuration.rs
📚 Learning: 2025-08-11T11:48:27.774Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:48:27.774Z
Learning: Applies to crates/biome_formatter/biome_html_formatter/tests/spec_test.rs : Create tests/spec_test.rs implementing the run(spec_input_file, _expected_file, test_directory, _file_type) function as shown and include!("language.rs")

Applied to files:

  • crates/biome_service/src/configuration.rs
📚 Learning: 2025-08-17T08:56:30.831Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-17T08:56:30.831Z
Learning: Applies to crates/biome_analyze/crates/**/lib/src/**/nursery/**/*.rs : Choose an appropriate `severity` in `declare_lint_rule!` (default is info); use `Severity::Error` for hard errors, `Warning` for potential issues, `Information` for style

Applied to files:

  • crates/biome_service/src/configuration.rs
📚 Learning: 2025-08-17T08:56:30.831Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-17T08:56:30.831Z
Learning: Applies to crates/biome_analyze/crates/**/lib/src/**/nursery/**/*.rs : If a rule provides a code action, add `fix_kind` in `declare_lint_rule!` and use `ctx.action_category(ctx.category(), ctx.group())` and `ctx.metadata().applicability()` when constructing actions

Applied to files:

  • crates/biome_configuration/src/analyzer/mod.rs
📚 Learning: 2025-08-11T11:46:05.836Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_diagnostics/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:46:05.836Z
Learning: Applies to crates/biome_diagnostics/**/*.rs : Use helper advice types from biome_diagnostics::v2 (CodeFrameAdvice, CommandAdvice, DiffAdvice, LogAdvice) when suitable

Applied to files:

  • crates/biome_configuration/src/analyzer/mod.rs
🧬 Code graph analysis (2)
crates/biome_service/src/configuration.rs (1)
crates/biome_service/src/file_handlers/mod.rs (8)
  • selector (1169-1169)
  • selector (1186-1186)
  • filter (1164-1164)
  • filter (1164-1164)
  • filter (1181-1181)
  • filter (1181-1181)
  • filter (1333-1333)
  • filter (1351-1351)
crates/biome_configuration/src/analyzer/mod.rs (3)
crates/biome_service/src/file_handlers/mod.rs (4)
  • domain (1338-1338)
  • domain (1356-1356)
  • fmt (375-405)
  • fmt (409-411)
crates/biome_analyze/src/rule.rs (4)
  • fmt (72-78)
  • fmt (170-207)
  • fmt (439-451)
  • from_str (534-547)
crates/biome_service/src/configuration.rs (1)
  • s (773-773)
⏰ 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). (19)
  • GitHub Check: Bench (biome_graphql_formatter)
  • GitHub Check: Bench (biome_js_formatter)
  • GitHub Check: Bench (biome_configuration)
  • GitHub Check: Bench (biome_html_parser)
  • GitHub Check: Bench (biome_module_graph)
  • GitHub Check: Bench (biome_json_analyze)
  • GitHub Check: Bench (biome_graphql_parser)
  • GitHub Check: Bench (biome_package)
  • GitHub Check: Bench (biome_json_parser)
  • GitHub Check: Bench (biome_html_formatter)
  • GitHub Check: Bench (biome_json_formatter)
  • GitHub Check: Bench (biome_css_analyze)
  • GitHub Check: Bench (biome_css_formatter)
  • GitHub Check: Bench (biome_css_parser)
  • GitHub Check: Bench (biome_js_parser)
  • GitHub Check: Bench (biome_js_analyze)
  • GitHub Check: Documentation
  • GitHub Check: Check Dependencies
  • GitHub Check: autofix
🔇 Additional comments (13)
crates/biome_configuration/src/analyzer/mod.rs (9)

7-7: Imports look right.

Bringing RuleDomain and Rule into scope is appropriate for the new selector plumbing.


18-18: Deref import is appropriate.

Needed for the DomainSelector wrapper ergonomics.


417-446: New union selector type is tidy and future-proof.

AnalyzerSelector cleanly models rule vs domain selection.


447-451: Debug/Display impls are consistent.

Forwarding Debug to Display keeps output consistent across both variants.

Also applies to: 453-460


462-471: FromStr fallback chain reads well.

Tries rule, then domain, with a clear error on failure.


473-480: Serde Visitor is fine.

String-based serialisation/deserialisation matches the CLI/JSON shape.

Also applies to: 482-499


501-509: Schema output is acceptable.

Naming it “Selector” as a string type is sensible for public schema stability.


570-576: Good: reuse RuleFilter for rule matching.

Keeps match semantics centralised.


623-624: No MSRV issue: Option::is_none_or is supported under Rust 1.89.0
rust-toolchain.toml pins channel to 1.89.0 (stabilised in 1.72), so no change needed.

crates/biome_service/src/configuration.rs (4)

7-7: Import switch to AnalyzerSelector is correct.

You’ll need it for domain-aware --skip/--only.


702-704: Types updated for skip/only.

Moving to &[AnalyzerSelector] is the right abstraction.


719-722: API signature updated accordingly.

with_rule_selectors now accepts the union selector—good.


949-959: Domain-only project scan test reads well.

Nice coverage for --only project.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (3)
crates/biome_service/src/configuration.rs (3)

763-765: Tiny fast-path: bail early once a project scan is decided.

Avoid extra registry visits after we already know the answer.

Apply:

 let filter = RuleFilter::Rule(<R::Group as RuleGroup>::NAME, R::METADATA.name);
 
+if self.requires_project_scan {
+    return;
+}
+
 if !self.only.is_empty() {

949-972: Verify test is recognised or use a known non-project domain
DomainSelector("test") isn’t in the generated domain list, so your test may pass vacuously. Swap to a known non-project domain (e.g. "core") or add an assertion that "test" actually resolves.


702-704: Call sites now correctly use AnalyzerSelector slices (converted with .into()). API update is sound; consider adding a with_selectors alias and deprecating with_rule_selectors for clarity.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 6cb2113 and 41b6196.

📒 Files selected for processing (1)
  • crates/biome_service/src/configuration.rs (7 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{rs,toml}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Format Rust and TOML files before committing (use just f/just format).

Files:

  • crates/biome_service/src/configuration.rs
crates/biome_*/**

📄 CodeRabbit inference engine (CLAUDE.md)

Place core crates under /crates/biome_*/

Files:

  • crates/biome_service/src/configuration.rs
🧠 Learnings (14)
📓 Common learnings
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-17T08:56:30.831Z
Learning: Applies to crates/biome_analyze/crates/**/lib/src/**/nursery/**/*.rs : Use `domains` in `declare_lint_rule!` when applicable; recommended rules with domains enable only when the domain is active
📚 Learning: 2025-08-17T08:56:30.831Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-17T08:56:30.831Z
Learning: Applies to crates/biome_analyze/crates/**/lib/src/**/nursery/**/*.rs : Use `domains` in `declare_lint_rule!` when applicable; recommended rules with domains enable only when the domain is active

Applied to files:

  • crates/biome_service/src/configuration.rs
📚 Learning: 2025-08-17T08:56:30.831Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-17T08:56:30.831Z
Learning: Applies to crates/biome_analyze/crates/biome_js_analyze/tests/quick_test.rs : Use `biome_js_analyze/tests/quick_test.rs` for quick, ad-hoc testing; un-ignore the test and adjust the rule filter as needed

Applied to files:

  • crates/biome_service/src/configuration.rs
📚 Learning: 2025-08-17T08:56:30.831Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-17T08:56:30.831Z
Learning: Applies to crates/biome_analyze/crates/biome_rule_options/lib/**/*.rs : Define per-rule options in the `biome_rule_options` crate under `lib/`, with serde- and schemars-compatible derives and `#[serde(rename_all = "camelCase", deny_unknown_fields, default)]`

Applied to files:

  • crates/biome_service/src/configuration.rs
📚 Learning: 2025-08-17T08:56:30.831Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-17T08:56:30.831Z
Learning: Applies to crates/biome_analyze/crates/biome_js_analyze/lib/src/lint/nursery/*.rs : For new JavaScript lint rules generated by `just new-js-lintrule`, implement the rule in the generated file under `biome_js_analyze/lib/src/lint/nursery/`

Applied to files:

  • crates/biome_service/src/configuration.rs
📚 Learning: 2025-08-17T08:56:30.831Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-17T08:56:30.831Z
Learning: Applies to crates/biome_analyze/crates/**/lib/src/**/nursery/**/*.rs : Choose an appropriate `severity` in `declare_lint_rule!` (default is info); use `Severity::Error` for hard errors, `Warning` for potential issues, `Information` for style

Applied to files:

  • crates/biome_service/src/configuration.rs
📚 Learning: 2025-08-11T11:46:05.836Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_diagnostics/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:46:05.836Z
Learning: Applies to crates/biome_diagnostics/**/*.rs : Use helper advice types from biome_diagnostics::v2 (CodeFrameAdvice, CommandAdvice, DiffAdvice, LogAdvice) when suitable

Applied to files:

  • crates/biome_service/src/configuration.rs
📚 Learning: 2025-08-17T08:56:30.831Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-17T08:56:30.831Z
Learning: Applies to crates/biome_analyze/crates/**/lib/src/**/nursery/**/*.rs : Place all new rules in the nursery group (implement new rule files under a `nursery` directory)

Applied to files:

  • crates/biome_service/src/configuration.rs
📚 Learning: 2025-08-17T08:56:30.831Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-17T08:56:30.831Z
Learning: Applies to crates/biome_analyze/crates/**/lib/src/**/nursery/**/*.rs : When porting from other linters, declare `sources: &[RuleSource::<...>]` in `declare_lint_rule!` using `.same()` or `.inspired()` as appropriate

Applied to files:

  • crates/biome_service/src/configuration.rs
📚 Learning: 2025-08-17T08:56:30.831Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-17T08:56:30.831Z
Learning: Applies to crates/biome_analyze/crates/**/lib/src/**/nursery/**/*.rs : Use the local `rule_category!()` macro in diagnostics for the rule’s category, not string-parsed categories

Applied to files:

  • crates/biome_service/src/configuration.rs
📚 Learning: 2025-08-17T08:56:30.831Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-17T08:56:30.831Z
Learning: Applies to crates/biome_analyze/crates/**/lib/src/**/nursery/**/*.rs : If a rule provides a code action, add `fix_kind` in `declare_lint_rule!` and use `ctx.action_category(ctx.category(), ctx.group())` and `ctx.metadata().applicability()` when constructing actions

Applied to files:

  • crates/biome_service/src/configuration.rs
📚 Learning: 2025-08-11T11:53:15.299Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_service/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:53:15.299Z
Learning: Applies to crates/biome_service/../biome_lsp/src/server.tests.rs : Keep end-to-end LSP tests in biome_lsp’s server.tests.rs

Applied to files:

  • crates/biome_service/src/configuration.rs
📚 Learning: 2025-08-11T11:48:27.774Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:48:27.774Z
Learning: Applies to crates/biome_formatter/biome_html_formatter/tests/spec_test.rs : Create tests/spec_test.rs implementing the run(spec_input_file, _expected_file, test_directory, _file_type) function as shown and include!("language.rs")

Applied to files:

  • crates/biome_service/src/configuration.rs
📚 Learning: 2025-08-11T11:48:27.774Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:48:27.774Z
Learning: Applies to crates/biome_formatter/biome_html_formatter/tests/spec_tests.rs : Create tests/spec_tests.rs in the biome_html_formatter crate that generates tests via tests_macros::gen_tests! for all HTML files at tests/specs/html/**/*.html

Applied to files:

  • crates/biome_service/src/configuration.rs
🧬 Code graph analysis (1)
crates/biome_service/src/configuration.rs (1)
crates/biome_service/src/file_handlers/mod.rs (8)
  • selector (1169-1169)
  • selector (1186-1186)
  • filter (1164-1164)
  • filter (1164-1164)
  • filter (1181-1181)
  • filter (1181-1181)
  • filter (1333-1333)
  • filter (1351-1351)
⏰ 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). (23)
  • GitHub Check: Documentation
  • GitHub Check: Lint project (depot-ubuntu-24.04-arm-16)
  • GitHub Check: Test (depot-ubuntu-24.04-arm-16)
  • GitHub Check: Test (depot-windows-2022-16)
  • GitHub Check: Lint project (depot-windows-2022)
  • GitHub Check: Check Dependencies
  • GitHub Check: Bench (biome_graphql_parser)
  • GitHub Check: Bench (biome_configuration)
  • GitHub Check: Bench (biome_json_analyze)
  • GitHub Check: Bench (biome_package)
  • GitHub Check: Bench (biome_module_graph)
  • GitHub Check: autofix
  • GitHub Check: Bench (biome_html_parser)
  • GitHub Check: Bench (biome_css_formatter)
  • GitHub Check: Bench (biome_html_formatter)
  • GitHub Check: Bench (biome_js_analyze)
  • GitHub Check: Bench (biome_js_parser)
  • GitHub Check: Bench (biome_json_formatter)
  • GitHub Check: Bench (biome_css_parser)
  • GitHub Check: Bench (biome_graphql_formatter)
  • GitHub Check: Bench (biome_js_formatter)
  • GitHub Check: Bench (biome_json_parser)
  • GitHub Check: Bench (biome_css_analyze)
🔇 Additional comments (4)
crates/biome_service/src/configuration.rs (4)

7-7: Importing AnalyzerSelector is correct.

Matches the new selector model used below. No further action.


765-775: Selector matching fix looks solid.

Using selector.match_rule::<R>() ensures domain-only flags are honoured. This addresses the earlier equality-comparison pitfall.


825-826: Tests import set is right.

RuleSelector, DomainSelector, and friends are all in scope; good.


912-913: Explicit .into() to AnalyzerSelector is appropriate.

Keeps tests readable while exercising the new API.

Also applies to: 942-943

@ematipico ematipico merged commit e4feb8e into next Sep 7, 2025
29 checks passed
@ematipico ematipico deleted the feat/skip-only-domains branch September 7, 2025 13:30
@coderabbitai coderabbitai bot mentioned this pull request Oct 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-CLI Area: CLI A-Linter Area: linter A-LSP Area: language server protocol A-Project Area: project A-Tooling Area: internal tools

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

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