eslint/radix Pedantic
What it does
Enforce the consistent use of the radix argument when using parseInt()
.
Why is this bad?
Using the parseInt()
function without specifying the radix can lead to unexpected results.
Examples
Examples of incorrect code for this rule:
javascript
var num = parseInt("071"); // 57
Examples of correct code for this rule:
javascript
var num = parseInt("071", 10); // 71
How to use
To enable this rule in the CLI or using the config file, you can use:
bash
oxlint --deny radix
json
{
"rules": {
"radix": "error"
}
}