{"record":{"id":"de034fda705a6210","repo":"oxc-project/oxc","slug":"unexpected-number-literal-prefix-in-uppercase-and","errorCode":null,"errorMessage":"Unexpected number literal prefix in uppercase and hexadecimal digits in lowercase.","messagePattern":"Unexpected number literal prefix in uppercase and hexadecimal digits in lowercase\\.","errorType":"validation","errorClass":"OxcDiagnostic","httpStatus":null,"severity":"warning","filePath":"crates/oxc_linter/src/rules/unicorn/number_literal_case.rs","lineNumber":28,"sourceCode":"    OxcDiagnostic::warn(\"Unexpected number literal prefix in uppercase.\")\n        .with_help(format!(\"Use lowercase for the number literal prefix `{prefix}`.\"))\n        .with_label(span)\n}\n\nfn uppercase_exponential_notation(span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"Unexpected exponential notation in uppercase.\")\n        .with_help(\"Use lowercase for `e` in exponential notations.\")\n        .with_label(span)\n}\n\nfn lowercase_hexadecimal_digits(span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"Unexpected hexadecimal digits in lowercase.\")\n        .with_help(\"Use uppercase for hexadecimal digits.\")\n        .with_label(span)\n}\n\nfn uppercase_prefix_and_lowercase_hexadecimal_digits(span: Span, prefix: &str) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\n        \"Unexpected number literal prefix in uppercase and hexadecimal digits in lowercase.\",\n    )\n    .with_help(format!(\n        \"Use lowercase for the number literal prefix `{prefix}` and uppercase for hexadecimal digits.\"\n    ))\n    .with_label(span)\n}\n\n#[derive(Debug, Default, Clone)]\npub struct NumberLiteralCase;\n\ndeclare_oxc_lint!(\n    /// ### What it does\n    ///\n    /// This rule enforces proper case for numeric literals.\n    ///\n    /// ### Why is this bad?\n    ///","sourceCodeStart":10,"sourceCodeEnd":46,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/unicorn/number_literal_case.rs#L10-L46","documentation":"Lint diagnostic from oxlint's `unicorn/number-literal-case` rule; the combined variant. A single literal breaks both halves of the canonical style at once: the base prefix is uppercase (`0X`) AND the hexadecimal digits are lowercase (`ff`). The canonical form is `0xFF` — lowercase prefix, uppercase digits.","triggerScenarios":"Hex literals like `0Xff`, `0Xab_cd`, or bigint variants `0Xffn` — uppercase prefix with lowercase a-f digits. Reported during oxlint runs with the unicorn plugin active.","commonSituations":"Typical when code is transcribed from datasheets or older documentation that wrote hex as `0Xff`. Because two violations coexist in one literal, autofix output may change more characters than expected — review diffs on generated constant tables.","solutions":["Rewrite the literal as `0xFF` (lowercase prefix, uppercase digits).","Run `oxlint --fix` and review the diff, since both prefix and digits change.","Suppress the line with `// oxlint-disable-next-line unicorn/number-literal-case` for literals that must remain byte-identical (e.g. test fixtures).","Disable the rule in `.oxlintrc.json` if the project intentionally keeps another style."],"exampleFix":"// before\nconst magic = 0Xff;\n\n// after\nconst magic = 0xFF;","handlingStrategy":"validation","validationCode":"// oxlint --fix .\n// Fail CI on any number-literal-case violation:\n// oxlint --deny-warnings --filter unicorn/number-literal-case .","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Normalize numeric literal style once repo-wide with `oxlint --fix`, then keep it enforced in CI with `--deny-warnings`.","Exclude test fixtures that must preserve byte-exact literals via `ignorePatterns`."],"tags":["oxlint","unicorn","style","hexadecimal","numeric-literal","autofix"],"backgroundTag":"lint-rule-violation","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"}