{"record":{"id":"3106b75aa548542c","repo":"oxc-project/oxc","slug":"unexpected-hexadecimal-digits-in-lowercase","errorCode":null,"errorMessage":"Unexpected hexadecimal digits in lowercase.","messagePattern":"Unexpected hexadecimal digits in lowercase\\.","errorType":"validation","errorClass":"OxcDiagnostic","httpStatus":null,"severity":"warning","filePath":"crates/oxc_linter/src/rules/unicorn/number_literal_case.rs","lineNumber":22,"sourceCode":"use oxc_macros::declare_oxc_lint;\nuse oxc_span::Span;\n\nuse crate::{AstNode, context::LintContext, rule::Rule};\n\nfn uppercase_prefix(span: Span, prefix: &str) -> OxcDiagnostic {\n    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!(","sourceCodeStart":4,"sourceCodeEnd":40,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/unicorn/number_literal_case.rs#L4-L40","documentation":"Lint diagnostic from oxlint's `unicorn/number-literal-case` rule. Unlike the prefix and exponent checks, hex digits are required to be UPPERCASE for readability, so `0xff` is flagged and `0xFF` is the canonical form. This variant fires when hexadecimal digits are lowercase while the prefix itself is already correct (`0x`).","triggerScenarios":"Hex literals with lowercase a-f digits: `const red = 0xff0000;`, `let mask = 0xdeadbeef;`. Triggered while oxlint scans files with the unicorn plugin enabled.","commonSituations":"Color constants, bitmask flags, and hashes are commonly written lowercase (CSS habit, `#ff0000`). Teams adopting oxlint's unicorn category see this on color/flag tables. Also appears in vendored or machine-generated code that was never normalized.","solutions":["Uppercase the hex digits: `0xff0000` -> `0xFF0000`.","Run `oxlint --fix` to rewrite all lowercase hex digits repo-wide.","For generated files, exclude the path in `.oxlintrc.json` `ignorePatterns` instead of hand-editing.","Disable the rule with `\"unicorn/number-literal-case\": \"off\"` if lowercase hex is a deliberate project convention."],"exampleFix":"// before\nconst RED = 0xff0000;\nconst MASK = 0xdead_beef;\n\n// after\nconst RED = 0xFF0000;\nconst MASK = 0xDEAD_BEEF;","handlingStrategy":"validation","validationCode":"// oxlint --fix src/constants/colors.ts\n// Verify no remaining lowercase-hex violations:\n// oxlint --deny-warnings unicorn/number-literal-case","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use uppercase hex digits everywhere (`0xFF`, `0xDEAD_BEEF`) even though CSS uses lowercase.","Keep bitmasks/colors in one constants file that you lint-and-fix once.","Automate with a pre-commit `oxlint --fix` run."],"tags":["oxlint","unicorn","style","hexadecimal","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"}