oxc-project/oxc · warning · OxcDiagnostic

Unexpected exponential notation in uppercase.

Error message

Unexpected exponential notation in uppercase.

What it means

Lint diagnostic from oxlint's `unicorn/number-literal-case` rule. The rule normalizes numeric literal casing; this variant fires when exponential (scientific) notation uses an uppercase `E`, as in `1E5` or `2.5E-3`, which the rule wants written as `1e5` and `2.5e-3`. It is purely stylistic — both forms parse to the same number.

Source

Thrown at crates/oxc_linter/src/rules/unicorn/number_literal_case.rs:16

use cow_utils::CowUtils;
use oxc_ast::AstKind;
use oxc_diagnostics::OxcDiagnostic;
use oxc_macros::declare_oxc_lint;
use oxc_span::Span;

use crate::{AstNode, context::LintContext, rule::Rule};

fn uppercase_prefix(span: Span, prefix: &str) -> OxcDiagnostic {
    OxcDiagnostic::warn("Unexpected number literal prefix in uppercase.")
        .with_help(format!("Use lowercase for the number literal prefix `{prefix}`."))
        .with_label(span)
}

fn uppercase_exponential_notation(span: Span) -> OxcDiagnostic {
    OxcDiagnostic::warn("Unexpected exponential notation in uppercase.")
        .with_help("Use lowercase for `e` in exponential notations.")
        .with_label(span)
}

fn lowercase_hexadecimal_digits(span: Span) -> OxcDiagnostic {
    OxcDiagnostic::warn("Unexpected hexadecimal digits in lowercase.")
        .with_help("Use uppercase for hexadecimal digits.")
        .with_label(span)
}

fn uppercase_prefix_and_lowercase_hexadecimal_digits(span: Span, prefix: &str) -> OxcDiagnostic {
    OxcDiagnostic::warn(
        "Unexpected number literal prefix in uppercase and hexadecimal digits in lowercase.",
    )
    .with_help(format!(
        "Use lowercase for the number literal prefix `{prefix}` and uppercase for hexadecimal digits."
    ))
    .with_label(span)

View on GitHub (pinned to e1e7af627c)

Solutions

  1. Lowercase the exponent marker: `3E8` -> `3e8`.
  2. Run `oxlint --fix` to autofix every occurrence in the project.
  3. Suppress once with `// oxlint-disable-next-line unicorn/number-literal-case` if the literal must stay as-is (e.g. in a generated file).
  4. Turn the rule off globally via `"unicorn/number-literal-case": "off"` if lowercase-e style is not wanted.

Example fix

// before
const avogadro = 6.02E23;

// after
const avogadro = 6.02e23;
Defensive patterns

Strategy: validation

Validate before calling

// oxlint --fix .   (normalizes 1E5 -> 1e5)
// CI gate:
// oxlint --deny-warnings .

Prevention

When it happens

Trigger: Any `NumericLiteral` with an exponent whose `E` marker is uppercase: `const speedOfLight = 3E8;`, `const tiny = 1E-7;`. Reported during oxlint runs when the unicorn plugin is active.

Common situations: Developers switching from editors/formatters that do not normalize exponent case, or code pasted from scientific sources that use uppercase `E`. Shows up as a wave of warnings when the `unicorn` category is turned on in `.oxlintrc.json`.

Related errors


AI-assisted analysis of oxc-project/oxc@e1e7af627c (2026-08-20). Data as JSON: /api/errors/524a7dd455e9a413. Report an issue: GitHub.