# unicorn/number-literal-case

> Require lowercase prefixes and exponents, and uppercase hexadecimal digits, in numbers

`0XFF`, `0xff` and `0xFF` are the same number. This rule picks one spelling: a lowercase `0x`, `0b`, `0o` or `e`, and uppercase hexadecimal digits. That way the prefix stands out from the digits.

`--fix` rewrites the number.

{/* Generated by src/codegen/lint-rule-docs.ts. Do not edit this section. */}

## Configure

Off by default. To turn it on:

```toml bunfig.toml
[lint.rules]
"unicorn/number-literal-case" = "error" # or "warn"
```

{/* End of the generated section. */}

## Examples

Reported:

{/* bad {"count": 5} */}
```js
const mask = 0XFF;
const color = 0xff8800;
const flags = 0B1010;
const mode = 0O755;
const big = 1.5E9;
```

Not reported:

{/* good */}
```js
const mask = 0xFF;
const color = 0xFF8800;
const flags = 0b1010;
const mode = 0o755;
const big = 1.5e9;
```

The `n` at the end of a `BigInt` stays lowercase:

{/* good */}
```js
const id = 0xABCDEFn;
```

## When not to use it

Some formatters, such as Prettier, write hexadecimal digits in lowercase. If yours does, the two undo each other's work, so turn this rule off.
