Skip to content

perf(noMagicNumbers): reduce allocations#9982

Merged
dyc3 merged 3 commits intomainfrom
dyc3/noMagicNumbers-perf-and-metadata
Apr 14, 2026
Merged

perf(noMagicNumbers): reduce allocations#9982
dyc3 merged 3 commits intomainfrom
dyc3/noMagicNumbers-perf-and-metadata

Conversation

@dyc3
Copy link
Copy Markdown
Contributor

@dyc3 dyc3 commented Apr 14, 2026

Summary

A small tweak to reduce string allocations, and a fix for the rule's sources.

Test Plan

green ci

Docs

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 14, 2026

🦋 Changeset detected

Latest commit: 7c18b7f

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

coderabbitai Bot commented Apr 14, 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: 87ce9047-5d21-47b6-8220-cbfff85a927a

📥 Commits

Reviewing files that changed from the base of the PR and between 9bee0b6 and 7c18b7f.

⛔ Files ignored due to path filters (1)
  • crates/biome_cli/src/execute/migrate/eslint_any_rule_to_biome.rs is excluded by !**/migrate/eslint_any_rule_to_biome.rs and included by **
📒 Files selected for processing (1)
  • .changeset/odd-wasps-fly.md
✅ Files skipped from review due to trivial changes (1)
  • .changeset/odd-wasps-fly.md

Walkthrough

A changeset was added to publish a patch release for @biomejs/biome. The noMagicNumbers linter rule was updated: its sources metadata now includes an additional ESLint no-magic-numbers entry, and is_allowed_number was refactored to extract numeric literal tokens via pattern matching (handling number and bigint literal expressions) and check the trimmed token text against the always-ignored set instead of deriving a key from to_trimmed_string().

Possibly related PRs

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 'perf(noMagicNumbers): reduce allocations' directly and specifically describes the main change - a performance improvement to the noMagicNumbers rule by reducing string allocations.
Description check ✅ Passed The description explains the motivation as 'a small tweak to reduce string allocations, and a fix for the rule's sources,' which aligns with the changeset and code modifications.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dyc3/noMagicNumbers-perf-and-metadata

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

Copy link
Copy Markdown
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: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.changeset/odd-wasps-fly.md:
- Line 5: Update the changeset text for `.changeset/odd-wasps-fly.md`: correct
the typo "it's" to "its", change the phrase "updated its source rule metadata"
to a user-facing description like "adds ESLint migration mapping for the
noMagicNumbers rule" and replace the bare rule name `noMagicNumbers` with a
markdown link to its documentation URL so users can click through to the rule
docs.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 06dea5b5-ccf2-4017-b262-26d8a0fa1462

📥 Commits

Reviewing files that changed from the base of the PR and between 7a360dd and 9bee0b6.

📒 Files selected for processing (2)
  • .changeset/odd-wasps-fly.md
  • crates/biome_js_analyze/src/lint/style/no_magic_numbers.rs

Comment thread .changeset/odd-wasps-fly.md Outdated
@github-actions github-actions Bot added the A-CLI Area: CLI label Apr 14, 2026
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Apr 14, 2026

Merging this PR will not alter performance

✅ 58 untouched benchmarks
⏩ 196 skipped benchmarks1


Comparing dyc3/noMagicNumbers-perf-and-metadata (7c18b7f) with main (f8d49d9)2

Open in CodSpeed

Footnotes

  1. 196 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 (7a360dd) during the generation of this report, so f8d49d9 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@dyc3 dyc3 merged commit d6bdf4a into main Apr 14, 2026
29 checks passed
@dyc3 dyc3 deleted the dyc3/noMagicNumbers-perf-and-metadata branch April 14, 2026 13:55
@github-actions github-actions Bot mentioned this pull request Apr 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-CLI Area: CLI 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