Skip to content

perf(noImportCycles): exclude node_modules from cycle detection#9326

Merged
dyc3 merged 1 commit intomainfrom
dyc3/perf-import-cycles
Mar 4, 2026
Merged

perf(noImportCycles): exclude node_modules from cycle detection#9326
dyc3 merged 1 commit intomainfrom
dyc3/perf-import-cycles

Conversation

@dyc3
Copy link
Copy Markdown
Contributor

@dyc3 dyc3 commented Mar 4, 2026

Summary

Any given project is going to have a pretty chunky node_modules. I think it makes sense to explicitly forbid noImportCycles from going into the project's dependencies. My logic here is that is that dependencies don't import packages from user code, so it should be ok to skip evaluating for cycles once we get to a dependency.

Users could get this behavior by excluding it with !!node_modules/, but that means the scanner would never touch those files, and types wouldn't get resolved from their dependencies.

Test Plan

snapshots

Docs

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Mar 4, 2026

🦋 Changeset detected

Latest commit: d94f936

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 Mar 4, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 4, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 585717f1-e1cf-4674-8f04-3d4c6937f58a

📥 Commits

Reviewing files that changed from the base of the PR and between d5ee469 and d94f936.

📒 Files selected for processing (2)
  • .changeset/some-badgers-move.md
  • crates/biome_js_analyze/src/lint/suspicious/no_import_cycles.rs

Walkthrough

This pull request adds a changeset entry documenting a patch release for Biome and optimises the noImportCycles lint rule. The implementation excludes node_modules directories from cycle detection by introducing an is_node_modules_path helper function and adding early return guards in two control flow locations: during initial import path resolution and within the cycle traversal loop.

Suggested labels

A-Linter, L-JavaScript

Suggested reviewers

  • ematipico
🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarises the main change: excluding node_modules from cycle detection in the noImportCycles rule for performance improvement.
Description check ✅ Passed The description provides clear motivation, rationale, and test plan directly related to the changeset's purpose of improving noImportCycles performance.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch dyc3/perf-import-cycles

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


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

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Mar 4, 2026

Merging this PR will not alter performance

✅ 58 untouched benchmarks
⏩ 156 skipped benchmarks1


Comparing dyc3/perf-import-cycles (d94f936) with main (6294aa2)2

Open in CodSpeed

Footnotes

  1. 156 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.

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

@dyc3 dyc3 requested review from a team March 4, 2026 14:26
@dyc3 dyc3 merged commit 85dfe9b into main Mar 4, 2026
32 checks passed
@dyc3 dyc3 deleted the dyc3/perf-import-cycles branch March 4, 2026 14:27
@github-actions github-actions bot mentioned this pull request Mar 4, 2026
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.

2 participants