oxc-project/oxc · warning · OxcDiagnostic
Missing radix parameter.
Error message
Missing radix parameter.
What it means
oxlint `eslint/radix`: `parseInt` was called with only one argument, so the radix is left to the implementation's inferred base (leading `0x` implies 16, and historic engines inferred octal for leading zeros). `missing_radix` (radix.rs:20) fires to force the base to be explicit, as recommended for `parseInt` in MDN and the ESLint radix rule.
Source
Thrown at crates/oxc_linter/src/rules/eslint/radix.rs:20
AstKind,
ast::{Argument, CallExpression, Expression, IdentifierReference},
};
use oxc_diagnostics::OxcDiagnostic;
use oxc_macros::declare_oxc_lint;
use oxc_span::{GetSpan, Span};
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use crate::{AstNode, context::LintContext, rule::Rule};
fn missing_parameters(span: Span) -> OxcDiagnostic {
OxcDiagnostic::warn("Missing parameters.")
.with_help("Add parameters for parsing numbers, e.g., `parseInt('10', 10)`.")
.with_label(span)
}
fn missing_radix(span: Span) -> OxcDiagnostic {
OxcDiagnostic::warn("Missing radix parameter.")
.with_help("Add radix parameter `10` for parsing decimal numbers, or specify the appropriate radix for other number formats.")
.with_label(span)
}
fn invalid_radix(span: Span) -> OxcDiagnostic {
OxcDiagnostic::warn("Invalid radix parameter, must be an integer between 2 and 36.")
.with_help("The radix parameter should be an integer between 2 and 36, or a variable that is not `undefined`.")
.with_label(span)
}
// `RadixType` has no effect, it is only here for backward compatibility.
// Without it, the linter will report unknown rule configuration error.
#[derive(Debug, Default, Clone, JsonSchema, Deserialize, Serialize)]
#[serde(rename_all = "camelCase", default, deny_unknown_fields)]
pub struct Radix(RadixType);
#[derive(Debug, Default, Clone, JsonSchema, Deserialize, Serialize)]
#[serde(rename_all = "kebab-case")]View on GitHub (pinned to e1e7af627c)
Solutions
- Add radix 10 for decimal parsing: `parseInt("42", 10)`.
- Use the appropriate radix for other bases (`parseInt("ff", 16)`).
- If you are parsing decimals with possible whitespace or signs, prefer `Number(value)` or `parseFloat`, which the rule does not flag.
- Run `oxlint --fix` to insert the missing `, 10` where safe.
Example fix
// before const n = parseInt(input); // after const n = parseInt(input, 10);
Defensive patterns
Strategy: validation
Validate before calling
# parseInt calls with a single argument (no radix) rg -n --pcre2 '(Number\.)?parseInt\(\s*["'"'"'A-Za-z_$][^,)]*\)' src/
Prevention
- Always write the radix: `parseInt(x, 10)` for decimal parsing.
- Consider `Number(x)` for plain decimal conversion; it needs no radix and is not flagged.
- Enable `radix` in shared configs and run `oxlint --fix` to bulk-insert the missing `, 10`.
When it happens
Trigger: `parseInt("42")`, `parseInt(someString)`, or `Number.parseInt(input)` — callee is parseInt with exactly one argument and no second radix argument.
Common situations: Everyday parsing calls written without the radix; code migrated from `Number(...)`-style habits; enabling the `radix` rule in an existing codebase and getting many hits at once.
Related errors
- Missing parameters.
- Invalid radix parameter, must be an integer between 2 and 36
- Empty array binding pattern
- Empty object binding pattern
- Checking inequality with NaN will always return true
AI-assisted analysis of oxc-project/oxc@e1e7af627c (2026-08-20).
Data as JSON: /api/errors/e42016eb3b1ae455.
Report an issue: GitHub.