Skip to content

Conversation

@ematipico
Copy link
Member

Summary

Follow up of #8327

This PR piggy-backs the new document service refactor, and adds CSS to the module graph.

I refactored the module graph this way:

  • Storing and deleting of paths now happen in two different functions. Like this, it's more flexible and we aren't bound to have different roots
  • The new function update_graph_for_css_paths how accepts a service that is pulled from the document services (see related PR)
  • Updated the current data structure to fit the new generic design

Test Plan

Added a new test, updated the existing tests.

Docs

No changeset needed, the new functionality isn't exposed yet to the users.

@changeset-bot
Copy link

changeset-bot bot commented Dec 1, 2025

⚠️ No Changeset found

Latest commit: 4709448

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

This PR includes no changesets

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

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

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

@github-actions github-actions bot added A-Core Area: core A-Project Area: project A-Linter Area: linter A-Parser Area: parser A-LSP Area: language server protocol L-JavaScript Language: JavaScript and super languages L-CSS Language: CSS labels Dec 1, 2025
@ematipico ematipico force-pushed the refactor/document-services branch from 5c447eb to 65bff06 Compare December 1, 2025 09:45
@ematipico ematipico changed the title refactor: document services feat(graph): support CSS files Dec 1, 2025
Base automatically changed from refactor/document-services to main December 4, 2025 08:19
@ematipico ematipico force-pushed the feat/css-module-graph branch from 6cc0fdb to e743ec3 Compare December 4, 2025 08:58
@codspeed-hq
Copy link

codspeed-hq bot commented Dec 4, 2025

CodSpeed Performance Report

Merging #8329 will not alter performance

Comparing feat/css-module-graph (4709448) with main (b988274)

Summary

✅ 58 untouched
⏩ 95 skipped1

Footnotes

  1. 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.

@github-actions
Copy link
Contributor

github-actions bot commented Dec 4, 2025

Parser conformance results on

js/262

Test result main count This PR count Difference
Total 52432 52432 0
Passed 51219 51219 0
Failed 1171 1171 0
Panics 42 42 0
Coverage 97.69% 97.69% 0.00%

jsx/babel

Test result main count This PR count Difference
Total 40 40 0
Passed 37 37 0
Failed 3 3 0
Panics 0 0 0
Coverage 92.50% 92.50% 0.00%

symbols/microsoft

Test result main count This PR count Difference
Total 6327 6327 0
Passed 2108 2108 0
Failed 4219 4219 0
Panics 0 0 0
Coverage 33.32% 33.32% 0.00%

ts/babel

Test result main count This PR count Difference
Total 835 835 0
Passed 742 742 0
Failed 93 93 0
Panics 0 0 0
Coverage 88.86% 88.86% 0.00%

ts/microsoft

Test result main count This PR count Difference
Total 18827 18827 0
Passed 14073 14073 0
Failed 4753 4753 0
Panics 1 1 0
Coverage 74.75% 74.75% 0.00%

@ematipico ematipico force-pushed the feat/css-module-graph branch from e743ec3 to 15916d5 Compare December 4, 2025 09:04
@ematipico ematipico marked this pull request as ready for review December 4, 2025 10:05
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 4, 2025

Walkthrough

This change introduces CSS module import support to Biome's module graph infrastructure. The refactoring adds a ModuleInfo enum to distinguish between JavaScript and CSS modules, replacing the previous JavaScript-only storage model. New CSS-specific types (CssModuleInfo, CssImports, CssImport) and a visitor implementation enable parsing of CSS imports. The module graph now stores and resolves both JS and CSS modules, with corresponding updates to public APIs for module lookup and symbol resolution. Test fixtures and utilities are added to validate CSS import resolution.

Suggested reviewers

  • arendjr
  • dyc3

Pre-merge checks and finishing touches

✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat(graph): support CSS files' accurately captures the main objective of this PR, which adds CSS support to the module graph.
Description check ✅ Passed The description clearly relates to the changeset, explaining the motivation (following up on a prior PR), the refactoring approach, and confirming tests were added and existing ones updated.
✨ 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/css-module-graph

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: 4

♻️ Duplicate comments (1)
crates/biome_service/src/scanner/workspace_watcher_bridge.tests.rs (1)

115-119: Same ModuleInfo access pattern as above

This block mirrors the earlier assertion; comments about as_js_module_info().unwrap() and the expected JS-only path apply here too.

🧹 Nitpick comments (11)
crates/biome_ruledoc_utils/src/lib.rs (1)

82-85: Call updated to new update_graph_for_js_paths signature

Adjusting to module_graph.update_graph_for_js_paths(&fs, &layout, &added_paths); matches the new API and keeps the ruledoc builder JS-focused. When/if you start documenting CSS rules via this path, you can mirror this with update_graph_for_css_paths as well, but that’s strictly a future enhancement.

crates/biome_js_analyze/src/services/module_graph.rs (1)

19-21: Service now uses JS-specific graph accessor

module_info_for_path delegating to js_module_info_for_path is consistent with this being a JS-only service wrapper around the shared graph. You might eventually consider renaming the method to js_module_info_for_path for clarity, but that’s purely cosmetic.

crates/biome_module_graph/src/js_module_info.rs (1)

60-66: API rename clarifies JS scope; consider a deprecated alias

Renaming to find_js_exported_symbol matches the JS-only nature of this API and the surrounding naming, while keeping the behaviour identical. If you expect external crates to depend on biome_module_graph, a thin #[deprecated] alias under the old name could smooth over any semver bumps.

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

236-256: New get_css_added_paths helper mirrors the JS version

The CSS helper cleanly parallels get_added_paths: it reads from the abstract FileSystem, parses CSS, asserts no diagnostics, and returns (BiomePath, CssRoot) pairs, which is exactly what the new CSS graph tests need. If duplication with the JS helper ever gets annoying, a tiny generic “parse with diagnostics assert” helper could deduplicate the pattern, but it’s fine as-is.

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

3841-3845: Consider adding an assertion before the unwrap.

Whilst panics are acceptable in tests, you could make failures clearer:

.map(|module_info| {
    let js_info = module_info.as_js_module_info()
        .expect("Expected JS module info for .js file");
    js_info.static_import_paths.clone()
})

This provides better context if the test fails unexpectedly.

Also applies to: 3872-3876

crates/biome_css_syntax/src/import_ext.rs (1)

5-12: Complete the documentation example.

The doc comment includes an empty example block. Either provide a meaningful example or remove the section:

/// Returns the inner text of the import specifier.
///
/// # Examples
///
/// ```
/// use biome_css_parser::parse_css;
/// use biome_css_syntax::CssFileSource;
/// // Example: "@import 'style.css';" -> "style.css"
/// ```

Or simply remove the empty ## Examples section if examples aren't needed yet.

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

544-564: New helper get_parse_and_services looks good.

Clean extraction of parse and services from the document. One minor note: on line 560, you're cloning syntax and services even though you already have ownership after the .cloned() on line 554. The second .clone() calls are redundant.

             Ok(syntax) => match syntax {
                 None => Err(WorkspaceError::not_found()),
-                Some(syntax) => Ok((syntax.clone(), services.clone())),
+                Some(syntax) => Ok((syntax, services)),
             },
crates/biome_module_graph/src/css_module_info/visitor.rs (2)

7-7: Unused import.

std::ops::DerefMut is imported but not directly used. The DerefMut trait is auto-imported when you call .deref_mut() on a type that implements it.

-use std::ops::DerefMut;

54-61: Simplify insertion.

Since CssImports implements DerefMut, you can call insert directly without the explicit .deref_mut().

-        imports.deref_mut().insert(
+        imports.insert(
             text.clone(),
             CssImport {
                 specifier: text,
                 resolved_path,
             },
         );
crates/biome_module_graph/src/module_graph.rs (2)

163-176: Consider adding an accessor method for CSS imports.

Accessing module.0.imports directly exposes the internal structure. Adding an imports() accessor to CssModuleInfo (similar to how JsModuleInfo exposes its data) would improve encapsulation.

-            for (_, path) in module.0.imports.deref() {
+            for (_, path) in module.imports() {

This would require adding an imports() method to CssModuleInfo:

pub fn imports(&self) -> &CssImports {
    &self.0.imports
}

281-295: Consider explicit pattern matching for future-proofing.

Using _ => None works but explicit matching would catch any future enum variants at compile time.

     pub fn as_js_module_info(&self) -> Option<&SerializedJsModuleInfo> {
         match self {
             Self::Js(module) => Some(module),
-            _ => None,
+            Self::Css(_) => None,
         }
     }

     pub fn as_css_module_info(&self) -> Option<&SerializedCssModuleInfo> {
         match self {
             Self::Css(module) => Some(module),
-            _ => None,
+            Self::Js(_) => None,
         }
     }
📜 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 b988274 and 4709448.

⛔ Files ignored due to path filters (3)
  • Cargo.lock is excluded by !**/*.lock and included by **
  • crates/biome_service/src/snapshots/biome_service__workspace__tests__debug_module_graph.snap is excluded by !**/*.snap 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 (28)
  • crates/biome_css_syntax/src/import_ext.rs (1 hunks)
  • crates/biome_css_syntax/src/lib.rs (1 hunks)
  • crates/biome_js_analyze/src/lib.rs (1 hunks)
  • crates/biome_js_analyze/src/lint/nursery/no_deprecated_imports.rs (1 hunks)
  • crates/biome_js_analyze/src/lint/nursery/no_unresolved_imports.rs (1 hunks)
  • crates/biome_js_analyze/src/services/module_graph.rs (1 hunks)
  • crates/biome_lsp/src/server.tests.rs (2 hunks)
  • crates/biome_module_graph/Cargo.toml (1 hunks)
  • crates/biome_module_graph/benches/module_graph.rs (0 hunks)
  • crates/biome_module_graph/src/css_module_info.rs (1 hunks)
  • crates/biome_module_graph/src/css_module_info/visitor.rs (1 hunks)
  • crates/biome_module_graph/src/js_module_info.rs (1 hunks)
  • crates/biome_module_graph/src/js_module_info/module_resolver.rs (1 hunks)
  • crates/biome_module_graph/src/lib.rs (2 hunks)
  • crates/biome_module_graph/src/module_graph.rs (7 hunks)
  • crates/biome_module_graph/tests/fixtures/css/index.css (1 hunks)
  • crates/biome_module_graph/tests/fixtures/css/package.json (1 hunks)
  • crates/biome_module_graph/tests/snap/mod.rs (2 hunks)
  • crates/biome_module_graph/tests/spec_tests.rs (41 hunks)
  • crates/biome_rowan/src/syntax/node.rs (1 hunks)
  • crates/biome_ruledoc_utils/src/lib.rs (1 hunks)
  • crates/biome_service/src/file_handlers/javascript.rs (1 hunks)
  • crates/biome_service/src/scanner/workspace_watcher_bridge.tests.rs (2 hunks)
  • crates/biome_service/src/workspace.rs (2 hunks)
  • crates/biome_service/src/workspace.tests.rs (1 hunks)
  • crates/biome_service/src/workspace/server.rs (12 hunks)
  • crates/biome_test_utils/Cargo.toml (1 hunks)
  • crates/biome_test_utils/src/lib.rs (3 hunks)
💤 Files with no reviewable changes (1)
  • crates/biome_module_graph/benches/module_graph.rs
🧰 Additional context used
📓 Path-based instructions (4)
**/*.rs

📄 CodeRabbit inference engine (CONTRIBUTING.md)

**/*.rs: Use the dbg!() macro for debugging output during testing, and pass the --show-output flag to cargo to view debug output
Use cargo t or cargo test to run tests; for a single test, pass the test name after the test command
Use snapshot testing with the insta crate; run cargo insta accept, cargo insta reject, or cargo insta review to manage snapshot changes
Write doctests as doc comments with code blocks; the code inside code blocks will be run during the testing phase
Use just f (alias for just format) to format Rust and TOML files before committing

Files:

  • crates/biome_css_syntax/src/lib.rs
  • crates/biome_js_analyze/src/lint/nursery/no_deprecated_imports.rs
  • crates/biome_service/src/scanner/workspace_watcher_bridge.tests.rs
  • crates/biome_service/src/workspace.rs
  • crates/biome_service/src/file_handlers/javascript.rs
  • crates/biome_ruledoc_utils/src/lib.rs
  • crates/biome_module_graph/src/js_module_info.rs
  • crates/biome_css_syntax/src/import_ext.rs
  • crates/biome_js_analyze/src/services/module_graph.rs
  • crates/biome_js_analyze/src/lint/nursery/no_unresolved_imports.rs
  • crates/biome_rowan/src/syntax/node.rs
  • crates/biome_lsp/src/server.tests.rs
  • crates/biome_js_analyze/src/lib.rs
  • crates/biome_module_graph/src/css_module_info.rs
  • crates/biome_service/src/workspace/server.rs
  • crates/biome_module_graph/src/css_module_info/visitor.rs
  • crates/biome_module_graph/tests/snap/mod.rs
  • crates/biome_module_graph/src/lib.rs
  • crates/biome_test_utils/src/lib.rs
  • crates/biome_module_graph/src/js_module_info/module_resolver.rs
  • crates/biome_service/src/workspace.tests.rs
  • crates/biome_module_graph/tests/spec_tests.rs
  • crates/biome_module_graph/src/module_graph.rs
crates/biome_service/src/workspace*.rs

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

Implement the Workspace trait in the Biome Service to manage internal state of projects, including open documents, project layout instances, and module graph instances

Files:

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

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

Use WorkspaceServer implementation for maintaining workspace state in daemon mode and CLI daemonless mode

Files:

  • crates/biome_service/src/workspace/server.rs
**/*.toml

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Use just f (alias for just format) to format TOML files before committing

Files:

  • crates/biome_test_utils/Cargo.toml
  • crates/biome_module_graph/Cargo.toml
🧠 Learnings (59)
📓 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
📚 Learning: 2025-11-24T18:05:20.371Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:20.371Z
Learning: Applies to crates/biome_formatter/**/biome_*_formatter/Cargo.toml : Include development dependencies in `Cargo.toml` for formatter tests: `biome_formatter_test`, `biome_<language>_factory`, `biome_<language>_parser`, `biome_parser`, `biome_service`, `countme`, `iai`, `quickcheck`, `quickcheck_macros`, and `tests_macros`

Applied to files:

  • crates/biome_css_syntax/src/lib.rs
  • crates/biome_test_utils/Cargo.toml
  • crates/biome_test_utils/src/lib.rs
  • crates/biome_module_graph/Cargo.toml
  • crates/biome_module_graph/tests/spec_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: Create two new crates `biome_{language}_syntax` and `biome_{language}_factory` using `cargo new --lib` for new language parsers

Applied to files:

  • crates/biome_css_syntax/src/lib.rs
  • crates/biome_test_utils/Cargo.toml
  • crates/biome_module_graph/Cargo.toml
📚 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_css_syntax/src/lib.rs
  • crates/biome_js_analyze/src/lint/nursery/no_deprecated_imports.rs
  • crates/biome_service/src/scanner/workspace_watcher_bridge.tests.rs
  • crates/biome_service/src/workspace.rs
  • crates/biome_service/src/file_handlers/javascript.rs
  • crates/biome_ruledoc_utils/src/lib.rs
  • crates/biome_css_syntax/src/import_ext.rs
  • crates/biome_js_analyze/src/services/module_graph.rs
  • crates/biome_js_analyze/src/lint/nursery/no_unresolved_imports.rs
  • crates/biome_lsp/src/server.tests.rs
  • crates/biome_js_analyze/src/lib.rs
  • crates/biome_module_graph/src/css_module_info.rs
  • crates/biome_module_graph/src/css_module_info/visitor.rs
  • crates/biome_module_graph/tests/snap/mod.rs
  • crates/biome_module_graph/src/lib.rs
  • crates/biome_module_graph/src/js_module_info/module_resolver.rs
  • crates/biome_service/src/workspace.tests.rs
  • crates/biome_module_graph/tests/spec_tests.rs
  • crates/biome_module_graph/src/module_graph.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 : No module may copy or clone data from another module in the module graph, not even behind an `Arc`

Applied to files:

  • crates/biome_css_syntax/src/lib.rs
  • crates/biome_js_analyze/src/lint/nursery/no_deprecated_imports.rs
  • crates/biome_service/src/scanner/workspace_watcher_bridge.tests.rs
  • crates/biome_service/src/workspace.rs
  • crates/biome_ruledoc_utils/src/lib.rs
  • crates/biome_js_analyze/src/services/module_graph.rs
  • crates/biome_lsp/src/server.tests.rs
  • crates/biome_js_analyze/src/lib.rs
  • crates/biome_module_graph/src/css_module_info.rs
  • crates/biome_module_graph/tests/snap/mod.rs
  • crates/biome_module_graph/src/lib.rs
  • crates/biome_module_graph/Cargo.toml
  • crates/biome_module_graph/src/js_module_info/module_resolver.rs
  • crates/biome_service/src/workspace.tests.rs
  • crates/biome_module_graph/tests/spec_tests.rs
  • crates/biome_module_graph/src/module_graph.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_css_syntax/src/lib.rs
  • crates/biome_service/src/workspace.rs
  • crates/biome_service/src/file_handlers/javascript.rs
  • crates/biome_ruledoc_utils/src/lib.rs
  • crates/biome_js_analyze/src/services/module_graph.rs
  • crates/biome_lsp/src/server.tests.rs
  • crates/biome_js_analyze/src/lib.rs
  • crates/biome_module_graph/src/css_module_info.rs
  • crates/biome_module_graph/tests/snap/mod.rs
  • crates/biome_module_graph/src/lib.rs
  • crates/biome_module_graph/src/js_module_info/module_resolver.rs
  • crates/biome_service/src/workspace.tests.rs
  • crates/biome_module_graph/src/module_graph.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_syntax/src/lib.rs
  • crates/biome_service/src/workspace/server.rs
  • crates/biome_test_utils/Cargo.toml
📚 Learning: 2025-11-24T18:05:42.356Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.356Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : Use `TypeReference` instead of `Arc` for types that reference other types to avoid stale cache issues when modules are replaced

Applied to files:

  • crates/biome_css_syntax/src/lib.rs
  • crates/biome_js_analyze/src/lint/nursery/no_deprecated_imports.rs
  • crates/biome_service/src/scanner/workspace_watcher_bridge.tests.rs
  • crates/biome_service/src/workspace.rs
  • crates/biome_service/src/file_handlers/javascript.rs
  • crates/biome_ruledoc_utils/src/lib.rs
  • crates/biome_module_graph/src/js_module_info.rs
  • crates/biome_js_analyze/src/services/module_graph.rs
  • crates/biome_js_analyze/src/lint/nursery/no_unresolved_imports.rs
  • crates/biome_lsp/src/server.tests.rs
  • crates/biome_js_analyze/src/lib.rs
  • crates/biome_module_graph/src/css_module_info.rs
  • crates/biome_test_utils/Cargo.toml
  • crates/biome_module_graph/tests/snap/mod.rs
  • crates/biome_module_graph/src/lib.rs
  • crates/biome_module_graph/Cargo.toml
  • crates/biome_module_graph/src/js_module_info/module_resolver.rs
  • crates/biome_service/src/workspace.tests.rs
  • crates/biome_module_graph/tests/spec_tests.rs
  • crates/biome_module_graph/src/module_graph.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/src/**/*.rs : Implement the `Merge` trait for rule options to define how options from extended configuration merge with user configuration (usually reset instead of extend)

Applied to files:

  • crates/biome_css_syntax/src/lib.rs
  • crates/biome_test_utils/Cargo.toml
📚 Learning: 2025-11-28T09:08:10.091Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-11-28T09:08:10.091Z
Learning: Internal crate changes that don't affect user-facing behavior do not require changesets; changesets are only for user-facing changes

Applied to files:

  • crates/biome_css_syntax/src/lib.rs
  • crates/biome_service/src/scanner/workspace_watcher_bridge.tests.rs
  • crates/biome_ruledoc_utils/src/lib.rs
  • crates/biome_module_graph/Cargo.toml
📚 Learning: 2025-11-24T18:05:20.371Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:20.371Z
Learning: Applies to crates/biome_formatter/**/biome_*_formatter/src/context.rs : Define `<Language>FormatContext` struct in a `context.rs` file containing `comments` and `source_map` fields, implementing `FormatContext` and `CstFormatContext` traits

Applied to files:

  • crates/biome_css_syntax/src/lib.rs
  • crates/biome_service/src/workspace.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Deprecate rules by adding a `deprecated` field to the `declare_lint_rule!` macro with a message explaining the reason for deprecation (e.g., 'Use the rule noAnotherVar')

Applied to files:

  • crates/biome_js_analyze/src/lint/nursery/no_deprecated_imports.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_js_analyze/src/lint/nursery/no_deprecated_imports.rs
  • crates/biome_service/src/scanner/workspace_watcher_bridge.tests.rs
  • crates/biome_service/src/workspace.rs
  • crates/biome_service/src/file_handlers/javascript.rs
  • crates/biome_ruledoc_utils/src/lib.rs
  • crates/biome_module_graph/src/js_module_info.rs
  • crates/biome_js_analyze/src/services/module_graph.rs
  • crates/biome_js_analyze/src/lint/nursery/no_unresolved_imports.rs
  • crates/biome_lsp/src/server.tests.rs
  • crates/biome_js_analyze/src/lib.rs
  • crates/biome_module_graph/src/css_module_info.rs
  • crates/biome_module_graph/src/css_module_info/visitor.rs
  • crates/biome_module_graph/tests/snap/mod.rs
  • crates/biome_module_graph/src/lib.rs
  • crates/biome_module_graph/src/js_module_info/module_resolver.rs
  • crates/biome_service/src/workspace.tests.rs
  • crates/biome_module_graph/tests/spec_tests.rs
  • crates/biome_module_graph/src/module_graph.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noUnused` prefix for rules that report unused entities (e.g., `noUnusedVariables`)

Applied to files:

  • crates/biome_js_analyze/src/lint/nursery/no_deprecated_imports.rs
  • crates/biome_js_analyze/src/lint/nursery/no_unresolved_imports.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Check if a variable is global before banning it to avoid false positives when the variable is redeclared in local scope; use the semantic model to verify global scope

Applied to files:

  • crates/biome_js_analyze/src/lint/nursery/no_deprecated_imports.rs
  • crates/biome_js_analyze/src/lint/nursery/no_unresolved_imports.rs
  • crates/biome_lsp/src/server.tests.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noUndeclared` prefix for rules that report undefined entities (e.g., `noUndeclaredVariables`)

Applied to files:

  • crates/biome_js_analyze/src/lint/nursery/no_deprecated_imports.rs
  • crates/biome_js_analyze/src/lint/nursery/no_unresolved_imports.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noRedundant` prefix for rules that report redundant code (e.g., `noRedundantUseStrict`)

Applied to files:

  • crates/biome_js_analyze/src/lint/nursery/no_deprecated_imports.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/nursery/**/*.rs : New rules must be placed inside the `nursery` group as an incubation space exempt from semantic versioning, with promotion to appropriate groups done during minor/major releases

Applied to files:

  • crates/biome_js_analyze/src/lint/nursery/no_deprecated_imports.rs
  • crates/biome_js_analyze/src/lint/nursery/no_unresolved_imports.rs
  • crates/biome_module_graph/Cargo.toml
📚 Learning: 2025-11-24T18:06:12.048Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_service/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:12.048Z
Learning: Applies to crates/biome_service/src/workspace/watcher.tests.rs : Implement watcher tests for workspace methods in watcher.tests.rs and end-to-end tests in LSP tests

Applied to files:

  • crates/biome_service/src/scanner/workspace_watcher_bridge.tests.rs
  • crates/biome_service/src/workspace.rs
  • crates/biome_lsp/src/server.tests.rs
  • crates/biome_service/src/workspace/server.rs
  • crates/biome_test_utils/Cargo.toml
  • crates/biome_test_utils/src/lib.rs
  • crates/biome_module_graph/Cargo.toml
  • crates/biome_service/src/workspace.tests.rs
  • crates/biome_module_graph/tests/spec_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_service/src/scanner/workspace_watcher_bridge.tests.rs
  • crates/biome_service/src/workspace.rs
  • crates/biome_js_analyze/src/services/module_graph.rs
  • crates/biome_service/src/workspace/server.rs
  • crates/biome_test_utils/Cargo.toml
  • crates/biome_test_utils/src/lib.rs
  • crates/biome_module_graph/Cargo.toml
  • crates/biome_service/src/workspace.tests.rs
  • crates/biome_module_graph/src/module_graph.rs
📚 Learning: 2025-11-24T18:05:42.356Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.356Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : Store type data in linear vectors instead of using recursive data structures with `Arc` for improved data locality and performance

Applied to files:

  • crates/biome_service/src/scanner/workspace_watcher_bridge.tests.rs
  • crates/biome_service/src/workspace.rs
  • crates/biome_service/src/file_handlers/javascript.rs
  • crates/biome_ruledoc_utils/src/lib.rs
  • crates/biome_js_analyze/src/services/module_graph.rs
  • crates/biome_js_analyze/src/lib.rs
  • crates/biome_module_graph/src/css_module_info.rs
  • crates/biome_test_utils/Cargo.toml
  • crates/biome_module_graph/tests/snap/mod.rs
  • crates/biome_module_graph/Cargo.toml
  • crates/biome_module_graph/src/js_module_info/module_resolver.rs
  • crates/biome_service/src/workspace.tests.rs
  • crates/biome_module_graph/src/module_graph.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/scanner/workspace_watcher_bridge.tests.rs
  • crates/biome_service/src/file_handlers/javascript.rs
  • crates/biome_js_analyze/src/lint/nursery/no_unresolved_imports.rs
  • crates/biome_lsp/src/server.tests.rs
  • crates/biome_module_graph/tests/snap/mod.rs
  • crates/biome_module_graph/src/module_graph.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 : Always apply the correct `ResolverId` when retrieving raw type data from `ResolvedTypeData.as_raw_data()` to prevent panics during subsequent resolution calls

Applied to files:

  • crates/biome_service/src/scanner/workspace_watcher_bridge.tests.rs
  • crates/biome_service/src/workspace.rs
  • crates/biome_service/src/file_handlers/javascript.rs
  • crates/biome_lsp/src/server.tests.rs
  • crates/biome_js_analyze/src/lib.rs
  • crates/biome_module_graph/src/js_module_info/module_resolver.rs
  • crates/biome_service/src/workspace.tests.rs
📚 Learning: 2025-08-20T16:24:59.781Z
Learnt from: arendjr
Repo: biomejs/biome PR: 7266
File: crates/biome_js_type_info/src/type.rs:94-102
Timestamp: 2025-08-20T16:24:59.781Z
Learning: In crates/biome_js_type_info/src/type.rs, the flattened_union_variants() method returns TypeReference instances that already have the correct module IDs applied to them. These references should be used directly with resolver.resolve_reference() without applying additional module ID transformations, as variant references may originate from nested unions in different modules.

Applied to files:

  • crates/biome_service/src/workspace.rs
  • crates/biome_js_analyze/src/services/module_graph.rs
  • crates/biome_js_analyze/src/lib.rs
  • crates/biome_module_graph/src/css_module_info.rs
  • crates/biome_module_graph/tests/snap/mod.rs
  • crates/biome_module_graph/src/lib.rs
  • crates/biome_module_graph/src/js_module_info/module_resolver.rs
  • crates/biome_service/src/workspace.tests.rs
  • crates/biome_module_graph/src/module_graph.rs
📚 Learning: 2025-11-24T18:04:57.309Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_diagnostics/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:57.309Z
Learning: Applies to crates/biome_diagnostics/**/*.rs : Use helper types from the biome_diagnostics::v2 module (CodeFrameAdvice, CommandAdvice, DiffAdvice, LogAdvice) or implement the Advices trait yourself for custom advice handling

Applied to files:

  • crates/biome_service/src/workspace.rs
  • crates/biome_service/src/workspace/server.rs
  • crates/biome_test_utils/Cargo.toml
  • crates/biome_module_graph/tests/snap/mod.rs
  • crates/biome_module_graph/src/lib.rs
  • crates/biome_module_graph/Cargo.toml
📚 Learning: 2025-11-24T18:05:27.810Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:27.810Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : Import the `FormatNode` trait and implement it for your Node when creating formatters in biome_js_formatter

Applied to files:

  • crates/biome_service/src/workspace.rs
  • crates/biome_service/src/workspace/server.rs
  • crates/biome_module_graph/tests/snap/mod.rs
  • crates/biome_module_graph/src/lib.rs
  • crates/biome_module_graph/Cargo.toml
  • crates/biome_module_graph/tests/spec_tests.rs
  • crates/biome_module_graph/src/module_graph.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/workspace.rs
  • crates/biome_service/src/file_handlers/javascript.rs
  • crates/biome_js_analyze/src/lint/nursery/no_unresolved_imports.rs
  • crates/biome_js_analyze/src/lib.rs
  • crates/biome_module_graph/src/css_module_info.rs
  • crates/biome_module_graph/tests/snap/mod.rs
  • crates/biome_module_graph/src/lib.rs
  • crates/biome_module_graph/src/js_module_info/module_resolver.rs
  • crates/biome_module_graph/src/module_graph.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 `TypeData::Unknown` to indicate when type inference falls short or is not implemented

Applied to files:

  • crates/biome_service/src/file_handlers/javascript.rs
📚 Learning: 2025-11-24T18:05:42.356Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.356Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : When using `ResolvedTypeData`, track the `ResolverId` to ensure subsequent resolver calls use the correct context

Applied to files:

  • crates/biome_service/src/file_handlers/javascript.rs
  • crates/biome_js_analyze/src/lib.rs
  • crates/biome_module_graph/src/js_module_info/module_resolver.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/tests/specs/**/*.jsonc : Use `.jsonc` files in test specs with code snippets as array of strings to test rules in script environment (no import/export syntax)

Applied to files:

  • crates/biome_module_graph/tests/fixtures/css/index.css
  • crates/biome_module_graph/tests/fixtures/css/package.json
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/tests/specs/**/*.{js,ts,tsx,jsx,json,css} : Test rules using snapshot tests via the `insta` library with test cases in `tests/specs/<group>/<rule_name>/` directories prefixed by `invalid` or `valid`

Applied to files:

  • crates/biome_module_graph/tests/fixtures/css/index.css
📚 Learning: 2025-11-24T18:05:27.810Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:27.810Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : Do not attempt to 'fix' the code; if a token/node is known to be mandatory but is missing, return `None` instead

Applied to files:

  • crates/biome_ruledoc_utils/src/lib.rs
  • crates/biome_module_graph/tests/snap/mod.rs
  • crates/biome_module_graph/tests/spec_tests.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/src/**/*.rs : Use `Box<[T]>` instead of `Vec<T>` for rule options array fields to save memory (boxed slices and boxed str use 2 words instead of three words)

Applied to files:

  • crates/biome_ruledoc_utils/src/lib.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/src/**/*.rs : Wrap optional rule option fields in `Option<_>` to properly track set vs unset options during configuration merging

Applied to files:

  • crates/biome_ruledoc_utils/src/lib.rs
  • crates/biome_service/src/workspace/server.rs
📚 Learning: 2025-11-24T18:06:03.545Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:03.545Z
Learning: Applies to crates/biome_parser/**/src/**/*.rs : Implement a token source struct that wraps the lexer and implements `TokenSourceWithBufferedLexer` and `LexerWithCheckpoint` for lookahead and re-lexing capabilities

Applied to files:

  • crates/biome_css_syntax/src/import_ext.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Avoid unnecessary string allocations by comparing against `&str` or `TokenText` instead of calling `to_string()` which allocates heap memory

Applied to files:

  • crates/biome_css_syntax/src/import_ext.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_css_syntax/src/import_ext.rs
  • crates/biome_rowan/src/syntax/node.rs
  • crates/biome_service/src/workspace/server.rs
📚 Learning: 2025-11-24T18:05:27.810Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:27.810Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : When formatting AST nodes, use mandatory tokens from the AST instead of hardcoding token strings (e.g., use `node.l_paren_token().format()` instead of `token("(")`)

Applied to files:

  • crates/biome_css_syntax/src/import_ext.rs
  • crates/biome_module_graph/tests/snap/mod.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Use the `noUnknown` prefix for rules that report mistyped entities in CSS (e.g., `noUnknownUnit`)

Applied to files:

  • crates/biome_js_analyze/src/lint/nursery/no_unresolved_imports.rs
  • crates/biome_module_graph/src/css_module_info/visitor.rs
📚 Learning: 2025-11-24T18:05:20.371Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:20.371Z
Learning: Applies to crates/biome_formatter/**/biome_*_formatter/src/lib.rs : Expose a public `format_node` function that accepts formatting options and a root syntax node, returning a `FormatResult<Formatted<Context>>` with appropriate documentation

Applied to files:

  • crates/biome_rowan/src/syntax/node.rs
  • crates/biome_module_graph/tests/snap/mod.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Avoid using `unwrap()` or `expect()` on `Result` and `Option` types; instead use helper functions like `map`, `filter`, `and_then` to maintain code clarity and avoid panics

Applied to files:

  • crates/biome_lsp/src/server.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/specs/**/options.json : Create an `options.json` file (formatted as `biome.json`) in test specification folders to apply non-default formatting options to all test files in that folder

Applied to files:

  • crates/biome_module_graph/tests/fixtures/css/package.json
📚 Learning: 2025-08-05T14:43:29.581Z
Learnt from: dyc3
Repo: biomejs/biome PR: 7081
File: packages/@biomejs/biome/configuration_schema.json:7765-7781
Timestamp: 2025-08-05T14:43:29.581Z
Learning: The file `packages/biomejs/biome/configuration_schema.json` is auto-generated and should not be manually edited or reviewed for schema issues; any changes should be made at the code generation source.

Applied to files:

  • crates/biome_module_graph/tests/fixtures/css/package.json
  • crates/biome_test_utils/Cargo.toml
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Commit rule changes with message format: `feat(biome_<crate>): <ruleName>` to follow Biome's conventional commit style

Applied to files:

  • crates/biome_module_graph/tests/fixtures/css/package.json
📚 Learning: 2025-11-24T18:04:57.309Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_diagnostics/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:57.309Z
Learning: Applies to crates/biome_diagnostics/**/*.rs : Use #[derive(Diagnostic)] on enums when every variant contains a type that is itself a diagnostic

Applied to files:

  • crates/biome_service/src/workspace/server.rs
📚 Learning: 2025-11-24T18:04:57.309Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_diagnostics/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:57.309Z
Learning: Applies to crates/biome_diagnostics/**/*.rs : Implement the Diagnostic trait on types, or use the #[derive(Diagnostic)] procedural macro to implement the trait. Configure category, severity, description, message, location, and tags using the #[diagnostic] attribute

Applied to files:

  • crates/biome_service/src/workspace/server.rs
📚 Learning: 2025-11-24T18:04:57.309Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_diagnostics/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:57.309Z
Learning: Applies to crates/biome_diagnostics/**/*.rs : Ensure the type implementing Diagnostic derives Debug

Applied to files:

  • crates/biome_service/src/workspace/server.rs
📚 Learning: 2025-11-24T18:04:57.309Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_diagnostics/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:57.309Z
Learning: Applies to crates/biome_diagnostics/crates/biome_diagnostics_categories/src/categories.rs : Register all new diagnostic categories in crates/biome_diagnostics_categories/src/categories.rs

Applied to files:

  • crates/biome_service/src/workspace/server.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/*analyze/src/lint/**/*.rs : Implement custom `Queryable` types and `Visitor` traits for rules requiring deep AST inspection to avoid redundant traversal passes

Applied to files:

  • crates/biome_module_graph/src/css_module_info/visitor.rs
📚 Learning: 2025-11-28T09:08:10.091Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-11-28T09:08:10.091Z
Learning: Applies to Cargo.toml : Use workspace dependencies in the root Cargo.toml; internal crates should use `workspace = true` for dependencies and path dependencies for dev-dependencies

Applied to files:

  • crates/biome_test_utils/Cargo.toml
  • crates/biome_module_graph/Cargo.toml
📚 Learning: 2025-11-24T18:06:12.048Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_service/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:12.048Z
Learning: Debug the WorkspaceWatcher by starting the daemon with cargo run --bin=biome -- start and running commands such as cargo run --bin=biome -- lint --use-server <path>

Applied to files:

  • crates/biome_test_utils/Cargo.toml
  • crates/biome_test_utils/src/lib.rs
  • crates/biome_module_graph/Cargo.toml
📚 Learning: 2025-11-24T18:05:20.371Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:20.371Z
Learning: Use the `just gen-formatter` command to generate initial formatter implementations from the grammar, which will use `format_verbatim_node` that must be replaced with proper `biome_formatter` utilities

Applied to files:

  • crates/biome_module_graph/tests/snap/mod.rs
📚 Learning: 2025-11-24T18:06:03.545Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:03.545Z
Learning: Applies to crates/biome_parser/**/src/**/*.rs : Use `ParseSeparatedList` and `ParseNodeList` for parsing lists with error recovery to avoid infinite loops

Applied to files:

  • crates/biome_test_utils/src/lib.rs
  • crates/biome_module_graph/tests/spec_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_module_graph/tests/spec_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/**/src/**/*.rs : A parser struct must implement the `Parser` trait and save the token source, parser context, and optional parser options

Applied to files:

  • crates/biome_module_graph/tests/spec_tests.rs
📚 Learning: 2025-11-24T18:05:27.810Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:27.810Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : For tokens that are not mandatory, use helper functions instead of hardcoding

Applied to files:

  • crates/biome_module_graph/tests/spec_tests.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/src/**/*.rs : Rule options must be defined in the `biome_rule_options` crate and implement traits: `Deserializable`, `Merge`, `Serialize`, `Deserialize`, and `JsonSchema`

Applied to files:

  • crates/biome_module_graph/tests/spec_tests.rs
📚 Learning: 2025-11-27T23:04:02.022Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-27T23:04:02.022Z
Learning: Applies to crates/biome_analyze/**/biome_rule_options/src/**/*.rs : Rule options struct fields should use `#[serde(rename_all = "camelCase")]`, `#[serde(deny_unknown_fields)]`, and `#[serde(default)]` attributes for proper JSON serialization

Applied to files:

  • crates/biome_module_graph/tests/spec_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: Create test infrastructure with `tests/specs` folder structure and `spec_test.rs`, `spec_tests.rs`, and `language.rs` files in test directories

Applied to files:

  • crates/biome_module_graph/tests/spec_tests.rs
🧬 Code graph analysis (11)
crates/biome_service/src/scanner/workspace_watcher_bridge.tests.rs (1)
crates/biome_module_graph/src/module_graph.rs (2)
  • as_js_module_info (282-287)
  • as_js_module_info (305-310)
crates/biome_css_syntax/src/import_ext.rs (1)
crates/biome_css_syntax/src/lib.rs (1)
  • inner_string_text (189-198)
crates/biome_rowan/src/syntax/node.rs (2)
crates/biome_service/src/workspace/document.rs (1)
  • node (183-185)
crates/biome_rowan/src/ast/mod.rs (1)
  • unwrap_cast (200-212)
crates/biome_lsp/src/server.tests.rs (1)
crates/biome_module_graph/src/module_graph.rs (2)
  • as_js_module_info (282-287)
  • as_js_module_info (305-310)
crates/biome_js_analyze/src/lib.rs (1)
crates/biome_service/src/configuration.rs (1)
  • file_path (113-115)
crates/biome_module_graph/src/css_module_info.rs (3)
crates/biome_module_graph/src/js_module_info.rs (4)
  • deref (38-40)
  • deref (218-220)
  • deref (229-231)
  • dump (96-131)
crates/biome_module_graph/src/module_graph.rs (2)
  • deref (387-389)
  • dump (298-303)
crates/biome_module_graph/src/css_module_info/visitor.rs (1)
  • new (18-28)
crates/biome_service/src/workspace/server.rs (2)
crates/biome_css_semantic/src/semantic_model/model.rs (2)
  • root (34-36)
  • root (35-35)
crates/biome_rowan/src/syntax/node.rs (1)
  • into_language_root (863-869)
crates/biome_module_graph/src/css_module_info/visitor.rs (1)
crates/biome_module_graph/src/css_module_info.rs (1)
  • new (25-28)
crates/biome_test_utils/src/lib.rs (2)
packages/@biomejs/js-api/src/wasm.ts (1)
  • BiomePath (1-1)
crates/biome_css_parser/src/lib.rs (1)
  • parse_css (27-30)
crates/biome_service/src/workspace.tests.rs (1)
crates/biome_module_graph/src/module_graph.rs (2)
  • as_js_module_info (282-287)
  • as_js_module_info (305-310)
crates/biome_module_graph/src/module_graph.rs (4)
crates/biome_module_graph/src/js_module_info.rs (2)
  • diagnostics (53-55)
  • dump (96-131)
crates/biome_module_graph/src/css_module_info.rs (2)
  • new (25-28)
  • dump (30-39)
crates/biome_module_graph/src/css_module_info/visitor.rs (1)
  • new (18-28)
crates/biome_module_graph/src/js_module_info/collector.rs (1)
  • new (1117-1133)
🔇 Additional comments (30)
crates/biome_rowan/src/syntax/node.rs (1)

863-869: Consider the panic behaviour or add documentation.

This method returns Option<N>, suggesting it handles failure gracefully. However, N::unwrap_cast will panic if the language matches but the node kind doesn't match the expected root type N.

If this panic is intentional (indicating a programming error), please document it in the method's documentation, similar to to_language_root below. Alternatively, consider whether this should return Result or use a fallible cast method.

crates/biome_module_graph/Cargo.toml (1)

19-20: CSS workspace dependencies wired correctly

Adding biome_css_semantic and biome_css_syntax as workspace dependencies here is consistent with the new CSS-aware module graph and follows the workspace dependency pattern. No issues from this file.

crates/biome_module_graph/tests/fixtures/css/package.json (1)

1-4: Minimal CSS fixture manifest looks fine

The minimal package.json (name + version) is perfectly adequate for the CSS module graph tests and keeps the fixture simple.

crates/biome_module_graph/tests/fixtures/css/index.css (1)

1-2: Good coverage of CSS import forms

Using both @import "foo.css"; and @import "./bar.css"; gives nice coverage for bare vs relative CSS imports in the module graph tests. Looks good.

crates/biome_test_utils/Cargo.toml (1)

21-22: CSS parser dependencies correctly added to test utils

Bringing in biome_css_parser and biome_css_syntax as workspace dependencies is consistent with how other language tooling is wired in biome_test_utils. No concerns here.

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

3-10: import_ext module is cleanly integrated

Adding mod import_ext; alongside the other internal modules keeps the new import helpers encapsulated and does not alter the public API surface. Integration here looks tidy.

crates/biome_js_analyze/src/lint/nursery/no_unresolved_imports.rs (1)

260-264: Use of find_js_exported_symbol matches JS-only rule semantics

Switching to target_info.find_js_exported_symbol is the right move now that the module graph can host non-JS modules: this rule is JS-only and should ignore CSS (or other) exports. The lookup remains constrained by the same module_graph context, so behaviour is preserved for JS while avoiding cross-language confusion.

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

161-164: Resolver now correctly targets JS module info

Using js_module_info_for_path here makes the type resolver explicitly JS-centric, which is what JsAnalyzerServices expects now that the module graph can host multiple module kinds. The surrounding logic is unchanged, so this is a safe and more precise lookup.

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

79-83: Static import assertion correctly adapted to ModuleInfo

Using as_js_module_info().unwrap().static_import_paths.clone() keeps the test aligned with the new ModuleInfo enum; the unwrap is fine here because the fixture is a .js file and a panic would indicate a genuine bug in the graph.

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

627-638: debug_type_info now correctly uses JS-specific module info

Swapping to graph.js_module_info_for_path(path) makes the no-parse-path branch explicitly JS-only and consistent with the updated graph API, without changing the observable behaviour of debug_type_info.

crates/biome_js_analyze/src/lint/nursery/no_deprecated_imports.rs (1)

128-140: Deprecation lookup correctly narrowed to JS modules

Using module_graph.js_module_info_for_path(target_path) keeps this rule’s resolution strictly JS-focused; unresolved or non-JS targets just bail out as before, which matches the rule’s language: "js" scope.

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

348-352: Module graph assertion updated to use as_js_module_info

The assertion now correctly unwraps the JS variant from ModuleInfo before reading static_import_paths, which matches the new graph representation and is appropriate for this .ts-only test.

crates/biome_module_graph/src/js_module_info/module_resolver.rs (1)

167-178: Registering imported modules via js_module_info_for_path

Switching to self.module_graph.js_module_info_for_path(path)? keeps ModuleResolver firmly in JS territory and lines up with the new graph APIs, without altering the import-resolution flow.

crates/biome_test_utils/src/lib.rs (2)

33-35: CSS parser types wired into test utilities

Importing CssParserOptions and CssRoot here makes sense given the new CSS graph tests and keeps the CSS helpers nicely local to biome_test_utils.


207-208: JS test module graph updated to new JS-path API

Calling update_graph_for_js_paths(&fs, project_layout, &paths) matches the updated signature and keeps this helper focused on JS/TS inputs; CSS fixtures can now go through the separate CSS-specific path.

crates/biome_module_graph/tests/snap/mod.rs (1)

89-121: LGTM! Clean pattern matching for the new ModuleInfo variants.

The empty CSS branch is appropriate for snapshot testing at this stage.

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

66-66: Straightforward migration to SerializedModuleInfo.

The type rename cleanly extends support to both JS and CSS modules whilst maintaining API compatibility.

Also applies to: 1353-1353

crates/biome_css_syntax/src/import_ext.rs (1)

13-26: Implementation looks solid.

The pattern matching is exhaustive and error handling is appropriate. The method cleanly extracts inner text from both CSS string literals and url() function values.

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

898-925: CSS module graph update looks solid.

The branching logic correctly handles JS vs CSS roots, and the CSS path appropriately requires both the CSS root and CSS services (semantic model) to be available. The fallback to Default::default() for unrecognised roots is sensible.


2486-2498: Debug implementation updated correctly.

The tuple now reflects the three-field variant, though it still only displays reason for brevity. That's a reasonable choice.

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

1-20: Clean module structure expansion for CSS support.

The new css_module_info module and its public re-exports follow the established pattern from js_module_info. The expanded exports from module_graph align well with the new multi-language module info design.

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

2205-2284: Good test coverage for CSS imports.

The new resolves_css_imports_correctly test properly exercises CSS import resolution with both relative (./bar.css) and non-prefixed (foo.css) specifiers. Nice use of the new get_css_added_paths utility.

crates/biome_module_graph/src/css_module_info/visitor.rs (1)

30-45: Clean visitor implementation.

The preorder traversal correctly captures CSS import URLs. The pattern matches the established approach in the JS module visitor.

crates/biome_module_graph/src/css_module_info.rs (1)

12-40: Solid CSS module info structure.

The CssModuleInfo wrapper with Arc follows the established pattern from JsModuleInfo. The Deref implementation and serialisation logic look correct.

crates/biome_module_graph/src/module_graph.rs (6)

13-28: LGTM!

Imports are well-organised and align with the new CSS module support.


43-70: LGTM!

The data structure generalisation and the new accessor method are correctly implemented. The clone is necessary due to the hashmap guard semantics.


125-129: LGTM!

Clean use of the From trait for converting JsModuleInfo into ModuleInfo.


254-270: LGTM!

Clean enum design with idiomatic From implementations.


297-318: LGTM!

The dump() method and accessors are correctly implemented. The same wildcard pattern suggestion from the SerializedModuleInfo review applies here.


320-365: LGTM!

The function correctly handles the new ModuleInfo enum by only descending into JS modules when resolving re-exports. CSS modules are appropriately skipped since they don't participate in JS-style export resolution.

Comment on lines +44 to +55
/// Map of all static imports found in the module.
///
/// Maps from the local imported name to a [JsImport] with the absolute path
/// it resolves to. The resolved path may be looked up as key in the
/// [ModuleGraph::data] map, although it is not required to exist
/// (for instance, if the path is outside the project's scope).
///
/// Note that re-exports may introduce additional dependencies, because they
/// import another module and immediately re-export from that module.
/// Re-exports are tracked as part of [Self::exports] and
/// [Self::blanket_reexports].
pub imports: CssImports,
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion | 🟠 Major

Doc comments reference JS-specific concepts.

The documentation mentions JsImport, Self::exports, and Self::blanket_reexports which don't exist for CSS modules. These appear to be copy-pasted from the JS module info.

     /// Map of all static imports found in the module.
     ///
-    /// Maps from the local imported name to a [JsImport] with the absolute path
+    /// Maps from the import specifier to a [CssImport] with the absolute path
     /// it resolves to. The resolved path may be looked up as key in the
     /// [ModuleGraph::data] map, although it is not required to exist
     /// (for instance, if the path is outside the project's scope).
-    ///
-    /// Note that re-exports may introduce additional dependencies, because they
-    /// import another module and immediately re-export from that module.
-    /// Re-exports are tracked as part of [Self::exports] and
-    /// [Self::blanket_reexports].
     pub imports: CssImports,
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
/// Map of all static imports found in the module.
///
/// Maps from the local imported name to a [JsImport] with the absolute path
/// it resolves to. The resolved path may be looked up as key in the
/// [ModuleGraph::data] map, although it is not required to exist
/// (for instance, if the path is outside the project's scope).
///
/// Note that re-exports may introduce additional dependencies, because they
/// import another module and immediately re-export from that module.
/// Re-exports are tracked as part of [Self::exports] and
/// [Self::blanket_reexports].
pub imports: CssImports,
/// Map of all static imports found in the module.
///
/// Maps from the import specifier to a [CssImport] with the absolute path
/// it resolves to. The resolved path may be looked up as key in the
/// [ModuleGraph::data] map, although it is not required to exist
/// (for instance, if the path is outside the project's scope).
pub imports: CssImports,

Comment on lines +181 to +185
pub fn update_graph_for_removed_paths(&self, removed_paths: &[&BiomePath]) {
let modules = self.data.pin();
// Make sure all directories are registered for the added/updated paths.
let path_info = self.path_info.pin();

Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Misleading comment.

The comment references "added/updated paths" but this function handles removed paths.

     pub fn update_graph_for_removed_paths(&self, removed_paths: &[&BiomePath]) {
         let modules = self.data.pin();
-        // Make sure all directories are registered for the added/updated paths.
+        // Clean up removed paths from the module graph and path info cache.
         let path_info = self.path_info.pin();
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
pub fn update_graph_for_removed_paths(&self, removed_paths: &[&BiomePath]) {
let modules = self.data.pin();
// Make sure all directories are registered for the added/updated paths.
let path_info = self.path_info.pin();
pub fn update_graph_for_removed_paths(&self, removed_paths: &[&BiomePath]) {
let modules = self.data.pin();
// Clean up removed paths from the module graph and path info cache.
let path_info = self.path_info.pin();
🤖 Prompt for AI Agents
In crates/biome_module_graph/src/module_graph.rs around lines 181 to 185, the
inline comment incorrectly mentions "added/updated paths" even though this
function deals with removed paths; update the comment to accurately describe
handling of removed paths (e.g., "Ensure directories are accounted for when
processing removed paths" or "Make sure all directories are handled/unregistered
for the removed paths") so it matches the function's purpose.

Comment on lines +2224 to +2251
// project_layout.insert_node_manifest(format!("{fixtures_path}/shared").into(), {
// let path = Utf8PathBuf::from(format!("{fixtures_path}/shared/package.json"));
// deserialize_from_json_str::<PackageJson>(
// &fs.read_file_from_path(&path)
// .expect("package.json must be readable"),
// JsonParserOptions::default(),
// "package.json",
// )
// .into_deserialized()
// .expect("package.json must parse")
// });

// project_layout.insert_node_manifest(
// format!("{fixtures_path}/frontend/node_modules/shared").into(),
// {
// let path = Utf8PathBuf::from(format!(
// "{fixtures_path}/frontend/node_modules/shared/package.json"
// ));
// deserialize_from_json_str::<PackageJson>(
// &fs.read_file_from_path(&path)
// .expect("package.json must be readable"),
// JsonParserOptions::default(),
// "package.json",
// )
// .into_deserialized()
// .expect("package.json must parse")
// },
// );
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion | 🟠 Major

Remove commented-out code.

This appears to be leftover from copy-pasting the JS test setup. Either implement the shared package handling for CSS or remove this dead code to keep the test clean.

-    // project_layout.insert_node_manifest(format!("{fixtures_path}/shared").into(), {
-    //     let path = Utf8PathBuf::from(format!("{fixtures_path}/shared/package.json"));
-    //     deserialize_from_json_str::<PackageJson>(
-    //         &fs.read_file_from_path(&path)
-    //             .expect("package.json must be readable"),
-    //         JsonParserOptions::default(),
-    //         "package.json",
-    //     )
-    //         .into_deserialized()
-    //         .expect("package.json must parse")
-    // });
-
-    // project_layout.insert_node_manifest(
-    //     format!("{fixtures_path}/frontend/node_modules/shared").into(),
-    //     {
-    //         let path = Utf8PathBuf::from(format!(
-    //             "{fixtures_path}/frontend/node_modules/shared/package.json"
-    //         ));
-    //         deserialize_from_json_str::<PackageJson>(
-    //             &fs.read_file_from_path(&path)
-    //                 .expect("package.json must be readable"),
-    //             JsonParserOptions::default(),
-    //             "package.json",
-    //         )
-    //             .into_deserialized()
-    //             .expect("package.json must parse")
-    //     },
-    // );
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// project_layout.insert_node_manifest(format!("{fixtures_path}/shared").into(), {
// let path = Utf8PathBuf::from(format!("{fixtures_path}/shared/package.json"));
// deserialize_from_json_str::<PackageJson>(
// &fs.read_file_from_path(&path)
// .expect("package.json must be readable"),
// JsonParserOptions::default(),
// "package.json",
// )
// .into_deserialized()
// .expect("package.json must parse")
// });
// project_layout.insert_node_manifest(
// format!("{fixtures_path}/frontend/node_modules/shared").into(),
// {
// let path = Utf8PathBuf::from(format!(
// "{fixtures_path}/frontend/node_modules/shared/package.json"
// ));
// deserialize_from_json_str::<PackageJson>(
// &fs.read_file_from_path(&path)
// .expect("package.json must be readable"),
// JsonParserOptions::default(),
// "package.json",
// )
// .into_deserialized()
// .expect("package.json must parse")
// },
// );
🤖 Prompt for AI Agents
crates/biome_module_graph/tests/spec_tests.rs around lines 2224 to 2251: the
block of commented-out code (the two insert_node_manifest sections copying JS
test setup for a shared package) is dead/commented code leftover; remove these
commented lines entirely from the test file to keep the test clean (or if
shared-package behavior is required, replace the comments by implementing the
proper shared package handling — otherwise just delete the commented block).

N: AstNode,
N::Language: 'static,
{
self.clone().into_node().map(|node| N::unwrap_cast(node))
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion | 🟠 Major

Remove the unnecessary clone.

Since self is already consumed by the method signature, there's no need to clone it before calling into_node().

Apply this diff:

-        self.clone().into_node().map(|node| N::unwrap_cast(node))
+        self.into_node().map(|node| N::unwrap_cast(node))
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
self.clone().into_node().map(|node| N::unwrap_cast(node))
self.into_node().map(|node| N::unwrap_cast(node))
🤖 Prompt for AI Agents
In crates/biome_rowan/src/syntax/node.rs around line 868, remove the unnecessary
clone call on self (the method consumes self) so that you call into_node()
directly on self; optionally simplify the map closure to pass N::unwrap_cast as
the function argument.

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

Labels

A-Core Area: core A-Linter Area: linter A-LSP Area: language server protocol A-Parser Area: parser A-Project Area: project L-CSS Language: CSS L-JavaScript Language: JavaScript and super languages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants