biome style/useNumberNamespace: fix changes program behavior
Hypothesis Nemotron 3 Super predicted to fire fired 1×
In an environment without global Number, the fix throws ReferenceError while original works (if global parseInt exists).
Program
Output
1
(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 assuming the global Number object, but the program explicitly defines Number as undefined on the global object. This causes a runtime ReferenceError in the fixed code where the original succeeded, which is a semantic change not documented as intended.
Explanation Nemotron 3 Super unverified
The original `parseInt` refers to the global function, which remains unaffected because `g.Number` is set on a separate object (`g`) that does not shadow the global `Number`. After rewriting to `Number.parseInt`, the call accesses the `parseInt` method on the global `Number` object, but since `g.Number` was set to `undefined` and `g` is the global object (via `Function('return this')()`), the global `Number` constructor is overridden with `undefined`, making `Number.parseInt` inaccessible and causing a TypeError that is caught, resulting in no output. Thus, the change alters which `Number` is accessed, breaking semantics.
Reproduce
- file
prog.js(the before program)- minimized program
- r1-p006.js
- evidence sheet
- r1-p006.md
- regression fixture
- r1-p006.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 parseInt call · useNumberNamespace global Number methods · style useNumberNamespace built-in functions
- related biomejs/biome/issues/1228 same rule (useNumberNamespace) but about implementing the rule, not a fix-changes-behavior defect on parseInt
- related biomejs/biome/issues/3578 same rule (useNumberNamespace) but about incorrect error message for Infinity, not parseInt fix changing behavior
- related biomejs/biome/issues/2075 same rule (useNumberNamespace) but about isNaN replacement being a different function, not parseInt
Details
- program
- Environment where Number is undefined
- hazard
- In an environment without global Number, the fix throws ReferenceError while original works (if global parseInt exists).
- oracle
stdout before: 1 stdout after:- run
- 2026-10-17T21-04-15-156Z-qk6e-biome-style_useNumberNamespace
generated program (9 lines) and the fix's diff
--- orig.js 2026-10-17 17:04:27.232646748 -0400 +++ fixed.js 2026-10-17 17:04:27.500649785 -0400 @@ -2,7 +2,7 @@ const g = Function('return this')(); defineProperty(g, 'Number', { value: undefined }); try { - console.log(parseInt('1')); + console.log(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
```