# eslint prefer-numeric-literals: fix changes program behavior

Internal evidence sheet generated by fixhunt. Not an issue text. A human re-verifies, checks the duplicates
below, and writes the upstream report in their own words following the project's AI policy.

- Tool: eslint 9.39.5
- Rule: prefer-numeric-literals (tool labels the fix: safe, this fix reported as safe)
- Oracle: fix-changes-behavior
- Judge (Nemotron 3 Ultra, advisory): real, severity high. The program uses the result of parseInt('111110111', 2) as a callable function, but the fix replaces it with the numeric literal 503, which is not callable. The rule documentation presents the rewrite as equivalent for numeric value, but does not account for the call expression context, causing a crash where the original code threw a different error.
- Program: minimized from 2 to 2 lines

## Reproducer

```js
let a = parseInt('111110111', 2)
(function(){ console.log('called'); })()
```

## Commands

```sh
node prog.js
npx eslint --no-config-lookup --rule 'prefer-numeric-literals: error' --fix prog.js
node prog.js
```

## Observed

```
stderr before: TypeError: parseInt(...) is not a function
stderr after: TypeError: 503 is not a function
```

## Diff applied by the fix

```diff
--- orig.js	2026-10-22 14:28:05.278667034 -0400
+++ fixed.js	2026-10-22 14:28:07.329644495 -0400
@@ -1,2 +1,2 @@
-let a = parseInt('111110111', 2)
+let a = 0b111110111
 (function(){ console.log('called'); })()
```

## Why the rewrite is not equivalent (model draft, verify before use)

The original code attempts to call `parseInt` with two arguments but mistakenly treats it as if only one argument were provided due to missing parentheses or misinterpretation—however, the actual error arises because in the observed context, `parseInt` is not defined or has been overridden, causing a TypeError when trying to invoke it. After the rewrite, `parseInt` is replaced with the numeric literal `503`, so the expression becomes `let a = 503`, which succeeds. However, the subsequent IIFE is unaffected. The error shift from "parseInt is not a function" to "503 is not a function" indicates that the rewritten value `503` is now being treated as a callable in a context where a function was expected—likely due to another part of the code (not shown) attempting to invoke `a` as a function. Since `a` is now a number instead of a function, invoking it fails, changing the error type but preserving the fact that a non-function is being called. The fix altered the value’s type, breaking downstream usage that expected a function.

## Upstream search

Queries: "prefer-numeric-literals fix", "prefer-numeric-literals parseInt binary string", "eslint prefer-numeric-literals radix 2 conversion", "rule prefer-numeric-literals parseInt base two"

- related: https://github.com/eslint/eslint/issues/8913
  same rule prefer-numeric-literals but about Number.parseInt not parseInt call expression
- related: https://github.com/eslint/eslint/issues/2
  IIFE wrapping issue same construct as the snippet shows an IIFE

<details><summary>All hits</summary>

- [github, closed] Change Request: autoformat docs — https://github.com/eslint/eslint/issues/17504
- [github, closed] Change Request: (Add new config eslint/fixable containing all fixable rules) — https://github.com/eslint/eslint/issues/18027
- [github, closed] Change Request: track dependencies of eslint.config.js to invalidate cache & typescript support — https://github.com/eslint/eslint/issues/18337
- [github, closed] Bug: [new config system] path to a directory lints files outside that directory — https://github.com/eslint/eslint/issues/16260
- [github, closed] Bug: eslint is running absurdly slow for a few small files — https://github.com/eslint/eslint/issues/15728
- [github, closed] Strange behavior of require-atomic-updates — https://github.com/eslint/eslint/issues/14695
- [github, closed] Bug: no-dupe-class-members reporting "Duplicate name ''" (duplicate name is blank!) — https://github.com/eslint/eslint/issues/15232
- [github, closed] Remove `meta.docs.category` from core rules — https://github.com/eslint/eslint/issues/13398
- [github, closed] Bug: eslint fails to parse empty array types in typescript — https://github.com/eslint/eslint/issues/15551
- [github, closed] Throws "is assigned but never used" even though its used for jsdoc — https://github.com/eslint/eslint/issues/15019
- [github, closed] Change proposal: prefer-numeric-literals should also disallow Number.parseInt — https://github.com/eslint/eslint/issues/8913
- [github, closed] 4.0.0: ESLint configuration is invalid: - Unexpected top-level property "ecmaFeatures" — https://github.com/eslint/eslint/issues/8726
- [github, closed] Rule: Warn on unwrapped IIFEs — https://github.com/eslint/eslint/issues/2
- [github, closed] Unexpected token function — https://github.com/eslint/eslint/issues/10702
- [github, closed] Eslint does not recognize "async", but I have specified "ecmaVersion":"8" — https://github.com/eslint/eslint/issues/11976
- [github, closed] Parsing error: Unexpected token = (fatal) — https://github.com/eslint/eslint/issues/11259

</details>
