Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@siketyan
Copy link
Member

@siketyan siketyan commented Aug 7, 2025

Summary

Cherry-picking #7017 to the main branch based on @ematipico 's suggestion.
I also improved the changeset by adding an example config to keep the old behaviour.

Test Plan

Added snapshot tests.

Docs

Updated the doc comments so it will be synced to the website.

@siketyan siketyan self-assigned this Aug 7, 2025
@changeset-bot
Copy link

changeset-bot bot commented Aug 7, 2025

🦋 Changeset detected

Latest commit: 9c82a02

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

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 7, 2025

Walkthrough

This change introduces an ignoreTypes option to the noImportCycles lint rule, allowing users to ignore type-only imports when detecting import cycles. The default behaviour now skips type-only imports in cycle checks, with an explicit configuration required to revert to the previous behaviour. Supporting changes span the linter rule, configuration schema, module graph structures (now tracking import phases), and associated tests and documentation. The update also modifies related lint rules and internal APIs to use the new JsImportPath structure, which includes import phase metadata.

Possibly related issues

Possibly related PRs

Suggested reviewers

  • ematipico
  • arendjr

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 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 7916be6 and 9c82a02.

📒 Files selected for processing (2)
  • .changeset/shaky-experts-sit.md (1 hunks)
  • crates/biome_module_graph/tests/spec_tests.rs (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • .changeset/shaky-experts-sit.md
  • crates/biome_module_graph/tests/spec_tests.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). (26)
  • GitHub Check: Lint project (depot-windows-2022)
  • GitHub Check: Lint project (depot-ubuntu-24.04-arm-16)
  • GitHub Check: Test (depot-ubuntu-24.04-arm-16)
  • GitHub Check: End-to-end tests
  • GitHub Check: Check Dependencies
  • GitHub Check: Documentation
  • GitHub Check: Test (depot-windows-2022-16)
  • GitHub Check: autofix
  • GitHub Check: Bench (biome_html_formatter)
  • GitHub Check: Bench (biome_module_graph)
  • GitHub Check: Bench (biome_configuration)
  • GitHub Check: Bench (biome_html_parser)
  • GitHub Check: Bench (biome_graphql_parser)
  • GitHub Check: Bench (biome_graphql_formatter)
  • GitHub Check: Bench (biome_js_parser)
  • GitHub Check: Bench (biome_package)
  • GitHub Check: Bench (biome_json_analyze)
  • GitHub Check: Bench (biome_json_formatter)
  • GitHub Check: Test Node.js API
  • GitHub Check: Check JS Files
  • GitHub Check: Bench (biome_css_formatter)
  • GitHub Check: Bench (biome_json_parser)
  • GitHub Check: Bench (biome_css_parser)
  • GitHub Check: Bench (biome_css_analyze)
  • GitHub Check: Bench (biome_js_formatter)
  • GitHub Check: Bench (biome_js_analyze)
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

🪧 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-Linter Area: linter L-JavaScript Language: JavaScript and super languages labels Aug 7, 2025
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/tests/specs/nursery/noImportCycles/ignoreTypes/b.ts (1)

4-4: Minor: Consider test export uniqueness.

Both this file and types.ts export the same Foo type alias. While not incorrect, using distinct exports might make the test scenarios clearer.

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

19-20: Consolidate the two use biome_module_graph::{ … } statements

There’s now a pair of adjacent use biome_module_graph::{ … } blocks. Merging them keeps the prelude tidy and avoids accidental duplication later on.

-use biome_module_graph::{ImportSymbol, JsImport, JsReexport, ModuleGraph, ModuleResolver, ResolvedPath,};
-use biome_module_graph::{JsExport, JsImportPath, JsImportPhase};
+use biome_module_graph::{
+    ImportSymbol, JsImport, JsReexport, JsExport, JsImportPath, JsImportPhase,
+    ModuleGraph, ModuleResolver, ResolvedPath,
+};
.changeset/shaky-experts-sit.md (1)

8-8: Fix subject-verb agreement error.

"The noImportCycles no longer detect" should be "no longer detects" (singular verb form).

-> **Breaking Change**: The `noImportCycles` no longer detect import cycles that includes one or more type-only imports.
+> **Breaking Change**: The `noImportCycles` no longer detects import cycles that include one or more type-only imports.

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.

Thank you!

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/shaky-experts-sit.md (1)

8-10: Plural agreement + full-stop polish

Minor copy-editing to align with grammar rules and the changeset guidelines (every sentence ends with a full stop).

- > **Breaking Change**: The `noImportCycles` no longer detects import cycles that includes one or more type-only imports.
+ > **Breaking Change**: The `noImportCycles` rule no longer detects import cycles that include one or more type-only imports.
- > To keep the old behaviour, you can turn off the `ignoreTypes` option explicitly:
+ > To keep the old behaviour, you can turn off the `ignoreTypes` option explicitly as follows.
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 2054495 and 7916be6.

📒 Files selected for processing (2)
  • .changeset/shaky-experts-sit.md (1 hunks)
  • crates/biome_module_graph/tests/spec_tests.rs (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • crates/biome_module_graph/tests/spec_tests.rs
🧰 Additional context used
📓 Path-based instructions (1)
.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/shaky-experts-sit.md
🧠 Learnings (11)
📓 Common learnings
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:50:18.454Z
Learning: You are encouraged to split the work for a new rule into multiple PRs and describe your plan in an issue if unfamiliar with Biome's APIs.
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 : If a lint rule is ported from another ecosystem (e.g., ESLint), add a `sources` metadata field in `declare_lint_rule!` referencing the original rule.
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_service/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:59.193Z
Learning: Use the noImportCycles rule to observe the state in the project layout and module graph
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`).
📚 Learning: the file `packages/@biomejs/biome/configuration_schema.json` is auto-generated and should not be man...
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/shaky-experts-sit.md
📚 Learning: applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/*.rs : update the `language` field in `...
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/shaky-experts-sit.md
📚 Learning: use the noimportcycles rule to observe the state in the project layout and module graph...
Learnt from: CR
PR: biomejs/biome#0
File: crates/biome_service/CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:51:59.193Z
Learning: Use the noImportCycles rule to observe the state in the project layout and module graph

Applied to files:

  • .changeset/shaky-experts-sit.md
📚 Learning: applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/*.rs : if a lint rule is ported from an...
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 : If a lint rule is ported from another ecosystem (e.g., ESLint), add a `sources` metadata field in `declare_lint_rule!` referencing the original rule.

Applied to files:

  • .changeset/shaky-experts-sit.md
📚 Learning: applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/*.rs : the `version` field in `declare_...
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 : The `version` field in `declare_lint_rule!` must be set to `next` for new rules.

Applied to files:

  • .changeset/shaky-experts-sit.md
📚 Learning: applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/*.rs : if a rule provides a code action...
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 : If a rule provides a code action, add the `fix_kind` metadata to the `declare_lint_rule!` macro and implement the `action` function.

Applied to files:

  • .changeset/shaky-experts-sit.md
📚 Learning: applies to .changeset/*.md : changeset descriptions should be about user-facing changes, use past te...
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/shaky-experts-sit.md
📚 Learning: applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/*.rs : when deprecating a rule, specify...
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 deprecating a rule, specify the reason using the `deprecated:` field in the `declare_lint_rule!` macro.

Applied to files:

  • .changeset/shaky-experts-sit.md
📚 Learning: applies to crates/biome_lint_rules/**/*.rs : linter rules must have a `version` metadata field in th...
Learnt from: CR
PR: biomejs/biome#0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-08-05T14:49:35.574Z
Learning: Applies to crates/biome_lint_rules/**/*.rs : Linter rules must have a `version` metadata field in their implementation, set to "next" for new rules and updated to the new version when releasing.

Applied to files:

  • .changeset/shaky-experts-sit.md
📚 Learning: applies to crates/biome_analyze/biome_*/lib/src/lint/nursery/*.rs : new rules must be placed inside ...
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 : New rules must be placed inside the `nursery` group for incubation before promotion.

Applied to files:

  • .changeset/shaky-experts-sit.md
🪛 LanguageTool
.changeset/shaky-experts-sit.md

[grammar] ~8-~8: Possible subject-verb agreement error detected.
Context: ...s` no longer detects import cycles that includes one or more type-only imports. > To kee...

(PLURAL_THAT_AGREEMENT)

⏰ 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). (26)
  • GitHub Check: End-to-end tests
  • GitHub Check: Test (depot-windows-2022-16)
  • GitHub Check: Lint project (depot-ubuntu-24.04-arm-16)
  • GitHub Check: Documentation
  • GitHub Check: Test (depot-ubuntu-24.04-arm-16)
  • GitHub Check: Lint project (depot-windows-2022)
  • GitHub Check: Check Dependencies
  • GitHub Check: Test Node.js API
  • GitHub Check: Bench (biome_module_graph)
  • GitHub Check: Bench (biome_package)
  • GitHub Check: Bench (biome_configuration)
  • GitHub Check: Bench (biome_css_analyze)
  • GitHub Check: Bench (biome_js_formatter)
  • GitHub Check: Bench (biome_html_formatter)
  • GitHub Check: Bench (biome_graphql_formatter)
  • GitHub Check: Bench (biome_html_parser)
  • GitHub Check: Bench (biome_json_analyze)
  • GitHub Check: Bench (biome_json_formatter)
  • GitHub Check: Bench (biome_css_formatter)
  • GitHub Check: Bench (biome_graphql_parser)
  • GitHub Check: Bench (biome_css_parser)
  • GitHub Check: Bench (biome_js_analyze)
  • GitHub Check: Bench (biome_js_parser)
  • GitHub Check: Bench (biome_json_parser)
  • GitHub Check: Check JS Files
  • GitHub Check: autofix

@codspeed-hq
Copy link

codspeed-hq bot commented Aug 7, 2025

CodSpeed Performance Report

Merging #7143 will not alter performance

Comparing siketyan:feat/GH-6799 (9c82a02) with main (9f4538a)1

Summary

✅ 128 untouched benchmarks

Footnotes

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

@siketyan siketyan merged commit 1a6933a into biomejs:main Aug 7, 2025
31 checks passed
@siketyan siketyan deleted the feat/GH-6799 branch August 7, 2025 14:18
@github-actions github-actions bot mentioned this pull request Aug 6, 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-Project Area: project L-JavaScript Language: JavaScript and super languages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants