+
Skip to content

Conversation

siketyan
Copy link
Member

@siketyan siketyan commented Aug 8, 2025

Summary

Add support for the extension_alias option in our own resolver.
Now Biome can resolve .ts files imported by .js extension, which is the common pattern in TypeScript with ESM module resolution.

Test Plan

Added spec tests.
Test cases are copied from oxc-resolver: https://github.com/oxc-project/oxc-resolver/blob/3759487f28ee05e3deb1c60f193735d180d23bbe/src/tests/extension_alias.rs.

Docs

N/A

@siketyan siketyan requested review from a team and arendjr August 8, 2025 16:54
@siketyan siketyan self-assigned this Aug 8, 2025
Copy link

changeset-bot bot commented Aug 8, 2025

🦋 Changeset detected

Latest commit: 3253a1b

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

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

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

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

Copy link
Contributor

coderabbitai bot commented Aug 8, 2025

Walkthrough

This update adds extension aliasing to the module resolution process. The resolver now tries alternative file extensions, such as falling back from .ts to .js or from .mts to .mjs, when resolving paths. This is implemented by introducing an extension_alias field in the ResolveOptions struct and updating resolution functions to use it. The change includes a new private helper function to handle extension alias resolution. Additionally, new tests were added to cover various aliasing scenarios. No existing public API signatures were changed, but new methods and fields related to extension aliasing were introduced.

Possibly related PRs

  • fix(core): resolve aliased imports #7121: Enhances the resolver to support extension aliasing for TypeScript and JavaScript files, enabling correct resolution of imports like "./foo.js" to "foo.ts" and detection of floating promises, complementing this PR’s extension substitution logic.

Note

🔌 MCP (Model Context Protocol) integration is now available in Early Access!

Pro users can now connect to remote MCP servers under the Integrations page to get reviews and chat conversations that understand additional development context.


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3253a1b and 814ea72.

📒 Files selected for processing (1)
  • crates/biome_resolver/src/lib.rs (8 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • crates/biome_resolver/src/lib.rs
⏰ 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). (24)
  • GitHub Check: Test (depot-windows-2022-16)
  • GitHub Check: End-to-end tests
  • GitHub Check: Documentation
  • 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 Node.js API
  • GitHub Check: Bench (biome_json_analyze)
  • GitHub Check: Bench (biome_html_parser)
  • GitHub Check: Bench (biome_html_formatter)
  • GitHub Check: Bench (biome_module_graph)
  • GitHub Check: Bench (biome_configuration)
  • GitHub Check: Bench (biome_graphql_formatter)
  • GitHub Check: Bench (biome_css_analyze)
  • GitHub Check: Bench (biome_graphql_parser)
  • GitHub Check: Bench (biome_js_parser)
  • GitHub Check: Bench (biome_json_parser)
  • GitHub Check: Bench (biome_css_formatter)
  • GitHub Check: Bench (biome_json_formatter)
  • GitHub Check: Bench (biome_js_formatter)
  • GitHub Check: Bench (biome_css_parser)
  • GitHub Check: Bench (biome_js_analyze)
  • GitHub Check: autofix
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/resolve-extension-alias

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

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

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

Support

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

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

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

Documentation and Community

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

@github-actions github-actions bot added A-Project Area: project A-Resolver Area: resolver labels Aug 8, 2025
@siketyan siketyan force-pushed the feat/resolve-extension-alias branch from fa72866 to c5a7679 Compare August 8, 2025 16:56
Copy link

codspeed-hq bot commented Aug 8, 2025

CodSpeed Performance Report

Merging #7158 will improve performances by 6.1%

Comparing feat/resolve-extension-alias (814ea72) with main (7424b9a)

Summary

⚡ 1 improvements
✅ 127 untouched benchmarks

Benchmarks breakdown

Benchmark BASE HEAD Change
pure_9395922602181450299.css[uncached] 3.8 ms 3.6 ms +6.1%

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

🧹 Nitpick comments (5)
crates/biome_resolver/src/lib.rs (2)

65-95: Robustness: still try the original extension as a final fallback.

Current semantics skip the original extension entirely if an alias entry exists that omits it. Many resolvers always try the original last to avoid surprising failures. Safe to add and keeps your tests passing.

Apply after the alias loop:

-    Err(last_error.unwrap_or(ResolveError::NotFound))
+    // As a safety net, try the original as the last resort if not already included.
+    if !aliases.contains(&extension) {
+        if let Ok(ok) = resolve_absolute_path(path.clone(), fs, options) {
+            return Ok(ok);
+        }
+    }
+    Err(last_error.unwrap_or(ResolveError::NotFound))

763-769: Docs: clarify scope and precedence of extension_alias.

  • It also applies to absolute paths (not just “relative paths”).
  • Consider noting that alias order defines precedence, and the original extension is only tried if included (or if you adopt the suggested fallback above).

Suggested wording:

-/// List of extension aliases to search for in relative paths.
-/// Typically used to resolve `.ts` files by `.js` extension.
+/// List of extension aliases to search when a specifier has an explicit extension.
+/// Applies to both absolute and relative paths.
+/// Commonly used to resolve `.ts` files when `.js` is imported.
+///
+/// Aliases are tried in the given order. The original extension is only tried if
+/// it is included in the alias list (or as an implementation detail if the resolver
+/// falls back to it after exhausting aliases).
.changeset/petite-waves-love.md (1)

5-5: Polish the changeset for clarity and style.

Use past tense for what you did, present tense for behaviour, and tidy the grammar.

-The resolver can now correctly resolve `.ts` files by `.js` extension if exists.
+Added support for extension aliasing in the resolver. Biome now resolves `.ts` files when they are imported with the `.js` extension, if the `.ts` file exists.
+
+See https://github.com/biomejs/biome/pull/7158 for details.
crates/biome_module_graph/src/js_module_info/visitor.rs (1)

447-451: Avoid drift: centralise default alias mapping.

The "js" -> ["ts", "js"] and "mjs" -> ["mts", "mjs"] mapping is likely useful elsewhere. Consider exposing a constant in biome_resolver (e.g., DEFAULT_EXTENSION_ALIAS) or a helper like with_node_style_extension_alias() to prevent duplication and divergence.

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

537-572: Great coverage for fully specified aliasing.

Minor nit: the assertion message “without an array” is misleading, since the option is an array with a single element.

-        "should support alias option without an array",
+        "should support a single-alias alternative",
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a081bbe and c5a7679.

📒 Files selected for processing (4)
  • .changeset/petite-waves-love.md (1 hunks)
  • crates/biome_module_graph/src/js_module_info/visitor.rs (1 hunks)
  • crates/biome_resolver/src/lib.rs (8 hunks)
  • crates/biome_resolver/tests/spec_tests.rs (1 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
.changeset/*.md

📄 CodeRabbit Inference Engine (CONTRIBUTING.md)

.changeset/*.md: Changeset descriptions should be about user-facing changes, use past tense for what you did, present tense for Biome behavior, reference issues/rules/assists with links, include code blocks when applicable, and end every sentence with a full stop.
Headers in changesets should use #### or ##### only; other headers may break the changelog.

Files:

  • .changeset/petite-waves-love.md
**/*.{rs,toml}

📄 CodeRabbit Inference Engine (CLAUDE.md)

Format code (Rust + TOML) using just format

Format Rust and TOML files using just f (alias for just format).

Files:

  • crates/biome_module_graph/src/js_module_info/visitor.rs
  • crates/biome_resolver/tests/spec_tests.rs
  • crates/biome_resolver/src/lib.rs
crates/biome_*/**/*

📄 CodeRabbit Inference Engine (CLAUDE.md)

Core crates must be located in /crates/biome_*/

Files:

  • crates/biome_module_graph/src/js_module_info/visitor.rs
  • crates/biome_resolver/tests/spec_tests.rs
  • crates/biome_resolver/src/lib.rs
**/*.rs

📄 CodeRabbit Inference Engine (CONTRIBUTING.md)

Update documentation for new features or changes, using inline rustdoc for rules, assists, and their options.

Files:

  • crates/biome_module_graph/src/js_module_info/visitor.rs
  • crates/biome_resolver/tests/spec_tests.rs
  • crates/biome_resolver/src/lib.rs
🧠 Learnings (30)
📓 Common learnings
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:23.437Z
Learning: Applies to crates/biome_js_type_info/src/resolver.rs : Implement and maintain the `TypeResolver` trait in `src/resolver.rs`, with separate implementations for hardcoded symbols, globals, module info collection, and full module resolution.
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:23.437Z
Learning: Applies to crates/biome_js_type_info/../biome_module_graph/src/js_module_info/scoped_resolver.rs : Full inference should resolve all remaining `TypeReference::Import` variants to `TypeReference::Resolved` using the complete module graph. Implemented in `../biome_module_graph/src/js_module_info/scoped_resolver.rs`.
📚 Learning: 2025-08-05T14:43:29.581Z
Learnt from: dyc3
PR: biomejs/biome#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:

  • .changeset/petite-waves-love.md
📚 Learning: 2025-08-05T14:49:35.574Z
Learnt from: CR
PR: biomejs/biome#0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:49:35.574Z
Learning: Applies to .changeset/*.md : Changeset descriptions should be about user-facing changes, use past tense for what you did, present tense for Biome behavior, reference issues/rules/assists with links, include code blocks when applicable, and end every sentence with a full stop.

Applied to files:

  • .changeset/petite-waves-love.md
📚 Learning: 2025-08-05T14:49:35.574Z
Learnt from: CR
PR: biomejs/biome#0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:49:35.574Z
Learning: Create changesets for user-facing bugfixes or features using `just new-changeset`.

Applied to files:

  • .changeset/petite-waves-love.md
📚 Learning: 2025-08-05T14:49:35.574Z
Learnt from: CR
PR: biomejs/biome#0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:49:35.574Z
Learning: Update generated documentation in the `next` branch of the website after a release using `BIOME_VERSION=<version> pnpm run codegen:all`.

Applied to files:

  • .changeset/petite-waves-love.md
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/*.rs : Update the `language` field in `declare_lint_rule!` to match the language the rule applies to (e.g., `js`, `jsx`, `ts`, `tsx`).

Applied to files:

  • .changeset/petite-waves-love.md
  • crates/biome_module_graph/src/js_module_info/visitor.rs
📚 Learning: 2025-08-05T14:49:35.574Z
Learnt from: CR
PR: biomejs/biome#0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:49:35.574Z
Learning: For Node.js development, use the `packages/biomejs/biome` module and follow the specified build and test steps.

Applied to files:

  • .changeset/petite-waves-love.md
📚 Learning: 2025-08-05T14:51:23.437Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:23.437Z
Learning: Applies to crates/biome_js_type_info/src/resolver.rs : Implement and maintain the `TypeResolver` trait in `src/resolver.rs`, with separate implementations for hardcoded symbols, globals, module info collection, and full module resolution.

Applied to files:

  • .changeset/petite-waves-love.md
  • crates/biome_module_graph/src/js_module_info/visitor.rs
  • crates/biome_resolver/tests/spec_tests.rs
  • crates/biome_resolver/src/lib.rs
📚 Learning: 2025-08-05T14:51:23.437Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:23.437Z
Learning: Applies to crates/biome_js_type_info/../biome_module_graph/src/js_module_info/scoped_resolver.rs : Full inference should resolve all remaining `TypeReference::Import` variants to `TypeReference::Resolved` using the complete module graph. Implemented in `../biome_module_graph/src/js_module_info/scoped_resolver.rs`.

Applied to files:

  • .changeset/petite-waves-love.md
  • crates/biome_module_graph/src/js_module_info/visitor.rs
  • crates/biome_resolver/tests/spec_tests.rs
  • crates/biome_resolver/src/lib.rs
📚 Learning: 2025-08-05T14:51:23.437Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:23.437Z
Learning: Applies to crates/biome_js_type_info/../biome_module_graph/src/js_module_info/collector.rs : Module-level (thin) inference should resolve `TypeReference::Qualifier` variants to `TypeReference::Resolved` or `TypeReference::Import` as appropriate, but cannot resolve imports across modules. Implemented in `../biome_module_graph/src/js_module_info/collector.rs`.

Applied to files:

  • crates/biome_module_graph/src/js_module_info/visitor.rs
  • crates/biome_resolver/tests/spec_tests.rs
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/*.rs : When implementing custom syntax tree visitors, define a `Visitor` struct and implement the `Visitor` trait for efficient traversal.

Applied to files:

  • crates/biome_module_graph/src/js_module_info/visitor.rs
📚 Learning: 2025-08-05T14:51:23.437Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:23.437Z
Learning: Applies to crates/biome_js_type_info/src/local_inference.rs : Local type inference should only create type references and not resolve them to concrete types. Local inference is implemented in `src/local_inference.rs`.

Applied to files:

  • crates/biome_module_graph/src/js_module_info/visitor.rs
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_rule_options/lib/*.rs : Use boxed slices (`Box<[Box<str>]>`) instead of `Vec<String>` for string arrays in rule options to save memory.

Applied to files:

  • crates/biome_module_graph/src/js_module_info/visitor.rs
  • crates/biome_resolver/src/lib.rs
📚 Learning: 2025-08-05T14:51:23.437Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:23.437Z
Learning: Applies to crates/biome_js_type_info/src/flattening.rs : Flattening of type expressions (e.g., reducing `TypeData::TypeofExpression` to a concrete type) should be implemented in `src/flattening.rs`.

Applied to files:

  • crates/biome_module_graph/src/js_module_info/visitor.rs
📚 Learning: 2025-08-05T14:51:23.437Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:23.437Z
Learning: Applies to crates/biome_js_type_info/src/type_info.rs : The `TypeData` enum, defined in `src/type_info.rs`, is the central data structure for type information and should be extended to cover all relevant TypeScript types.

Applied to files:

  • crates/biome_module_graph/src/js_module_info/visitor.rs
📚 Learning: 2025-08-05T14:51:05.640Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:05.640Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : For tokens that are not mandatory, use the provided helper functions when formatting AST nodes.

Applied to files:

  • crates/biome_module_graph/src/js_module_info/visitor.rs
📚 Learning: 2025-08-05T14:51:51.355Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:51.355Z
Learning: Applies to crates/biome_parser/crates/biome_*/**/*.rs : Use conditional syntax handling to add diagnostics if a syntax is not supported in the current file or context, and wrap invalid syntax in a `BOGUS` node if necessary.

Applied to files:

  • crates/biome_module_graph/src/js_module_info/visitor.rs
  • crates/biome_resolver/src/lib.rs
📚 Learning: 2025-08-05T14:50:56.365Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:56.365Z
Learning: Applies to crates/biome_formatter/tests/spec_tests.rs : Update the `spec_tests.rs` file to generate a test function for each `.html` file found inside `tests/specs/html` using the `tests_macros::gen_tests!` macro.

Applied to files:

  • crates/biome_resolver/tests/spec_tests.rs
📚 Learning: 2025-08-05T14:51:59.193Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_service/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:59.193Z
Learning: Applies to crates/biome_service/src/workspace/watcher.tests.rs : Add tests for watcher workspace methods in watcher.tests.rs (src/workspace/watcher.tests.rs)

Applied to files:

  • crates/biome_resolver/tests/spec_tests.rs
  • crates/biome_resolver/src/lib.rs
📚 Learning: 2025-08-05T14:50:56.365Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:56.365Z
Learning: Applies to crates/biome_formatter/tests/{spec_test.rs,spec_tests.rs,language.rs} : Inside the `biome_html_formatter` crate, create a `tests` folder containing a `specs` folder and the files `spec_test.rs`, `spec_tests.rs`, and `language.rs` for test infrastructure.

Applied to files:

  • crates/biome_resolver/tests/spec_tests.rs
📚 Learning: 2025-08-05T14:51:59.193Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_service/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:59.193Z
Learning: Applies to crates/biome_service/../biome_lsp/src/server.tests.rs : Add end-to-end tests for watcher functionality in LSP tests (../biome_lsp/src/server.tests.rs)

Applied to files:

  • crates/biome_resolver/tests/spec_tests.rs
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Test rules using quick tests in the appropriate test file (e.g., `biome_js_analyze/tests/quick_test.rs`) and snapshot tests in `tests/specs/`.

Applied to files:

  • crates/biome_resolver/tests/spec_tests.rs
📚 Learning: 2025-08-05T14:50:56.365Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:56.365Z
Learning: Applies to crates/biome_formatter/tests/language.rs : Implement the `HtmlTestFormatLanguage` struct and the `TestFormatLanguage` trait in `language.rs` for test language support.

Applied to files:

  • crates/biome_resolver/tests/spec_tests.rs
📚 Learning: 2025-08-05T14:50:56.365Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:56.365Z
Learning: Applies to crates/biome_formatter/tests/spec_test.rs : Implement the `run` function in `spec_test.rs` to execute formatting tests using the provided test infrastructure.

Applied to files:

  • crates/biome_resolver/tests/spec_tests.rs
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/tests/specs/*/*/{invalid*,valid*}* : Snapshot tests for rules should be placed in `tests/specs/<group>/<rule_name>/` with files prefixed by `invalid` or `valid`.

Applied to files:

  • crates/biome_resolver/tests/spec_tests.rs
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_rule_options/lib/*.rs : Rule options must be placed inside the `biome_rule_options` crate, with a file named after the rule (e.g., `use_this_convention.rs`).

Applied to files:

  • crates/biome_resolver/src/lib.rs
📚 Learning: 2025-08-05T14:51:23.437Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:23.437Z
Learning: Applies to crates/biome_js_type_info/src/type_info.rs : When using `ResolvedTypeData`, always use the correct `ResolverId` when resolving `TypeReference`s that are part of the type data; mistakes can lead to panics.

Applied to files:

  • crates/biome_resolver/src/lib.rs
📚 Learning: 2025-08-05T14:51:59.193Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_service/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:59.193Z
Learning: Applies to crates/biome_service/src/workspace_watcher.rs : Keep the workspace state in sync with the filesystem using WorkspaceWatcher (src/workspace_watcher.rs)

Applied to files:

  • crates/biome_resolver/src/lib.rs
📚 Learning: 2025-08-05T14:49:35.574Z
Learnt from: CR
PR: biomejs/biome#0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:49:35.574Z
Learning: Applies to **/Cargo.toml : Use path dependencies for dev-dependencies in Cargo.toml to avoid requiring published versions.

Applied to files:

  • crates/biome_resolver/src/lib.rs
📚 Learning: 2025-08-05T14:50:35.163Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_diagnostics/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:35.163Z
Learning: Applies to crates/biome_diagnostics/**/*.rs : Diagnostics should not simply state that something went wrong; they should explain why it went wrong. Add explanations in log advices, and show hyperlinks to relevant documentation pages if the user wants to know more.

Applied to files:

  • crates/biome_resolver/src/lib.rs
🔇 Additional comments (7)
crates/biome_resolver/src/lib.rs (6)

44-48: Good call: route absolute paths through alias-aware resolver.

This hooks fully specified absolute specifiers into the new alias flow as intended.


149-150: Nice: aliasing now also applies to relative specifiers.

Keeps behaviour consistent between absolute and relative flows.


838-838: Sane default.

extension_alias defaulting to an empty slice is correct and non-invasive.


877-885: Builder API looks good.

const fn here is handy and matches the rest of the options API.


925-926: Good: preserve alias config when adjusting type roots.

Avoids accidental drops of the feature mid-resolution.


940-941: Correct: disable aliases when following manifest targets.

Keeps exports/main resolution strict and predictable.

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

575-597: Good: verifies aliasing does not affect directory/main resolution.

Consider adding one case where aliases are non-empty to confirm they still don’t affect directory/main lookups.

Would you like me to add a follow-up test that sets extension_alias for "js" (non-empty) and asserts that resolving "./dir2" and "./dir2/index" still lands on index.js?

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

🧹 Nitpick comments (7)
crates/biome_resolver/src/lib.rs (3)

84-91: Minor: avoid redundant extension probing after aliasing.

resolve_absolute_path may append options.extensions even when the candidate already has an extension, causing extra filesystem probes like "foo.ts.js". Not a correctness bug, but wasteful under aliasing.

Would you like a small PR to skip extension probing when the input already has an extension?


763-768: Clarify docs: scope and ordering of aliases.

This applies to absolute and relative paths with an explicit extension. If you want to keep the original extension as a fallback, include it in the alias list in the desired order.

-/// List of extension aliases to search for in relative paths.
-/// Typically used to resolve `.ts` files by `.js` extension.
-///
-/// Extensions should be provided without a leading dot.
+/// Extension aliases to consider when a specifier contains an explicit extension
+/// (absolute and relative paths).
+/// Typically used to resolve `.js` imports to existing `.ts` sources.
+///
+/// Provide extensions without a leading dot. The search order follows the slice order.
+/// Include the original extension if you want it to be considered as a fallback.
 pub extension_alias: &'a [(&'a str, &'a [&'a str])],

877-885: Nice builder.

Const builder keeps config ergonomic. Consider adding a brief example in the field docs to show typical mapping ("js" -> ["ts","js"]).

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

447-451: Consider widening aliases for common ESM/TS patterns.

Current mapping covers js→ts and mjs→mts. Many codebases also rely on:

  • jsx → tsx
  • cjs → cts

If aligned with project goals, extend the mapping (order matters):

-            extension_alias: &[("js", &["ts", "js"]), ("mjs", &["mts", "mjs"])],
+            extension_alias: &[
+                ("js", &["ts", "js"]),
+                ("mjs", &["mts", "mjs"]),
+                ("jsx", &["tsx", "jsx"]),
+                ("cjs", &["cts", "cjs"]),
+            ],

Please verify SUPPORTED_EXTENSIONS already includes these extensions.

.changeset/petite-waves-love.md (1)

1-5: Polish the changeset per guidelines (past tense + clearer behaviour).

Short, user-facing, and precise:

 ---
 "@biomejs/biome": patch
 ---
 
-The resolver can now correctly resolve `.ts` files by `.js` extension if exists.
+Added support for extension aliasing in the resolver.
+
+Biome now resolves imports that use the `.js` extension to corresponding `.ts` files when present. For example, `import "./foo.js"` resolves to `./foo.ts` if it exists; otherwise it resolves to `./foo.js`.
crates/biome_resolver/tests/spec_tests.rs (2)

567-571: Tweak the assertion message.

It mentions “without an array”, but the option uses a slice with one element. Suggest rewording to avoid confusion.

-        "should support alias option without an array",
+        "should support alias option with a single alternative",

537-572: Add a couple more cases for completeness.

  • Absolute path with alias (e.g. ${base_dir}/index.js${base_dir}/index.ts).
  • Relative alias with query/fragment to prove strip_query_and_fragment plays nicely.

Happy to draft these tests if you want them added here.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a081bbe and c5a7679.

📒 Files selected for processing (4)
  • .changeset/petite-waves-love.md (1 hunks)
  • crates/biome_module_graph/src/js_module_info/visitor.rs (1 hunks)
  • crates/biome_resolver/src/lib.rs (8 hunks)
  • crates/biome_resolver/tests/spec_tests.rs (1 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{rs,toml}

📄 CodeRabbit Inference Engine (CLAUDE.md)

Format code (Rust + TOML) using just format

Format Rust and TOML files using just f (alias for just format).

Files:

  • crates/biome_resolver/tests/spec_tests.rs
  • crates/biome_module_graph/src/js_module_info/visitor.rs
  • crates/biome_resolver/src/lib.rs
crates/biome_*/**/*

📄 CodeRabbit Inference Engine (CLAUDE.md)

Core crates must be located in /crates/biome_*/

Files:

  • crates/biome_resolver/tests/spec_tests.rs
  • crates/biome_module_graph/src/js_module_info/visitor.rs
  • crates/biome_resolver/src/lib.rs
**/*.rs

📄 CodeRabbit Inference Engine (CONTRIBUTING.md)

Update documentation for new features or changes, using inline rustdoc for rules, assists, and their options.

Files:

  • crates/biome_resolver/tests/spec_tests.rs
  • crates/biome_module_graph/src/js_module_info/visitor.rs
  • crates/biome_resolver/src/lib.rs
.changeset/*.md

📄 CodeRabbit Inference Engine (CONTRIBUTING.md)

.changeset/*.md: Changeset descriptions should be about user-facing changes, use past tense for what you did, present tense for Biome behavior, reference issues/rules/assists with links, include code blocks when applicable, and end every sentence with a full stop.
Headers in changesets should use #### or ##### only; other headers may break the changelog.

Files:

  • .changeset/petite-waves-love.md
🧠 Learnings (29)
📓 Common learnings
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:23.437Z
Learning: Applies to crates/biome_js_type_info/src/resolver.rs : Implement and maintain the `TypeResolver` trait in `src/resolver.rs`, with separate implementations for hardcoded symbols, globals, module info collection, and full module resolution.
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:23.437Z
Learning: Applies to crates/biome_js_type_info/../biome_module_graph/src/js_module_info/scoped_resolver.rs : Full inference should resolve all remaining `TypeReference::Import` variants to `TypeReference::Resolved` using the complete module graph. Implemented in `../biome_module_graph/src/js_module_info/scoped_resolver.rs`.
📚 Learning: 2025-08-05T14:50:56.365Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:56.365Z
Learning: Applies to crates/biome_formatter/tests/{spec_test.rs,spec_tests.rs,language.rs} : Inside the `biome_html_formatter` crate, create a `tests` folder containing a `specs` folder and the files `spec_test.rs`, `spec_tests.rs`, and `language.rs` for test infrastructure.

Applied to files:

  • crates/biome_resolver/tests/spec_tests.rs
📚 Learning: 2025-08-05T14:51:59.193Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_service/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:59.193Z
Learning: Applies to crates/biome_service/src/workspace/watcher.tests.rs : Add tests for watcher workspace methods in watcher.tests.rs (src/workspace/watcher.tests.rs)

Applied to files:

  • crates/biome_resolver/tests/spec_tests.rs
  • crates/biome_resolver/src/lib.rs
📚 Learning: 2025-08-05T14:50:56.365Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:56.365Z
Learning: Applies to crates/biome_formatter/tests/spec_tests.rs : Update the `spec_tests.rs` file to generate a test function for each `.html` file found inside `tests/specs/html` using the `tests_macros::gen_tests!` macro.

Applied to files:

  • crates/biome_resolver/tests/spec_tests.rs
📚 Learning: 2025-08-05T14:51:59.193Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_service/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:59.193Z
Learning: Applies to crates/biome_service/../biome_lsp/src/server.tests.rs : Add end-to-end tests for watcher functionality in LSP tests (../biome_lsp/src/server.tests.rs)

Applied to files:

  • crates/biome_resolver/tests/spec_tests.rs
📚 Learning: 2025-08-05T14:51:23.437Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:23.437Z
Learning: Applies to crates/biome_js_type_info/src/resolver.rs : Implement and maintain the `TypeResolver` trait in `src/resolver.rs`, with separate implementations for hardcoded symbols, globals, module info collection, and full module resolution.

Applied to files:

  • crates/biome_resolver/tests/spec_tests.rs
  • crates/biome_module_graph/src/js_module_info/visitor.rs
  • .changeset/petite-waves-love.md
  • crates/biome_resolver/src/lib.rs
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Test rules using quick tests in the appropriate test file (e.g., `biome_js_analyze/tests/quick_test.rs`) and snapshot tests in `tests/specs/`.

Applied to files:

  • crates/biome_resolver/tests/spec_tests.rs
📚 Learning: 2025-08-05T14:50:56.365Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:56.365Z
Learning: Applies to crates/biome_formatter/tests/language.rs : Implement the `HtmlTestFormatLanguage` struct and the `TestFormatLanguage` trait in `language.rs` for test language support.

Applied to files:

  • crates/biome_resolver/tests/spec_tests.rs
📚 Learning: 2025-08-05T14:51:23.437Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:23.437Z
Learning: Applies to crates/biome_js_type_info/../biome_module_graph/src/js_module_info/scoped_resolver.rs : Full inference should resolve all remaining `TypeReference::Import` variants to `TypeReference::Resolved` using the complete module graph. Implemented in `../biome_module_graph/src/js_module_info/scoped_resolver.rs`.

Applied to files:

  • crates/biome_resolver/tests/spec_tests.rs
  • crates/biome_module_graph/src/js_module_info/visitor.rs
  • .changeset/petite-waves-love.md
  • crates/biome_resolver/src/lib.rs
📚 Learning: 2025-08-05T14:50:56.365Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:56.365Z
Learning: Applies to crates/biome_formatter/tests/spec_test.rs : Implement the `run` function in `spec_test.rs` to execute formatting tests using the provided test infrastructure.

Applied to files:

  • crates/biome_resolver/tests/spec_tests.rs
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/*.rs : Update the `language` field in `declare_lint_rule!` to match the language the rule applies to (e.g., `js`, `jsx`, `ts`, `tsx`).

Applied to files:

  • crates/biome_resolver/tests/spec_tests.rs
  • crates/biome_module_graph/src/js_module_info/visitor.rs
  • .changeset/petite-waves-love.md
📚 Learning: 2025-08-05T14:51:23.437Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:23.437Z
Learning: Applies to crates/biome_js_type_info/../biome_module_graph/src/js_module_info/collector.rs : Module-level (thin) inference should resolve `TypeReference::Qualifier` variants to `TypeReference::Resolved` or `TypeReference::Import` as appropriate, but cannot resolve imports across modules. Implemented in `../biome_module_graph/src/js_module_info/collector.rs`.

Applied to files:

  • crates/biome_resolver/tests/spec_tests.rs
  • crates/biome_module_graph/src/js_module_info/visitor.rs
📚 Learning: 2025-08-05T14:51:23.437Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:23.437Z
Learning: Applies to crates/biome_js_type_info/src/local_inference.rs : Local type inference should only create type references and not resolve them to concrete types. Local inference is implemented in `src/local_inference.rs`.

Applied to files:

  • crates/biome_module_graph/src/js_module_info/visitor.rs
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/*.rs : When implementing custom syntax tree visitors, define a `Visitor` struct and implement the `Visitor` trait for efficient traversal.

Applied to files:

  • crates/biome_module_graph/src/js_module_info/visitor.rs
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_rule_options/lib/*.rs : Use boxed slices (`Box<[Box<str>]>`) instead of `Vec<String>` for string arrays in rule options to save memory.

Applied to files:

  • crates/biome_module_graph/src/js_module_info/visitor.rs
  • crates/biome_resolver/src/lib.rs
📚 Learning: 2025-08-05T14:51:23.437Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:23.437Z
Learning: Applies to crates/biome_js_type_info/src/flattening.rs : Flattening of type expressions (e.g., reducing `TypeData::TypeofExpression` to a concrete type) should be implemented in `src/flattening.rs`.

Applied to files:

  • crates/biome_module_graph/src/js_module_info/visitor.rs
📚 Learning: 2025-08-05T14:51:23.437Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:23.437Z
Learning: Applies to crates/biome_js_type_info/src/type_info.rs : The `TypeData` enum, defined in `src/type_info.rs`, is the central data structure for type information and should be extended to cover all relevant TypeScript types.

Applied to files:

  • crates/biome_module_graph/src/js_module_info/visitor.rs
📚 Learning: 2025-08-05T14:51:05.640Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:05.640Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : For tokens that are not mandatory, use the provided helper functions when formatting AST nodes.

Applied to files:

  • crates/biome_module_graph/src/js_module_info/visitor.rs
📚 Learning: 2025-08-05T14:51:51.355Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:51.355Z
Learning: Applies to crates/biome_parser/crates/biome_*/**/*.rs : Use conditional syntax handling to add diagnostics if a syntax is not supported in the current file or context, and wrap invalid syntax in a `BOGUS` node if necessary.

Applied to files:

  • crates/biome_module_graph/src/js_module_info/visitor.rs
  • crates/biome_resolver/src/lib.rs
📚 Learning: 2025-08-05T14:43:29.581Z
Learnt from: dyc3
PR: biomejs/biome#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:

  • .changeset/petite-waves-love.md
📚 Learning: 2025-08-05T14:49:35.574Z
Learnt from: CR
PR: biomejs/biome#0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:49:35.574Z
Learning: Applies to .changeset/*.md : Changeset descriptions should be about user-facing changes, use past tense for what you did, present tense for Biome behavior, reference issues/rules/assists with links, include code blocks when applicable, and end every sentence with a full stop.

Applied to files:

  • .changeset/petite-waves-love.md
📚 Learning: 2025-08-05T14:49:35.574Z
Learnt from: CR
PR: biomejs/biome#0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:49:35.574Z
Learning: Create changesets for user-facing bugfixes or features using `just new-changeset`.

Applied to files:

  • .changeset/petite-waves-love.md
📚 Learning: 2025-08-05T14:49:35.574Z
Learnt from: CR
PR: biomejs/biome#0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:49:35.574Z
Learning: For Node.js development, use the `packages/biomejs/biome` module and follow the specified build and test steps.

Applied to files:

  • .changeset/petite-waves-love.md
📚 Learning: 2025-08-05T14:49:35.574Z
Learnt from: CR
PR: biomejs/biome#0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:49:35.574Z
Learning: Update generated documentation in the `next` branch of the website after a release using `BIOME_VERSION=<version> pnpm run codegen:all`.

Applied to files:

  • .changeset/petite-waves-love.md
📚 Learning: 2025-08-05T14:50:18.454Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: Applies to crates/biome_analyze/biome_rule_options/lib/*.rs : Rule options must be placed inside the `biome_rule_options` crate, with a file named after the rule (e.g., `use_this_convention.rs`).

Applied to files:

  • crates/biome_resolver/src/lib.rs
📚 Learning: 2025-08-05T14:51:59.193Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_service/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:59.193Z
Learning: Applies to crates/biome_service/src/workspace_watcher.rs : Keep the workspace state in sync with the filesystem using WorkspaceWatcher (src/workspace_watcher.rs)

Applied to files:

  • crates/biome_resolver/src/lib.rs
📚 Learning: 2025-08-05T14:51:23.437Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:23.437Z
Learning: Applies to crates/biome_js_type_info/src/type_info.rs : When using `ResolvedTypeData`, always use the correct `ResolverId` when resolving `TypeReference`s that are part of the type data; mistakes can lead to panics.

Applied to files:

  • crates/biome_resolver/src/lib.rs
📚 Learning: 2025-08-05T14:49:35.574Z
Learnt from: CR
PR: biomejs/biome#0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:49:35.574Z
Learning: Applies to **/Cargo.toml : Use path dependencies for dev-dependencies in Cargo.toml to avoid requiring published versions.

Applied to files:

  • crates/biome_resolver/src/lib.rs
📚 Learning: 2025-08-05T14:50:35.163Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_diagnostics/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:35.163Z
Learning: Applies to crates/biome_diagnostics/**/*.rs : Diagnostics should not simply state that something went wrong; they should explain why it went wrong. Add explanations in log advices, and show hyperlinks to relevant documentation pages if the user wants to know more.

Applied to files:

  • crates/biome_resolver/src/lib.rs
🔇 Additional comments (5)
crates/biome_resolver/src/lib.rs (5)

44-48: Good call: apply aliasing to absolute specifiers too.

Routing absolute specifiers through the alias-aware path keeps behaviour consistent across relative/absolute imports.


149-149: LGTM: alias-aware relative paths.

Forwarding relative resolution through the alias helper keeps semantics uniform.


838-838: Default is sensible.

Defaulting extension_alias to an empty slice is safe and keeps existing behaviour intact.


925-925: Correct: preserve alias config when removing manifests.

Carrying extension_alias here maintains expected behaviour for tsconfig-driven flows.


940-940: Good: disable aliasing in manifest-less resolution.

This prevents aliasing from affecting package.json main/types and similar cases.

Copy link
Member

@ematipico ematipico left a comment

Choose a reason for hiding this comment

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

I have a few questions

@siketyan siketyan requested a review from ematipico August 9, 2025 10:26
Copy link
Member

@ematipico ematipico left a comment

Choose a reason for hiding this comment

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

Looks good. The error handling part could be improved, but we can follow up later

"@biomejs/biome": patch
---

The resolver can now correctly resolve `.ts` files by `.js` extension if exists.
Copy link
Member

Choose a reason for hiding this comment

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

I believe a code snippet would help show what this means.

@siketyan siketyan merged commit 58f8102 into main Aug 10, 2025
30 checks passed
@siketyan siketyan deleted the feat/resolve-extension-alias branch August 10, 2025 12:22
@github-actions github-actions bot mentioned this pull request Aug 10, 2025
siketyan added a commit that referenced this pull request Aug 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Project Area: project A-Resolver Area: resolver

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

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