Skip to content

chore: cleanup file annotations#7462

Merged
arendjr merged 1 commit intobiomejs:mainfrom
arendjr:cleanup-file-annotations
Sep 10, 2025
Merged

chore: cleanup file annotations#7462
arendjr merged 1 commit intobiomejs:mainfrom
arendjr:cleanup-file-annotations

Conversation

@arendjr
Copy link
Contributor

@arendjr arendjr commented Sep 10, 2025

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

@changeset-bot
Copy link

changeset-bot bot commented Sep 10, 2025

⚠️ No Changeset found

Latest commit: 4c794bb

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

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 10, 2025

Walkthrough

This 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

A-Linter, L-JavaScript, A-Resolver

Suggested reviewers

  • siketyan

Pre-merge checks (3 passed)

✅ Passed checks (3 passed)
Check name Status Explanation
Title Check ✅ Passed The title ‘chore: cleanup file annotations’ accurately and succinctly captures the primary change of cleaning up file name annotations in documentation examples across multiple lint rules without touching any code logic, and it adheres to conventional commit style for clear history scanning.
Description Check ✅ Passed The description directly references the documentation cleanup of file name annotations for multi-file rules and includes a relevant test plan, ensuring it stays on topic and aligns with the actual changeset.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

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.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

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 Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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

@github-actions github-actions bot added A-Linter Area: linter L-JavaScript Language: JavaScript and super languages A-Resolver Area: resolver labels Sep 10, 2025
}

#[test]
fn test_resolve_typescript_path_aliases2() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was accidentally added to the PR, but if it passes, I'll just leave it. An extra test won't hurt 😅

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (3)
crates/biome_js_analyze/src/lint/nursery/use_exhaustive_switch_cases.rs (1)

96-96: Consider narrowing language to "ts".

This rule relies on union-type semantics; using language: "ts" may better reflect intent. If you deliberately keep it on js to support JSDoc-typed JS, feel free to ignore.

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

374-406: Solid alias coverage.

  • Verifies @/components/Foo resolves from src/ as expected.
  • Negative case for @/components is a nice guardrail.

Minor nit: hoist shared ResolveOptions into 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_aliases2 could 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

📥 Commits

Reviewing files that changed from the base of the PR and between aa06833 and 4c794bb.

📒 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.rs
  • crates/biome_js_analyze/src/lint/nursery/no_unresolved_imports.rs
  • crates/biome_js_analyze/src/lint/nursery/use_exhaustive_switch_cases.rs
  • crates/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.rs
  • crates/biome_js_analyze/src/lint/nursery/no_unresolved_imports.rs
  • crates/biome_js_analyze/src/lint/nursery/use_exhaustive_switch_cases.rs
  • crates/biome_js_analyze/src/lint/correctness/no_private_imports.rs
  • crates/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.rs
  • crates/biome_js_analyze/src/lint/nursery/no_unresolved_imports.rs
  • crates/biome_js_analyze/src/lint/nursery/use_exhaustive_switch_cases.rs
  • crates/biome_js_analyze/src/lint/correctness/no_private_imports.rs
  • crates/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.rs
  • crates/biome_js_analyze/src/lint/nursery/no_unresolved_imports.rs
  • crates/biome_js_analyze/src/lint/nursery/use_exhaustive_switch_cases.rs
  • crates/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.rs
  • crates/biome_js_analyze/src/lint/nursery/no_unresolved_imports.rs
  • crates/biome_js_analyze/src/lint/nursery/use_exhaustive_switch_cases.rs
  • crates/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.rs
  • crates/biome_js_analyze/src/lint/nursery/no_unresolved_imports.rs
  • crates/biome_js_analyze/src/lint/nursery/use_exhaustive_switch_cases.rs
  • crates/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.rs
  • crates/biome_js_analyze/src/lint/nursery/use_exhaustive_switch_cases.rs
  • crates/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.rs
  • 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 : 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.rs
  • crates/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.rs
  • 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/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= and expect_diagnostic makes 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

@arendjr arendjr merged commit 490d355 into biomejs:main Sep 10, 2025
29 checks passed
@codspeed-hq
Copy link

codspeed-hq bot commented Sep 10, 2025

CodSpeed Performance Report

Merging #7462 will not alter performance

Comparing arendjr:cleanup-file-annotations (4c794bb) with main (aa06833)

Summary

✅ 133 untouched benchmarks

kedevked pushed a commit to kedevked/biome that referenced this pull request Sep 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Linter Area: linter A-Resolver Area: resolver L-JavaScript Language: JavaScript and super languages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants