{"record":{"id":"e42016eb3b1ae455","repo":"oxc-project/oxc","slug":"missing-radix-parameter","errorCode":null,"errorMessage":"Missing radix parameter.","messagePattern":"Missing radix parameter\\.","errorType":"validation","errorClass":"OxcDiagnostic","httpStatus":null,"severity":"warning","filePath":"crates/oxc_linter/src/rules/eslint/radix.rs","lineNumber":20,"sourceCode":"    AstKind,\n    ast::{Argument, CallExpression, Expression, IdentifierReference},\n};\nuse oxc_diagnostics::OxcDiagnostic;\nuse oxc_macros::declare_oxc_lint;\nuse oxc_span::{GetSpan, Span};\nuse schemars::JsonSchema;\nuse serde::{Deserialize, Serialize};\n\nuse crate::{AstNode, context::LintContext, rule::Rule};\n\nfn missing_parameters(span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"Missing parameters.\")\n        .with_help(\"Add parameters for parsing numbers, e.g., `parseInt('10', 10)`.\")\n        .with_label(span)\n}\n\nfn missing_radix(span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"Missing radix parameter.\")\n        .with_help(\"Add radix parameter `10` for parsing decimal numbers, or specify the appropriate radix for other number formats.\")\n        .with_label(span)\n}\n\nfn invalid_radix(span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"Invalid radix parameter, must be an integer between 2 and 36.\")\n        .with_help(\"The radix parameter should be an integer between 2 and 36, or a variable that is not `undefined`.\")\n        .with_label(span)\n}\n\n// `RadixType` has no effect, it is only here for backward compatibility.\n// Without it, the linter will report unknown rule configuration error.\n#[derive(Debug, Default, Clone, JsonSchema, Deserialize, Serialize)]\n#[serde(rename_all = \"camelCase\", default, deny_unknown_fields)]\npub struct Radix(RadixType);\n\n#[derive(Debug, Default, Clone, JsonSchema, Deserialize, Serialize)]\n#[serde(rename_all = \"kebab-case\")]","sourceCodeStart":2,"sourceCodeEnd":38,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/eslint/radix.rs#L2-L38","documentation":"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.","triggerScenarios":"`parseInt(\"42\")`, `parseInt(someString)`, or `Number.parseInt(input)` — callee is parseInt with exactly one argument and no second radix argument.","commonSituations":"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.","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."],"exampleFix":"// before\nconst n = parseInt(input);\n\n// after\nconst n = parseInt(input, 10);","handlingStrategy":"validation","validationCode":"# parseInt calls with a single argument (no radix)\nrg -n --pcre2 '(Number\\.)?parseInt\\(\\s*[\"'\"'\"'A-Za-z_$][^,)]*\\)' src/","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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`."],"tags":["eslint","oxlint","parseint","radix","correctness","lint"],"backgroundTag":"parseint-radix","analyzedSha":"e1e7af627c8843ab64044ed466b128fcc21a035b","analyzedAt":"2026-08-20T07:01:07.079Z","contentChangedAt":"2026-08-20T07:01:07.079Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}