+
Skip to content

Conversation

sterliakov
Copy link
Contributor

Summary

Fixes #6910.

biome now ignores type casts and assertions when evaluating numbers for noMagicNumbers rule.

Test Plan

Updated valid snapshot test with constant definitions that are supposed to be correct.

Docs

Bugfix to a nursery rule - n/a.

Copy link

changeset-bot bot commented Jul 19, 2025

🦋 Changeset detected

Latest commit: b09016a

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 Jul 19, 2025
@sterliakov sterliakov changed the title Bugfix/gh 6910 magic numbers as const fix(biome_js_analyze): ignore as const and similar wrappers in noMagicNumbers rule. Jul 19, 2025
@sterliakov sterliakov changed the title fix(biome_js_analyze): ignore as const and similar wrappers in noMagicNumbers rule. fix(biome_js_analyze): ignore as const and similar wrappers in noMagicNumbers rule Jul 19, 2025
Copy link

codspeed-hq bot commented Jul 19, 2025

CodSpeed Performance Report

Merging #6944 will not alter performance

Comparing sterliakov:bugfix/gh-6910-magic-numbers-as-const (b09016a) with main (e53f2fe)1

Summary

✅ 115 untouched benchmarks

Footnotes

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

Copy link
Contributor

@arendjr arendjr 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!

@arendjr arendjr merged commit e53f2fe into biomejs:main Jul 20, 2025
28 checks passed
@github-actions github-actions bot mentioned this pull request Jul 20, 2025
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.

🐛 Magic numbers with "as const" are reported as warnings

2 participants

点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载