{"record":{"id":"745cb695e640b147","repo":"oxc-project/oxc","slug":"use-number-method-name-instead-of-the-global","errorCode":null,"errorMessage":"Use `Number.{method_name}` instead of the global `{method_name}`","messagePattern":"Use `Number\\.(.+?)` instead of the global `(.+?)`","errorType":"validation","errorClass":"OxcDiagnostic","httpStatus":null,"severity":"error","filePath":"crates/oxc_linter/src/rules/unicorn/prefer_number_properties.rs","lineNumber":20,"sourceCode":"    AstKind,\n    ast::{Expression, UnaryExpression, UnaryOperator, match_member_expression},\n};\nuse oxc_diagnostics::OxcDiagnostic;\nuse oxc_macros::declare_oxc_lint;\nuse oxc_span::{GetSpan, Span};\nuse schemars::JsonSchema;\nuse serde::Deserialize;\n\nuse crate::{\n    AstNode,\n    context::LintContext,\n    fixer::RuleFixer,\n    globals::GLOBAL_OBJECT_NAMES,\n    rule::{DefaultRuleConfig, Rule},\n};\n\nfn prefer_number_properties_diagnostic(span: Span, method_name: &str) -> OxcDiagnostic {\n    OxcDiagnostic::warn(format!(\"Use `Number.{method_name}` instead of the global `{method_name}`\"))\n        .with_help(format!(\"Replace it with `Number.{method_name}`\"))\n        .with_label(span)\n}\n\n#[derive(Debug, Default, Clone, Deserialize)]\npub struct PreferNumberProperties(Box<PreferNumberPropertiesConfig>);\n\nimpl std::ops::Deref for PreferNumberProperties {\n    type Target = PreferNumberPropertiesConfig;\n\n    fn deref(&self) -> &Self::Target {\n        &self.0\n    }\n}\n\n#[derive(Debug, Clone, JsonSchema, Deserialize)]\n#[serde(rename_all = \"camelCase\", default, deny_unknown_fields)]\npub struct PreferNumberPropertiesConfig {","sourceCodeStart":2,"sourceCodeEnd":38,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/unicorn/prefer_number_properties.rs#L2-L38","documentation":"Diagnostic from the unicorn/prefer-number-properties lint rule. It fires when a deprecated global numeric function or constant is used — e.g. `parseInt`, `parseFloat`, `isNaN`, `isFinite`, `NaN`, `Infinity` (named in the message) — instead of the ES2015+ equivalents on the `Number` namespace (`Number.parseInt`, `Number.isNaN`, `Number.NaN`, ...). The `Number.*` forms avoid implicit global coercion and are the standardized API. It is a lint suggestion, not a runtime error.","triggerScenarios":"Thrown at crates/oxc_linter/src/rules/unicorn/prefer_number_properties.rs:20 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Replace `parseInt(x, r)` with `Number.parseInt(x, r)`","Replace `isNaN`/`isFinite` with `Number.isNaN`/`Number.isFinite` (note the stricter, non-coercing semantics)","Replace bare `NaN`/`Infinity` with `Number.NaN`/`Number.POSITIVE_INFINITY`","Apply the rule's auto-fix"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e1e7af627c8843ab64044ed466b128fcc21a035b","analyzedAt":"2026-08-20T07:01:07.079Z","contentChangedAt":"2026-08-20T07:01:07.079Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}