biome style/useNumberNamespace: fix changes program behavior
Hypothesis Nemotron 3 Super predicted to fire fired 1×
If `Number` is reassigned (e.g., `let Number = 42;`), the fix will reference the reassigned value instead of the built-in Number constructor, altering semantics.
Program
Output
number
(no stdout)
- fired
- 1 before · 0 after
- runs
- each version twice, same file name, no network
Judge Nemotron 3 Ultra advisory real · medium
The rule rewrites global parseInt to Number.parseInt, but the program declares a local variable named Number that shadows the global Number object. After the fix, Number.parseInt attempts to access a property on the number 42, which is undefined, causing a TypeError that is caught silently, so nothing is printed. The documentation does not mention this shadowing scenario, and the construct (a local variable named Number) is legal and plausible.
Explanation Nemotron 3 Super unverified
The original `parseInt` refers to the global function; rewriting it as `Number.parseInt` accesses a property on the local variable `Number`, which holds the number 42 and has no such method, causing `undefined` to be passed to `typeof`. Since `typeof undefined` yields `"undefined"` instead of `"function"`, the output changes from `"number"` to nothing, altering program behavior. This substitution is invalid because it assumes `Number` denotes the built‑in constructor, but the program shadows it with a numeric value.
Reproduce
- file
prog.js(the before program)- minimized program
- r2-p003.js
- evidence sheet
- r2-p003.md
- regression fixture
- r2-p003.js the minimized program with a header stating the observed change, for the tool's test suite
node prog.js bunx @biomejs/biome lint --only=style/useNumberNamespace --write prog.js node prog.js
Upstream search GitHub issues Tavily Nemotron 3 Super + Ultra
useNumberNamespace fix · style useNumberNamespace global variable shadowing · style useNumberNamespace built-in method call rewrite · style useNumberNamespace typeof expression transformation
- related biomejs/biome/issues/1228 same rule useNumberNamespace implementation tracking
- related biomejs/biome/issues/3578 same rule useNumberNamespace but different construct Infinity property
- related biomejs/biome/issues/2075 same rule useNumberNamespace but different construct isNaN function
Details
- program
- Reassigned Number variable breaks fix
- hazard
- If `Number` is reassigned (e.g., `let Number = 42;`), the fix will reference the reassigned value instead of the built-in Number constructor, altering semantics.
- oracle
stdout before: number stdout after:- run
- 2026-10-17T21-04-15-156Z-qk6e-biome-style_useNumberNamespace
generated program (6 lines) and the fix's diff
--- orig.js 2026-10-17 17:04:34.452728497 -0400 +++ fixed.js 2026-10-17 17:04:34.725731585 -0400 @@ -1,6 +1,6 @@ let Number = 42; try { - console.log(typeof parseInt('1')); + console.log(typeof Number.parseInt('1')); } catch (e) { console.log(e.name + ': ' + e.message); }
rule documentation given to the models
Summary
- Name: useNumberNamespace
- Fix: safe
- Default severity: info
- Available from version: 1.5.0
- Diagnostic category: lint/style/useNumberNamespace
Description
Use the `Number` properties instead of global ones.
_ES2015_ moved some globals into the `Number` properties for consistency.
The rule doesn't report the globals `isFinite` and `isNaN` because they have a slightly different behavior to their corresponding `Number`'s properties `Number.isFinite` and `Number.isNaN`.
You can use the dedicated rules [noGlobalIsFinite](https://biomejs.dev/linter/rules/no-global-is-finite/) and [noGlobalIsNan](https://biomejs.dev/linter/rules/no-global-is-nan/) to enforce the use of `Number.isFinite` and `Number.isNaN`.
Examples
Invalid
```js,expect_diagnostic
parseInt("1"); // true
```
```js,expect_diagnostic
parseFloat("1.1"); // true
```
```js,expect_diagnostic
NaN; // true
```
```js,expect_diagnostic
Infinity; // true
```
```js,expect_diagnostic
-Infinity; // true
```
Valid
```js
Number.parseInt("1"); // false
```
```js
Number.parseFloat("1.1"); // false
```
```js
Number.NaN; // false
```
```js
Number.POSITIVE_INFINITY; // false
```
```js
Number.NEGATIVE_INFINITY; // false
```