Skip to content

Conversation

@db295
Copy link
Contributor

@db295 db295 commented Nov 12, 2025

Summary

Fixes #7876

Test Plan

Docs

@changeset-bot
Copy link

changeset-bot bot commented Nov 12, 2025

🦋 Changeset detected

Latest commit: 9fe4427

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

@github-actions github-actions bot added A-Linter Area: linter L-JavaScript Language: JavaScript and super languages labels Nov 12, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 12, 2025

Walkthrough

The JSDoc/TSDoc inline-tag regex in the noUnusedImports lint was extended to recognise the inline link variants {@linkcode ...} and {@linkplain ...} in addition to the existing {@link ...} and {@see ...}. Two TypeScript test files covering {@linkcode} and {@linkplain} usages were added, plus a changeset documenting the change. No other logic, error handling, or public API declarations were modified.

Suggested reviewers

  • ematipico
  • siketyan

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed Title clearly identifies the main change: extending noUnusedImports to recognise {@linkcode} tags alongside {@link}.
Description check ✅ Passed Description references issue #7876, which is the core objective, though implementation details are sparse.
Linked Issues check ✅ Passed Changes successfully implement all coding requirements from #7876: regex updated to include {@linkcode} and {@linkplain}, test files added covering both variants.
Out of Scope Changes check ✅ Passed All changes directly address #7876; regex update, test files, and changeset are all within scope and related to JSDoc inline tag support.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

📝 Customizable high-level summaries are now available in beta!

You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.

  • Provide your own instructions using the high_level_summary_instructions setting.
  • Format the summary however you like (bullet lists, tables, multi-section layouts, contributor stats, etc.).
  • Use high_level_summary_in_walkthrough to move the summary from the description to the walkthrough section.

Example instruction:

"Divide the high-level summary into five sections:

  1. 📝 Description — Summarize the main change in 50–60 words, explaining what was done.
  2. 📓 References — List relevant issues, discussions, documentation, or related PRs.
  3. 📦 Dependencies & Requirements — Mention any new/updated dependencies, environment variable changes, or configuration updates.
  4. 📊 Contributor Summary — Include a Markdown table showing contributions:
    | Contributor | Lines Added | Lines Removed | Files Changed |
  5. ✔️ Additional Notes — Add any extra reviewer context.
    Keep each section concise (under 200 words) and use bullet or numbered lists for clarity."

Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

📜 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 5cd3d27 and a9c94af.

📒 Files selected for processing (1)
  • crates/biome_js_analyze/src/lint/correctness/no_unused_imports.rs (1 hunks)
🧰 Additional context used
🧠 Learnings (5)
📚 Learning: 2025-10-15T09:23:33.055Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:23:33.055Z
Learning: Applies to crates/biome_js_type_info/src/type_info.rs : Add new TypeScript type support by extending the TypeData enum rather than introducing parallel structures.

Applied to files:

  • crates/biome_js_analyze/src/lint/correctness/no_unused_imports.rs
📚 Learning: 2025-10-15T09:23:33.055Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:23:33.055Z
Learning: Applies to crates/biome_js_type_info/src/{type_info,local_inference,resolver,flattening}.rs : Avoid recursive type structures and cross-module Arcs; represent links between types using TypeReference and TypeData::Reference.

Applied to files:

  • crates/biome_js_analyze/src/lint/correctness/no_unused_imports.rs
📚 Learning: 2025-10-15T09:23:33.055Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:23:33.055Z
Learning: Applies to crates/biome_js_type_info/biome_module_graph/src/js_module_info/collector.rs : Thin (module-level) inference should resolve local and global bindings to TypeReference::Resolved, mark imported bindings as TypeReference::Import, and fall back to TypeReference::Unknown if unresolved.

Applied to files:

  • crates/biome_js_analyze/src/lint/correctness/no_unused_imports.rs
📚 Learning: 2025-10-15T09:22:46.002Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:22:46.002Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : Do not attempt to fix code; if a mandatory token/node is missing, return `None` instead

Applied to files:

  • crates/biome_js_analyze/src/lint/correctness/no_unused_imports.rs
📚 Learning: 2025-10-15T09:22:46.002Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:22:46.002Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : Import and use the `FormatNode` trait for AST nodes

Applied to files:

  • crates/biome_js_analyze/src/lint/correctness/no_unused_imports.rs

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.

The template of the issue should contain all the information to create a PR. I'll sum it up here:

  • we need a changeset that explains the fix to end-users
  • we need new tests to verify that the fix works

@db295 db295 force-pushed the fix/jsdoc-unused-linkcode branch from a9c94af to ff28068 Compare November 12, 2025 21:47
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: 2

🧹 Nitpick comments (1)
crates/biome_js_analyze/src/lint/correctness/no_unused_imports.rs (1)

167-168: Add test coverage for {@see ...} inline tag.

The regex includes see in the alternation, but neither test file exercises this pattern. Consider adding a test case using {@see SomeType} to verify the regex correctly prevents unused import warnings for this tag variant as well.

Based on the existing test file structure, you could add:

import type LinkOnSeeTag from "mod";

/**
 * {@see LinkOnSeeTag}
 */
function testSeeTag() { }
📜 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 a9c94af and ff28068.

⛔ Files ignored due to path filters (2)
  • crates/biome_js_analyze/tests/specs/correctness/noUnusedImports/issue_7876_tsdoc_linkcode.ts.snap is excluded by !**/*.snap and included by **
  • crates/biome_js_analyze/tests/specs/correctness/noUnusedImports/issue_7876_tsdoc_linkplain.ts.snap is excluded by !**/*.snap and included by **
📒 Files selected for processing (3)
  • crates/biome_js_analyze/src/lint/correctness/no_unused_imports.rs (1 hunks)
  • crates/biome_js_analyze/tests/specs/correctness/noUnusedImports/issue_7876_tsdoc_linkcode.ts (1 hunks)
  • crates/biome_js_analyze/tests/specs/correctness/noUnusedImports/issue_7876_tsdoc_linkplain.ts (1 hunks)
🧰 Additional context used
🧠 Learnings (7)
📚 Learning: 2025-10-15T09:23:33.055Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:23:33.055Z
Learning: Applies to crates/biome_js_type_info/src/type_info.rs : Add new TypeScript type support by extending the TypeData enum rather than introducing parallel structures.

Applied to files:

  • crates/biome_js_analyze/tests/specs/correctness/noUnusedImports/issue_7876_tsdoc_linkplain.ts
  • crates/biome_js_analyze/src/lint/correctness/no_unused_imports.rs
📚 Learning: 2025-10-15T09:25:05.698Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_service/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:25:05.698Z
Learning: Applies to crates/biome_service/../biome_lsp/src/server.tests.rs : Keep end-to-end LSP tests in ../biome_lsp/src/server.tests.rs

Applied to files:

  • crates/biome_js_analyze/tests/specs/correctness/noUnusedImports/issue_7876_tsdoc_linkplain.ts
📚 Learning: 2025-10-15T09:23:33.055Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:23:33.055Z
Learning: Applies to crates/biome_js_type_info/src/{type_info,local_inference,resolver,flattening}.rs : Avoid recursive type structures and cross-module Arcs; represent links between types using TypeReference and TypeData::Reference.

Applied to files:

  • crates/biome_js_analyze/src/lint/correctness/no_unused_imports.rs
📚 Learning: 2025-10-15T09:22:46.002Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:22:46.002Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : Do not attempt to fix code; if a mandatory token/node is missing, return `None` instead

Applied to files:

  • crates/biome_js_analyze/src/lint/correctness/no_unused_imports.rs
📚 Learning: 2025-10-15T09:22:46.002Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:22:46.002Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : Import and use the `FormatNode` trait for AST nodes

Applied to files:

  • crates/biome_js_analyze/src/lint/correctness/no_unused_imports.rs
📚 Learning: 2025-10-15T09:22:15.851Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:22:15.851Z
Learning: Applies to crates/biome_formatter/src/**/*.rs : After generation, remove usages of `format_verbatim_node` and implement real formatting with biome_formatter utilities

Applied to files:

  • crates/biome_js_analyze/src/lint/correctness/no_unused_imports.rs
📚 Learning: 2025-10-15T09:23:33.055Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:23:33.055Z
Learning: Applies to crates/biome_js_type_info/biome_module_graph/src/js_module_info/collector.rs : Thin (module-level) inference should resolve local and global bindings to TypeReference::Resolved, mark imported bindings as TypeReference::Import, and fall back to TypeReference::Unknown if unresolved.

Applied to files:

  • crates/biome_js_analyze/src/lint/correctness/no_unused_imports.rs
🔇 Additional comments (1)
crates/biome_js_analyze/src/lint/correctness/no_unused_imports.rs (1)

168-168: Regex pattern correctly expanded to support linkcode and linkplain tags.

The addition of linkcode and linkplain to the inline tag regex properly addresses issue #7876 and aligns with the JSDoc specification for inline link tags.

@db295 db295 force-pushed the fix/jsdoc-unused-linkcode branch from ff28068 to 131cfc6 Compare November 12, 2025 21:56
@db295 db295 requested a review from ematipico November 12, 2025 22:11
@ematipico
Copy link
Member

@db295 we still need a changeset

@codspeed-hq
Copy link

codspeed-hq bot commented Nov 13, 2025

CodSpeed Performance Report

Merging #8088 will not alter performance

Comparing db295:fix/jsdoc-unused-linkcode (9fe4427) with main (7fdcec8)1

Summary

✅ 58 untouched
⏩ 95 skipped2

Footnotes

  1. No successful run was found on main (575129a) during the generation of this report, so 7fdcec8 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

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

@db295 db295 force-pushed the fix/jsdoc-unused-linkcode branch from 45c39e7 to d81cb50 Compare November 13, 2025 16:59
@db295 db295 force-pushed the fix/jsdoc-unused-linkcode branch from d81cb50 to 394b855 Compare November 13, 2025 17:21
@ematipico
Copy link
Member

@db295 it seems that you still miss something. You added new tests, but they are usually accompanied with snapshots being added or updated, this isn't the case.

I don't want to sound like a broken a record, but the contribution guide actually explains this part.

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 (1)
.changeset/forty-hornets-burn.md (1)

5-16: Documentation is clear; consider showing both new tags in the example.

The description accurately documents the fix and correctly references issue #7876. The code example effectively demonstrates @linkcode usage, but since both @linkcode and @linkplain are now supported, you might add a brief note or second example showing @linkplain for symmetry—though this is optional.

Also, ensure the test snapshots for the new test files (mentioned in your earlier changes) are generated and committed, as noted in prior feedback.

📜 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 1354a48 and bde8a4b.

📒 Files selected for processing (1)
  • .changeset/forty-hornets-burn.md (1 hunks)
🔇 Additional comments (1)
.changeset/forty-hornets-burn.md (1)

1-3: Changeset format is correct.

The YAML frontmatter properly specifies the package name and patch-level bump.

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.

The snapshot is there! I thought it was a typescript file 😓 thank you @db295 for the fix!

@ematipico ematipico added this pull request to the merge queue Nov 19, 2025
Merged via the queue into biomejs:main with commit 0eb08e8 Nov 19, 2025
17 checks passed
@github-actions github-actions bot mentioned this pull request Nov 19, 2025
ryan-m-walker pushed a commit to ryan-m-walker/biome that referenced this pull request Nov 23, 2025
…#8088)

Co-authored-by: D'or Banoun <[email protected]>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

💅 noUnusedImports doesn't recognize {@linkcode x} like it does with {@link x} in [JS|TS]Docs

3 participants