diff --git a/crates/oxc_linter/src/rules/unicorn/prefer_number_properties.rs b/crates/oxc_linter/src/rules/unicorn/prefer_number_properties.rs index 8e3dccc5231d1..b7866cc348c71 100644 --- a/crates/oxc_linter/src/rules/unicorn/prefer_number_properties.rs +++ b/crates/oxc_linter/src/rules/unicorn/prefer_number_properties.rs @@ -188,7 +188,13 @@ impl Rule for PreferNumberProperties { let fixer = |fixer: RuleFixer<'_, 'a>| match &call_expr.callee { Expression::Identifier(ident) => { - fixer.insert_text_before(&ident.span, "Number.") + // Use replace on the full call expression span instead of insert_text_before. + // This ensures the fix span overlaps with prefer_numeric_literals fixes, + // so the fixer's conflict resolution will skip one of them instead of + // applying both and producing invalid code like `Number.0o111`. + let args_span = Span::new(ident.span.end, call_expr.span.end); + let args_text = ctx.source_range(args_span); + fixer.replace(call_expr.span, format!("Number.{ident_name}{args_text}")) } match_member_expression!(Expression) => { let member_expr = call_expr.callee.to_member_expression(); @@ -550,6 +556,7 @@ function inner() { "let a = +(Number.POSITIVE_INFINITY)", Some(json!([{"checkInfinity":true}])), ), + (r#"parseInt("111", 8)"#, r#"Number.parseInt("111", 8)"#, None), ]; Tester::new(PreferNumberProperties::NAME, PreferNumberProperties::PLUGIN, pass, fail)