fixhunt

biome style/useNumberNamespace: fix changes program behavior

fix-changes-behaviorlabelled safereal · mediumrelated
Findings / 2026-10-17T21-04-15-156Z-qk6e-biome-style_useNumberNamespace / r2-p003biome 2.5.156 → 5 lines2026-10-17 21:04 UTC

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

before
1let Number = 42;
2try {
3 console.log(typeof parseInt('1'));
4} catch (e) {
5}
after
1let Number = 42;
2try {
3 console.log(typeof Number.parseInt('1'));
4} catch (e) {
5}

Output

stdout beforeexit 0
number
stdout afterexit 0
(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

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
1let Number = 42;
2try {
3 console.log(typeof parseInt('1'));
4} catch (e) {
5 console.log(e.name + ': ' + e.message);
6}
--- 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
 ```