Conversation
|
WalkthroughThis PR updates documentation examples across several lint rules to add file-context and expect_diagnostic code-fence annotations, removes some redundant example sections, and adjusts minor formatting (e.g., indentation and header cleanup). It also adds two unit tests in biome_resolver to verify TypeScript path alias resolution using specific fixtures and ResolveOptions. No runtime logic or public API signatures are changed. Possibly related PRs
Suggested labels
Suggested reviewers
Pre-merge checks (3 passed)✅ Passed checks (3 passed)
Tip 👮 Agentic pre-merge checks are now available in preview!Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.
Please see the documentation for more information. Example: reviews:
pre_merge_checks:
custom_checks:
- name: "Undocumented Breaking Changes"
mode: "warning"
instructions: |
Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).Please share your feedback with us on this Discord post. ✨ Finishing Touches
🧪 Generate unit tests
Comment |
| } | ||
|
|
||
| #[test] | ||
| fn test_resolve_typescript_path_aliases2() { |
There was a problem hiding this comment.
This was accidentally added to the PR, but if it passes, I'll just leave it. An extra test won't hurt 😅
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (3)
crates/biome_js_analyze/src/lint/nursery/use_exhaustive_switch_cases.rs (1)
96-96: Consider narrowinglanguageto "ts".This rule relies on union-type semantics; using
language: "ts"may better reflect intent. If you deliberately keep it onjsto support JSDoc-typed JS, feel free to ignore.crates/biome_resolver/tests/spec_tests.rs (2)
374-406: Solid alias coverage.
- Verifies
@/components/Fooresolves fromsrc/as expected.- Negative case for
@/componentsis a nice guardrail.Minor nit: hoist shared
ResolveOptionsinto a local to reduce repetition.Apply locally within this test:
- assert_eq!( - resolve( - "@/components/Foo", - &base_dir.join("src"), - &fs, - &ResolveOptions { - default_files: &["index"], - extensions: &["ts", "js"], - ..Default::default() - } - ), + let options = ResolveOptions { default_files: &["index"], extensions: &["ts", "js"], ..Default::default() }; + assert_eq!( + resolve("@/components/Foo", &base_dir.join("src"), &fs, &options), Ok(Utf8PathBuf::from(format!( "{base_dir}/src/components/Foo.ts" ))) ); - assert_eq!( - resolve( - "@/components", - &base_dir, - &fs, - &ResolveOptions { - default_files: &["index"], - extensions: &["ts", "js"], - ..Default::default() - } - ), + assert_eq!( + resolve("@/components", &base_dir, &fs, &options), Err(ResolveError::NotFound) );
408-442: Good second fixture: alias + vendor module.Covers both TS path aliases and plain dependency resolution via a vendor directory. Naming nit:
test_resolve_typescript_path_aliases2could be more descriptive (e.g.test_resolve_ts_path_aliases_vendor_and_util), but not a blocker.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (7)
crates/biome_analyze/CONTRIBUTING.md(0 hunks)crates/biome_js_analyze/src/lint/correctness/no_private_imports.rs(3 hunks)crates/biome_js_analyze/src/lint/correctness/no_undeclared_dependencies.rs(0 hunks)crates/biome_js_analyze/src/lint/nursery/no_import_cycles.rs(1 hunks)crates/biome_js_analyze/src/lint/nursery/no_unresolved_imports.rs(1 hunks)crates/biome_js_analyze/src/lint/nursery/use_exhaustive_switch_cases.rs(2 hunks)crates/biome_resolver/tests/spec_tests.rs(1 hunks)
💤 Files with no reviewable changes (2)
- crates/biome_js_analyze/src/lint/correctness/no_undeclared_dependencies.rs
- crates/biome_analyze/CONTRIBUTING.md
🧰 Additional context used
📓 Path-based instructions (4)
crates/biome_*_{syntax,parser,formatter,analyze,factory,semantic}/**
📄 CodeRabbit inference engine (CLAUDE.md)
Maintain the per-language crate structure: biome_{lang}_{syntax,parser,formatter,analyze,factory,semantic}
Files:
crates/biome_js_analyze/src/lint/nursery/no_import_cycles.rscrates/biome_js_analyze/src/lint/nursery/no_unresolved_imports.rscrates/biome_js_analyze/src/lint/nursery/use_exhaustive_switch_cases.rscrates/biome_js_analyze/src/lint/correctness/no_private_imports.rs
crates/biome_*/**
📄 CodeRabbit inference engine (CLAUDE.md)
Place core crates under /crates/biome_*/
Files:
crates/biome_js_analyze/src/lint/nursery/no_import_cycles.rscrates/biome_js_analyze/src/lint/nursery/no_unresolved_imports.rscrates/biome_js_analyze/src/lint/nursery/use_exhaustive_switch_cases.rscrates/biome_js_analyze/src/lint/correctness/no_private_imports.rscrates/biome_resolver/tests/spec_tests.rs
**/*.rs
📄 CodeRabbit inference engine (CONTRIBUTING.md)
Format all Rust source files before committing (just f)
Files:
crates/biome_js_analyze/src/lint/nursery/no_import_cycles.rscrates/biome_js_analyze/src/lint/nursery/no_unresolved_imports.rscrates/biome_js_analyze/src/lint/nursery/use_exhaustive_switch_cases.rscrates/biome_js_analyze/src/lint/correctness/no_private_imports.rscrates/biome_resolver/tests/spec_tests.rs
**/tests/**
📄 CodeRabbit inference engine (CLAUDE.md)
Place test files under a tests/ directory in each crate
Files:
crates/biome_resolver/tests/spec_tests.rs
🧠 Learnings (15)
📚 Learning: 2025-09-05T09:13:58.901Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-09-05T09:13:58.901Z
Learning: Applies to crates/biome_analyze/crates/biome_js_analyze/lib/src/lint/nursery/**/*.rs : Place all new rules in the nursery group under biome_js_analyze/lib/src/lint/nursery
Applied to files:
crates/biome_js_analyze/src/lint/nursery/no_import_cycles.rscrates/biome_js_analyze/src/lint/nursery/no_unresolved_imports.rscrates/biome_js_analyze/src/lint/nursery/use_exhaustive_switch_cases.rscrates/biome_js_analyze/src/lint/correctness/no_private_imports.rs
📚 Learning: 2025-09-05T09:13:58.901Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-09-05T09:13:58.901Z
Learning: Applies to crates/biome_analyze/crates/biome_js_analyze/**/src/**/*.rs : In declare_lint_rule! metadata, set version: "next"
Applied to files:
crates/biome_js_analyze/src/lint/nursery/no_import_cycles.rscrates/biome_js_analyze/src/lint/nursery/no_unresolved_imports.rscrates/biome_js_analyze/src/lint/nursery/use_exhaustive_switch_cases.rscrates/biome_js_analyze/src/lint/correctness/no_private_imports.rs
📚 Learning: 2025-09-05T09:13:58.901Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-09-05T09:13:58.901Z
Learning: Applies to crates/biome_analyze/crates/biome_js_analyze/**/src/**/*.rs : If a rule provides a code action, declare fix_kind in declare_lint_rule!
Applied to files:
crates/biome_js_analyze/src/lint/nursery/no_import_cycles.rscrates/biome_js_analyze/src/lint/nursery/no_unresolved_imports.rscrates/biome_js_analyze/src/lint/nursery/use_exhaustive_switch_cases.rscrates/biome_js_analyze/src/lint/correctness/no_private_imports.rs
📚 Learning: 2025-09-05T09:13:58.901Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-09-05T09:13:58.901Z
Learning: Applies to crates/biome_analyze/crates/biome_js_analyze/**/src/**/*.rs : When porting a lint rule, set sources in declare_lint_rule! (RuleSource::Eslint(...).same() or .inspired())
Applied to files:
crates/biome_js_analyze/src/lint/nursery/no_unresolved_imports.rscrates/biome_js_analyze/src/lint/nursery/use_exhaustive_switch_cases.rscrates/biome_js_analyze/src/lint/correctness/no_private_imports.rs
📚 Learning: 2025-09-05T09:13:58.901Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-09-05T09:13:58.901Z
Learning: Applies to crates/biome_analyze/crates/biome_js_analyze/**/src/**/*.rs : When deprecating a rule, add deprecated: "<reason>" to declare_lint_rule!
Applied to files:
crates/biome_js_analyze/src/lint/nursery/no_unresolved_imports.rscrates/biome_js_analyze/src/lint/nursery/use_exhaustive_switch_cases.rs
📚 Learning: 2025-09-05T09:13:58.901Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-09-05T09:13:58.901Z
Learning: Applies to crates/biome_analyze/crates/biome_js_analyze/**/src/**/*.rs : Set the language field in declare_lint_rule! to the most specific applicable language (js/jsx/ts/tsx)
Applied to files:
crates/biome_js_analyze/src/lint/nursery/no_unresolved_imports.rscrates/biome_js_analyze/src/lint/nursery/use_exhaustive_switch_cases.rs
📚 Learning: 2025-09-07T17:35:00.490Z
Learnt from: CR
PR: biomejs/biome#0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-09-07T17:35:00.490Z
Learning: Update documentation when features change; for rules/assists/options, use inline Rust rustdoc
Applied to files:
crates/biome_js_analyze/src/lint/nursery/no_unresolved_imports.rscrates/biome_js_analyze/src/lint/nursery/use_exhaustive_switch_cases.rs
📚 Learning: 2025-09-05T09:13:58.901Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-09-05T09:13:58.901Z
Learning: Applies to crates/biome_analyze/crates/biome_js_analyze/tests/specs/nursery/** : Place snapshot test cases for new rules under tests/specs/nursery/<ruleName>/ with files prefixed by invalid/valid
Applied to files:
crates/biome_js_analyze/src/lint/nursery/use_exhaustive_switch_cases.rs
📚 Learning: 2025-09-05T09:13:58.901Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-09-05T09:13:58.901Z
Learning: Applies to crates/biome_analyze/crates/biome_js_analyze/tests/quick_test.rs : Use quick_test.rs for ad-hoc testing; set RuleFilter to the rule (e.g., RuleFilter::Rule("nursery", "useAwesomeTrick")) and adjust SOURCE
Applied to files:
crates/biome_js_analyze/src/lint/nursery/use_exhaustive_switch_cases.rs
📚 Learning: 2025-09-05T09:13:58.901Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-09-05T09:13:58.901Z
Learning: Applies to crates/biome_analyze/crates/biome_js_analyze/**/src/**/*.rs : Avoid deep indentation and unwrap/expect in CST navigation; prefer ?, map, filter, and_then
Applied to files:
crates/biome_js_analyze/src/lint/nursery/use_exhaustive_switch_cases.rs
📚 Learning: 2025-08-11T11:50:12.090Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:50:12.090Z
Learning: Applies to crates/biome_js_type_info/{src,resolver,biome_module_graph/src}/**/*.rs : Implement and use type resolution via the TypeResolver trait; resolvers own TypeStore vectors and provide fast by-id and hashed lookups
Applied to files:
crates/biome_resolver/tests/spec_tests.rs
📚 Learning: 2025-08-11T11:48:27.774Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:48:27.774Z
Learning: Applies to crates/biome_formatter/biome_html_formatter/tests/spec_test.rs : Create tests/spec_test.rs implementing the run(spec_input_file, _expected_file, test_directory, _file_type) function as shown and include!("language.rs")
Applied to files:
crates/biome_resolver/tests/spec_tests.rs
📚 Learning: 2025-08-11T11:48:27.774Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:48:27.774Z
Learning: Applies to crates/biome_formatter/biome_html_formatter/tests/spec_tests.rs : Create tests/spec_tests.rs in the biome_html_formatter crate that generates tests via tests_macros::gen_tests! for all HTML files at tests/specs/html/**/*.html
Applied to files:
crates/biome_resolver/tests/spec_tests.rs
📚 Learning: 2025-08-11T11:53:15.299Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_service/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:53:15.299Z
Learning: Applies to crates/biome_service/src/workspace/watcher.tests.rs : Place watcher tests for workspace methods in src/workspace/watcher.tests.rs
Applied to files:
crates/biome_resolver/tests/spec_tests.rs
📚 Learning: 2025-08-11T11:53:15.299Z
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_service/CONTRIBUTING.md:0-0
Timestamp: 2025-08-11T11:53:15.299Z
Learning: Applies to crates/biome_service/../biome_lsp/src/server.tests.rs : Keep end-to-end LSP tests in biome_lsp’s server.tests.rs
Applied to files:
crates/biome_resolver/tests/spec_tests.rs
🧬 Code graph analysis (1)
crates/biome_resolver/tests/spec_tests.rs (1)
crates/biome_resolver/src/lib.rs (6)
new(798-810)new(1027-1029)resolve(31-59)from(1009-1011)from(1015-1017)from(1021-1023)
⏰ 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 Node.js API
- GitHub Check: Bench (biome_css_parser)
- GitHub Check: Bench (biome_json_formatter)
- GitHub Check: Documentation
- GitHub Check: Test (depot-windows-2022-16)
- GitHub Check: Test (depot-ubuntu-24.04-arm-16)
- GitHub Check: Bench (biome_configuration)
- GitHub Check: Lint project (depot-windows-2022)
- GitHub Check: Check Dependencies
- GitHub Check: Bench (biome_html_parser)
- GitHub Check: Bench (biome_module_graph)
- GitHub Check: Bench (biome_package)
- GitHub Check: Bench (biome_json_parser)
- GitHub Check: Bench (biome_graphql_parser)
- GitHub Check: Bench (biome_html_formatter)
- GitHub Check: Bench (biome_json_analyze)
- GitHub Check: Bench (biome_js_analyze)
- GitHub Check: Lint project (depot-ubuntu-24.04-arm-16)
- GitHub Check: Bench (biome_graphql_formatter)
- GitHub Check: Bench (biome_css_analyze)
- GitHub Check: Bench (biome_js_formatter)
- GitHub Check: Bench (biome_css_formatter)
- GitHub Check: Bench (biome_js_parser)
- GitHub Check: autofix
🔇 Additional comments (4)
crates/biome_js_analyze/src/lint/nursery/no_import_cycles.rs (1)
39-39: Doc fence tweak looks good.The top-level import now aligns with the other lines in the snippet. Nice consistency win.
crates/biome_js_analyze/src/lint/nursery/use_exhaustive_switch_cases.rs (1)
33-33: Good move: add file-context and diagnostic annotations.These will help the doc-tests map cleanly to fixtures. All good.
Also applies to: 55-55
crates/biome_js_analyze/src/lint/nursery/no_unresolved_imports.rs (1)
34-41: Nice cleanup on per-file code fences.Using
file=andexpect_diagnosticmakes the examples unambiguous and test-harness friendly. Looks tidy.Also applies to: 45-52
crates/biome_js_analyze/src/lint/correctness/no_private_imports.rs (1)
92-98: Examples now map cleanly to files—LGTM.The added annotations improve clarity (especially around tests and nested modules). No functional changes—happy path.
Also applies to: 99-109, 110-116, 119-128, 130-135
CodSpeed Performance ReportMerging #7462 will not alter performanceComparing Summary
|
Summary
Cleaned up file name annotations in the docs for multi-file rules besides
noImportCycles.Test Plan
We need to check the docs on the website.
Docs
N/A