-
-
Notifications
You must be signed in to change notification settings - Fork 791
feat(lint): types domain and optional inference #8564
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: next
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: f6b423f The changes in this PR will be included in the next version bump. This PR includes changesets to release 14 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
CodSpeed Performance ReportMerging #8564 will not alter performanceComparing Summary
Footnotes
|
WalkthroughAdds 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
Pre-merge checks and finishing touches✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 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, iffind_project_for_pathreturnsNonefor 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![]);withcontinue;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 inunload_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
truefor the newenable_type_inferenceparameter. 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: falseto 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 ofis_project()The
TypeAwarevariant, its inclusion inclone_without_targeting_info, and the newis_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 treatTypeAwareas project‑like. If that’s the intent everywhere, it might be worth updatingis_projectto 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 reasonablePlumbing
module_graph_resolution_kind: ModuleGraphResolutionKind::ModulesAndTypesintoUpdateSettingsParamsin 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, mirroringModuleGraphResolutionKind::None/Modulesthere 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 consistentAll the updated
update_graph_for_js_pathscalls now passtruefor the newenable_type_inferenceflag, 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_falsenicely demonstrates the behavioural difference betweenenable_type_inference = trueandfalseusing the same module. The expectations (number vsTypeData::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 anis_unknown*predicate, using that here would decouple the test from exact enum variants. Otherwise, this is fine as is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (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_kindandtest_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
⛔ Files ignored due to path filters (1)
packages/@biomejs/backend-jsonrpc/src/workspace.tsis excluded by!**/backend-jsonrpc/src/workspace.tsand 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 thedbg!()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
ScanKindvariants are tested and the mappings match the implementation insettings.rs.
271-277: LGTM!The predicate test correctly validates all three
ModuleGraphResolutionKindvariants.
52c1711 to
f6b423f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 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_kindvalidates the conversions, andtest_module_graph_resolution_kind_is_modules_and_typesvalidates 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
⛔ Files ignored due to path filters (1)
crates/biome_configuration/tests/invalid/domains.json.snapis excluded by!**/*.snapand included by**
📒 Files selected for processing (5)
crates/biome_css_formatter/tests/spec_test.rscrates/biome_graphql_formatter/tests/spec_test.rscrates/biome_html_formatter/tests/spec_test.rscrates/biome_lsp/src/session.rscrates/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 thedbg!()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.rscrates/biome_lsp/src/session.rscrates/biome_graphql_formatter/tests/spec_test.rscrates/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.rscrates/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.rscrates/biome_lsp/src/session.rscrates/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.rscrates/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.rscrates/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.rscrates/biome_graphql_formatter/tests/spec_test.rscrates/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.rscrates/biome_graphql_formatter/tests/spec_test.rscrates/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.rscrates/biome_graphql_formatter/tests/spec_test.rscrates/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.rscrates/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.rscrates/biome_graphql_formatter/tests/spec_test.rscrates/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_kindfield. UsingDefault::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
ProjectandTypeAwarescan 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.
|
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 |
Summary
This PR makes the type inference optional inside the module graph, and creates a new
Typesdomain. 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_typeflag. This flag is saved insideSettings.Test Plan
The majority of the tests were added using AI.
Docs
TODO