Skip to content

Conversation

@ematipico
Copy link
Member

Summary

This PR makes the type inference optional inside the module graph, and creates a new Types domain. All rules that we have that use type inference are nursery, so fortunately, there aren't any breaking changes for downstream users.

The initial logic to make type inference optional was implemented using AI, and I then implemented the logic to compute the infer_type flag. This flag is saved inside Settings.

Test Plan

The majority of the tests were added using AI.

Docs

TODO

@changeset-bot
Copy link

changeset-bot bot commented Dec 23, 2025

🦋 Changeset detected

Latest commit: f6b423f

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

This PR includes changesets to release 14 packages
Name Type
@biomejs/biome Minor
@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

@ematipico ematipico changed the title feat(lsp): report progress while scanning the project (#7961) feat(lint): types domain Dec 23, 2025
@ematipico ematipico changed the title feat(lint): types domain feat(lint): types domain and optional inference Dec 23, 2025
@github-actions github-actions bot added A-CLI Area: CLI A-Project Area: project A-Linter Area: linter A-LSP Area: language server protocol L-JavaScript Language: JavaScript and super languages labels Dec 23, 2025
@ematipico ematipico requested review from a team December 23, 2025 18:46
@codspeed-hq
Copy link

codspeed-hq bot commented Dec 23, 2025

CodSpeed Performance Report

Merging #8564 will not alter performance

Comparing feat/type-domain (f6b423f) with next (ab88099)1

Summary

✅ 58 untouched
⏩ 95 skipped2

Footnotes

  1. No successful run was found on next (73f4f53) during the generation of this report, so ab88099 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

  2. 95 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 23, 2025

Walkthrough

Adds a new rule domain Types for rules that require type inference and moves several nursery rules into it (useArraySortCompare, useAwaitThenable, useFind, useRegexpExec, noUnnecessaryConditions, noMisusedPromises, noFloatingPromises). Introduces ScanKind::TypeAware and ModuleGraphResolutionKind, threads module_graph_resolution_kind through CLI/LSP/workspace APIs, adds an infer_types flag into module-graph visitor/collector to conditionally run type inference, and updates scanner/watcher/workspace APIs to pass project context and the new resolution kind.

Possibly related PRs

Suggested reviewers

  • arendjr
  • dyc3

Pre-merge checks and finishing touches

✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarises the primary changes: introducing a types domain and making type inference optional.
Description check ✅ Passed The description clearly relates to the changeset, explaining the motivation, implementation approach, and noting AI assistance disclosures.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/type-domain

Comment @coderabbitai help to get the list of available commands and usage tips.

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/scanner/watcher.rs (2)

387-400: Early return abandons remaining files in the batch.

When iterating through paths, if find_project_for_path returns None for any path, line 394 returns immediately with an empty vec. This abandons all subsequent paths—including those that do belong to a project.

Replace return Ok(vec![]); with continue; to skip files outside known projects whilst still processing the rest.

🔎 Proposed fix
     let mut diagnostics = vec![];
     for path in paths {
         let Some(project_key) = workspace.find_project_for_path(&path) else {
-            return Ok(vec![]);
+            continue;
         };
         diagnostics.extend(workspace.unload_file(&path, project_key)?);
     }

406-420: Same early-return issue in unload_paths.

Line 413 has the identical problem: returning early abandons remaining paths in the batch.

🔎 Proposed fix
     let mut diagnostics = vec![];
     for path in &paths {
         let Some(project_key) = workspace.find_project_for_path(path) else {
-            return Ok(vec![]);
+            continue;
         };
         let result = workspace.unload_path(path, project_key)?;
         diagnostics.extend(result);
     }
🧹 Nitpick comments (5)
crates/biome_module_graph/benches/module_graph.rs (1)

72-78: LGTM!

The benchmark now passes true for the new enable_type_inference parameter. This aligns with the TypeAware scanning mode introduced in this PR.

For completeness, you might consider adding a separate benchmark variant with enable_type_inference: false to measure the performance difference. But that's optional and could be a follow-up.

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

687-748: TypeAware ScanKind variant integrates cleanly; double‑check uses of is_project()

The TypeAware variant, its inclusion in clone_without_targeting_info, and the new is_type_aware() helper all look coherent and match the intended “project‑wide with types” mode.

One thing to sanity‑check: any existing call‑sites that rely on scan_kind.is_project() as “full project scan” may also need to treat TypeAware as project‑like. If that’s the intent everywhere, it might be worth updating is_project to match both variants, or auditing those call‑sites to decide case‑by‑case.

crates/biome_service/src/scanner/workspace_scanner_bridge.tests.rs (1)

191-207: Use of ModuleGraphResolutionKind::ModulesAndTypes in scanner bridge tests is reasonable

Plumbing module_graph_resolution_kind: ModuleGraphResolutionKind::ModulesAndTypes into UpdateSettingsParams in these tests is a sensible default: it exercises the “types enabled” path while the assertions still focus purely on which files end up indexed or ignored. If you later add tests for non‑type‑aware scenarios, mirroring ModuleGraphResolutionKind::None / Modules there could help document those behaviours explicitly, but nothing here blocks merging.

Also applies to: 231-247, 273-289, 321-338, 367-383, 409-425, 453-468

crates/biome_module_graph/tests/spec_tests.rs (2)

132-137: Enabling type inference in existing module‑graph spec tests is consistent

All the updated update_graph_for_js_paths calls now pass true for the new enable_type_inference flag, which matches the intent of these specs (they all assert on fairly rich inferred types). That keeps existing expectations intact while making the flag explicit. If the signature grows further, you might eventually consider a small helper or builder to avoid the trailing “mystery bool”, but for now this is readable enough.

Also applies to: 158-160, 184-186, 259-261, 307-308, 331-333, 359-361, 447-448, 557-559, 585-587, 618-620, 680-682, 727-729, 772-773, 804-806, 862-864, 955-957, 1030-1032, 1064-1066, 1163-1165, 1193-1195, 1216-1218, 1285-1287, 1464-1466, 1505-1507, 1548-1550, 1607-1608, 1671-1672, 1788-1790, 1889-1894, 1947-1949, 2008-2010, 2079-2081, 2149-2151, 2187-2188


2202-2286: New test for disabling type inference exercises the flag well, minor robustness thought

test_type_inference_disabled_when_flag_is_false nicely demonstrates the behavioural difference between enable_type_inference = true and false using the same module. The expectations (number vs TypeData::Unknown) are clear and give good coverage of the new flag.

If you ever refactor the internal representation of “unknown” types, this matches!(..., TypeData::Unknown) assertion might become a little brittle; if there’s a public helper such as an is_unknown* predicate, using that here would decouple the test from exact enum variants. Otherwise, this is fine as is.

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 (1)
crates/biome_service/src/settings.tests.rs (1)

279-297: Consider consolidating these tests.

These two tests combine assertions already covered by test_module_graph_resolution_kind_from_scan_kind and test_module_graph_resolution_kind_is_modules_and_types. Whilst they do make the behaviour more explicit for documentation purposes, they don't add new test coverage.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9b83964 and c1c0fee.

⛔ Files ignored due to path filters (1)
  • packages/@biomejs/backend-jsonrpc/src/workspace.ts is excluded by !**/backend-jsonrpc/src/workspace.ts and included by **
📒 Files selected for processing (1)
  • crates/biome_service/src/settings.tests.rs
🧰 Additional context used
📓 Path-based instructions (1)
**/*.rs

📄 CodeRabbit inference engine (CONTRIBUTING.md)

**/*.rs: Use inline rustdoc documentation for rules, assists, and their options
Use the dbg!() macro for debugging output in Rust tests and code
Use doc tests (doctest) format with code blocks in rustdoc comments; ensure assertions pass in tests

Files:

  • crates/biome_service/src/settings.tests.rs
🧠 Learnings (21)
📓 Common learnings
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/**/local_inference.rs : Implement local inference in dedicated modules to derive type definitions from expressions without context of surrounding scopes
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/**/scoped_resolver.rs : Implement full inference to resolve `TypeReference::Import` variants across the entire module graph
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/**/js_module_info/collector.rs : Implement module-level (thin) inference to resolve `TypeReference::Qualifier` variants by looking up declarations in module scopes and handling import statements
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.399Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Use `domains` field in `declare_lint_rule!` to tag rules that belong to specific concepts like testing or frameworks
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` variants (`Qualifier`, `Resolved`, `Import`, `Unknown`) to represent different phases of type resolution
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
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.399Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Set `language` to `jsx`, `ts`, or `tsx` for rules that only apply to specific JavaScript dialects
📚 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/**/scoped_resolver.rs : Implement full inference to resolve `TypeReference::Import` variants across the entire module graph

Applied to files:

  • crates/biome_service/src/settings.tests.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_service/src/settings.tests.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/**/js_module_info/collector.rs : Implement module-level (thin) inference to resolve `TypeReference::Qualifier` variants by looking up declarations in module scopes and handling import statements

Applied to files:

  • crates/biome_service/src/settings.tests.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` variants (`Qualifier`, `Resolved`, `Import`, `Unknown`) to represent different phases of type resolution

Applied to files:

  • crates/biome_service/src/settings.tests.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_service/src/settings.tests.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/settings.tests.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/spec_tests.rs : Use the `tests_macros::gen_tests!` macro in `spec_tests.rs` to generate test functions for each specification file matching the pattern `tests/specs/<language>/**/*.<ext>`

Applied to files:

  • crates/biome_service/src/settings.tests.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 : Distinguish between `TypeData::Unknown` and `TypeData::UnknownKeyword` to measure inference effectiveness versus explicit user-provided unknown types

Applied to files:

  • crates/biome_service/src/settings.tests.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/**/language_kind.rs : Add a new variant to `LanguageKind` enum in `language_kind.rs` file and implement all methods for the new language variant

Applied to files:

  • crates/biome_service/src/settings.tests.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/**/local_inference.rs : Implement local inference in dedicated modules to derive type definitions from expressions without context of surrounding scopes

Applied to files:

  • crates/biome_service/src/settings.tests.rs
📚 Learning: 2025-12-19T12:53:30.399Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.399Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Set `language` field in `declare_lint_rule!` macro to the language the rule primarily applies to

Applied to files:

  • crates/biome_service/src/settings.tests.rs
📚 Learning: 2025-12-19T12:53:30.399Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.399Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Use language-specific rule names if the rule is meant for a specific language only

Applied to files:

  • crates/biome_service/src/settings.tests.rs
📚 Learning: 2025-12-19T12:53:30.399Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.399Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Set `language` to `jsx`, `ts`, or `tsx` for rules that only apply to specific JavaScript dialects

Applied to files:

  • crates/biome_service/src/settings.tests.rs
📚 Learning: 2025-12-19T12:53:30.399Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.399Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Rule documentation code blocks should be ordered as language, expect_diagnostic, options/full_options/use_options, ignore, file

Applied to files:

  • crates/biome_service/src/settings.tests.rs
📚 Learning: 2025-12-19T12:53:30.399Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.399Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Use generic rule names if the rule could potentially be implemented for multiple languages

Applied to files:

  • crates/biome_service/src/settings.tests.rs
📚 Learning: 2025-12-19T12:53:30.399Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.399Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Rule documentation code blocks must have a language defined for syntax highlighting

Applied to files:

  • crates/biome_service/src/settings.tests.rs
📚 Learning: 2025-12-19T12:53:30.399Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.399Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Use `options` code block property for rule-specific configuration snippets in documentation

Applied to files:

  • crates/biome_service/src/settings.tests.rs
📚 Learning: 2025-12-19T12:53:30.399Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.399Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Lint rules should check syntax according to language specification and emit error diagnostics

Applied to files:

  • crates/biome_service/src/settings.tests.rs
📚 Learning: 2025-12-19T12:53:30.399Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.399Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Use `declare_lint_rule!` macro to declare analyzer rule types and implement the RuleMeta trait

Applied to files:

  • crates/biome_service/src/settings.tests.rs
📚 Learning: 2025-12-19T12:53:30.399Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.399Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Use `Semantic<>` query type to access semantic model information like scopes and declarations

Applied to files:

  • crates/biome_service/src/settings.tests.rs
🧬 Code graph analysis (1)
crates/biome_service/src/settings.tests.rs (1)
crates/biome_service/src/settings.rs (9)
  • from (386-394)
  • from (570-583)
  • from (676-704)
  • from (708-725)
  • from (729-751)
  • from (755-771)
  • from (775-790)
  • from (794-813)
  • is_modules_and_types (380-382)
⏰ 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). (11)
  • GitHub Check: Lint project (depot-ubuntu-24.04-arm-16)
  • GitHub Check: Lint project (depot-windows-2022)
  • GitHub Check: Test (depot-windows-2022-16)
  • GitHub Check: Check Dependencies
  • GitHub Check: Test (depot-ubuntu-24.04-arm-16)
  • GitHub Check: Documentation
  • GitHub Check: Bench (biome_module_graph)
  • GitHub Check: Bench (biome_js_analyze)
  • GitHub Check: Bench (biome_js_formatter)
  • GitHub Check: Bench (biome_js_parser)
  • GitHub Check: Bench (biome_configuration)
🔇 Additional comments (3)
crates/biome_service/src/settings.tests.rs (3)

1-5: LGTM!

The imports are correctly structured and bring in the necessary types for the new test functions.


239-269: Comprehensive coverage!

All ScanKind variants are tested and the mappings match the implementation in settings.rs.


271-277: LGTM!

The predicate test correctly validates all three ModuleGraphResolutionKind variants.

@github-actions github-actions bot added A-Formatter Area: formatter L-CSS Language: CSS L-HTML Language: HTML and super languages labels Dec 23, 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: 0

🧹 Nitpick comments (2)
crates/biome_service/src/settings.tests.rs (2)

239-269: Consider consolidating the assertions for improved readability.

The test correctly validates all ScanKind mappings, but it's rather verbose. Consider using an iterator over test cases:

🔎 More concise alternative
 #[test]
 fn test_module_graph_resolution_kind_from_scan_kind() {
-    // Test all ScanKind variants map to correct ModuleGraphResolutionKind
-    assert_eq!(
-        ModuleGraphResolutionKind::from(&ScanKind::NoScanner),
-        ModuleGraphResolutionKind::None
-    );
-
-    assert_eq!(
-        ModuleGraphResolutionKind::from(&ScanKind::KnownFiles),
-        ModuleGraphResolutionKind::None
-    );
-
-    assert_eq!(
-        ModuleGraphResolutionKind::from(&ScanKind::TargetedKnownFiles {
-            target_paths: vec![],
-            descend_from_targets: false,
-        }),
-        ModuleGraphResolutionKind::None
-    );
-
-    assert_eq!(
-        ModuleGraphResolutionKind::from(&ScanKind::Project),
-        ModuleGraphResolutionKind::Modules
-    );
-
-    assert_eq!(
-        ModuleGraphResolutionKind::from(&ScanKind::TypeAware),
-        ModuleGraphResolutionKind::ModulesAndTypes
-    );
+    let test_cases = [
+        (ScanKind::NoScanner, ModuleGraphResolutionKind::None),
+        (ScanKind::KnownFiles, ModuleGraphResolutionKind::None),
+        (ScanKind::TargetedKnownFiles { target_paths: vec![], descend_from_targets: false }, ModuleGraphResolutionKind::None),
+        (ScanKind::Project, ModuleGraphResolutionKind::Modules),
+        (ScanKind::TypeAware, ModuleGraphResolutionKind::ModulesAndTypes),
+    ];
+    
+    for (scan_kind, expected) in test_cases {
+        assert_eq!(ModuleGraphResolutionKind::from(&scan_kind), expected);
+    }
 }

279-297: Consider removing these redundant tests.

Both tests verify composite behaviour already covered by the earlier tests: test_module_graph_resolution_kind_from_scan_kind validates the conversions, and test_module_graph_resolution_kind_is_modules_and_types validates the predicate. These two tests don't add new coverage—they just exercise the same logic in combination.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 52c1711 and f6b423f.

⛔ Files ignored due to path filters (1)
  • crates/biome_configuration/tests/invalid/domains.json.snap is excluded by !**/*.snap and included by **
📒 Files selected for processing (5)
  • crates/biome_css_formatter/tests/spec_test.rs
  • crates/biome_graphql_formatter/tests/spec_test.rs
  • crates/biome_html_formatter/tests/spec_test.rs
  • crates/biome_lsp/src/session.rs
  • crates/biome_service/src/settings.tests.rs
🚧 Files skipped from review as they are similar to previous changes (1)
  • crates/biome_html_formatter/tests/spec_test.rs
🧰 Additional context used
📓 Path-based instructions (1)
**/*.rs

📄 CodeRabbit inference engine (CONTRIBUTING.md)

**/*.rs: Use inline rustdoc documentation for rules, assists, and their options
Use the dbg!() macro for debugging output in Rust tests and code
Use doc tests (doctest) format with code blocks in rustdoc comments; ensure assertions pass in tests

Files:

  • crates/biome_service/src/settings.tests.rs
  • crates/biome_lsp/src/session.rs
  • crates/biome_graphql_formatter/tests/spec_test.rs
  • crates/biome_css_formatter/tests/spec_test.rs
🧠 Learnings (25)
📓 Common learnings
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/**/scoped_resolver.rs : Implement full inference to resolve `TypeReference::Import` variants across the entire module graph
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/**/js_module_info/collector.rs : Implement module-level (thin) inference to resolve `TypeReference::Qualifier` variants by looking up declarations in module scopes and handling import statements
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.399Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Use `domains` field in `declare_lint_rule!` to tag rules that belong to specific concepts like testing or frameworks
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/**/local_inference.rs : Implement local inference in dedicated modules to derive type definitions from expressions without context of surrounding scopes
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: Design type inference with IDE support as a primary consideration to enable near-instantaneous diagnostic updates when any file changes
📚 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/**/scoped_resolver.rs : Implement full inference to resolve `TypeReference::Import` variants across the entire module graph

Applied to files:

  • crates/biome_service/src/settings.tests.rs
  • crates/biome_lsp/src/session.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_service/src/settings.tests.rs
  • crates/biome_lsp/src/session.rs
  • crates/biome_graphql_formatter/tests/spec_test.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 : Distinguish between `TypeData::Unknown` and `TypeData::UnknownKeyword` to measure inference effectiveness versus explicit user-provided unknown types

Applied to files:

  • crates/biome_service/src/settings.tests.rs
  • crates/biome_css_formatter/tests/spec_test.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/**/language_kind.rs : Add a new variant to `LanguageKind` enum in `language_kind.rs` file and implement all methods for the new language variant

Applied to files:

  • crates/biome_service/src/settings.tests.rs
  • crates/biome_css_formatter/tests/spec_test.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_service/src/settings.tests.rs
  • crates/biome_graphql_formatter/tests/spec_test.rs
  • crates/biome_css_formatter/tests/spec_test.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/spec_tests.rs : Use the `tests_macros::gen_tests!` macro in `spec_tests.rs` to generate test functions for each specification file matching the pattern `tests/specs/<language>/**/*.<ext>`

Applied to files:

  • crates/biome_service/src/settings.tests.rs
  • crates/biome_graphql_formatter/tests/spec_test.rs
  • crates/biome_css_formatter/tests/spec_test.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/**/js_module_info/collector.rs : Implement module-level (thin) inference to resolve `TypeReference::Qualifier` variants by looking up declarations in module scopes and handling import statements

Applied to files:

  • crates/biome_service/src/settings.tests.rs
📚 Learning: 2025-12-19T12:53:30.399Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.399Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Set `language` field in `declare_lint_rule!` macro to the language the rule primarily applies to

Applied to files:

  • crates/biome_service/src/settings.tests.rs
📚 Learning: 2025-12-19T12:53:30.399Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.399Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Use language-specific rule names if the rule is meant for a specific language only

Applied to files:

  • crates/biome_service/src/settings.tests.rs
📚 Learning: 2025-12-19T12:53:30.399Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.399Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Set `language` to `jsx`, `ts`, or `tsx` for rules that only apply to specific JavaScript dialects

Applied to files:

  • crates/biome_service/src/settings.tests.rs
📚 Learning: 2025-12-19T12:53:30.399Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.399Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Rule documentation code blocks should be ordered as language, expect_diagnostic, options/full_options/use_options, ignore, file

Applied to files:

  • crates/biome_service/src/settings.tests.rs
📚 Learning: 2025-12-19T12:53:30.399Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.399Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Use generic rule names if the rule could potentially be implemented for multiple languages

Applied to files:

  • crates/biome_service/src/settings.tests.rs
📚 Learning: 2025-12-19T12:53:30.399Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.399Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Rule documentation code blocks must have a language defined for syntax highlighting

Applied to files:

  • crates/biome_service/src/settings.tests.rs
📚 Learning: 2025-12-19T12:53:30.399Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.399Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Use `options` code block property for rule-specific configuration snippets in documentation

Applied to files:

  • crates/biome_service/src/settings.tests.rs
📚 Learning: 2025-12-19T12:53:30.399Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.399Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Lint rules should check syntax according to language specification and emit error diagnostics

Applied to files:

  • crates/biome_service/src/settings.tests.rs
📚 Learning: 2025-12-19T12:53:30.399Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.399Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Use `declare_lint_rule!` macro to declare analyzer rule types and implement the RuleMeta trait

Applied to files:

  • crates/biome_service/src/settings.tests.rs
📚 Learning: 2025-12-19T12:53:30.399Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.399Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Use `Semantic<>` query type to access semantic model information like scopes and declarations

Applied to files:

  • crates/biome_service/src/settings.tests.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_lsp/src/session.rs
  • crates/biome_graphql_formatter/tests/spec_test.rs
  • crates/biome_css_formatter/tests/spec_test.rs
📚 Learning: 2025-12-19T12:53:30.399Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.399Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Set `version` field to `next` in `declare_lint_rule!` macro

Applied to files:

  • crates/biome_lsp/src/session.rs
  • crates/biome_css_formatter/tests/spec_test.rs
📚 Learning: 2025-12-19T12:53:30.399Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.399Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/**/*.rs : Check if a variable is global using the semantic model to avoid false positives

Applied to files:

  • crates/biome_lsp/src/session.rs
📚 Learning: 2025-12-19T12:53:30.399Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-12-19T12:53:30.399Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/lib/**/*.rs : Wrap rule options fields in `Option<>` to properly track set and unset options during merge

Applied to files:

  • crates/biome_lsp/src/session.rs
  • crates/biome_graphql_formatter/tests/spec_test.rs
  • crates/biome_css_formatter/tests/spec_test.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_lsp/src/session.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/**/language_kind.rs : Add a new language prefix to the `LANGUAGE_PREFIXES` constant in `language_kind.rs` file

Applied to files:

  • crates/biome_css_formatter/tests/spec_test.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_css_formatter/tests/spec_test.rs
🧬 Code graph analysis (4)
crates/biome_service/src/settings.tests.rs (1)
crates/biome_service/src/settings.rs (9)
  • from (386-394)
  • from (570-583)
  • from (676-704)
  • from (708-725)
  • from (729-751)
  • from (755-771)
  • from (775-790)
  • from (794-813)
  • is_modules_and_types (380-382)
crates/biome_lsp/src/session.rs (1)
crates/biome_service/src/settings.rs (7)
  • from (386-394)
  • from (570-583)
  • from (676-704)
  • from (708-725)
  • from (729-751)
  • from (755-771)
  • from (775-790)
crates/biome_graphql_formatter/tests/spec_test.rs (1)
crates/biome_service/src/workspace.rs (2)
  • default (367-369)
  • default (693-695)
crates/biome_css_formatter/tests/spec_test.rs (1)
crates/biome_service/src/workspace.rs (2)
  • default (367-369)
  • default (693-695)
⏰ 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). (18)
  • 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: Test (depot-windows-2022-16)
  • GitHub Check: End-to-end tests
  • GitHub Check: Documentation
  • GitHub Check: Bench (biome_configuration)
  • GitHub Check: Bench (biome_js_formatter)
  • GitHub Check: Bench (biome_js_parser)
  • GitHub Check: Bench (biome_js_analyze)
  • GitHub Check: Bench (biome_graphql_formatter)
  • GitHub Check: Bench (biome_css_formatter)
  • GitHub Check: autofix
  • GitHub Check: Bench (biome_css_parser)
  • GitHub Check: Bench (biome_module_graph)
  • GitHub Check: Bench (biome_graphql_parser)
  • GitHub Check: Bench (biome_css_analyze)
🔇 Additional comments (7)
crates/biome_css_formatter/tests/spec_test.rs (1)

46-46: LGTM!

Clean addition of the new required field. Using Default::default() is sensible here since CSS formatting tests don't need type-aware module graph resolution.

crates/biome_graphql_formatter/tests/spec_test.rs (1)

46-46: LGTM!

Correctly initialises the new module_graph_resolution_kind field. Using Default::default() is appropriate for GraphQL formatter tests, as they don't require type inference.

crates/biome_service/src/settings.tests.rs (2)

1-5: LGTM!

The imports are correct and necessary for the new test functionality.


271-277: LGTM!

Clean and concise test of the predicate behaviour.

crates/biome_lsp/src/session.rs (3)

20-20: Import looks good.

Properly used on line 963 to pass module graph resolution information to workspace settings.


744-744: Correctly extends watch semantics for type-aware scanning.

The expanded condition properly enables project watching for both Project and TypeAware scan modes, ensuring the module graph stays current for type inference.


963-963: Module graph resolution kind correctly propagated to workspace settings.

The conversion via ModuleGraphResolutionKind::from(&scan_kind) properly maps scanning requirements to resolution behaviour, threading type inference decisions through the configuration layer.

@Netail
Copy link
Member

Netail commented Dec 23, 2025

Should we add package.json rules to the project domain? E.g. noDuplicateDependencies

@ematipico
Copy link
Member Author

Should we add package.json rules to the project domain? E.g. noDuplicateDependencies

Does it use the module graph?

Just to note, the use of these two domains is strictly related to the use of internal services. Project rules must use the module graph. If they don't use the module graph, they shouldn't be part of the domain

@Netail
Copy link
Member

Netail commented Dec 24, 2025

Should we add package.json rules to the project domain? E.g. noDuplicateDependencies

Does it use the module graph?

Just to note, the use of these two domains is strictly related to the use of internal services. Project rules must use the module graph. If they don't use the module graph, they shouldn't be part of the domain

Ahhh okay. No it does not

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-CLI Area: CLI A-Formatter Area: formatter A-Linter Area: linter A-LSP Area: language server protocol A-Project Area: project L-CSS Language: CSS L-HTML Language: HTML and super languages L-JavaScript Language: JavaScript and super languages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants