number-literal-case
UnreleasedConfiguration
Rule Details
Enforce lowercase radix prefixes (0x, 0o, and 0b) and a lowercase e
in exponential notation. Hexadecimal digits use uppercase by default.
The rule checks both numbers and BigInts and provides an automatic fix.
Examples of incorrect code for this rule:
Examples of correct code for this rule:
Numeric separators and the lowercase BigInt suffix n are preserved.
Strings containing numeric-looking text are not checked.
Options
hexadecimalValue
Type: "uppercase" | "lowercase"
Default: "uppercase"
Choose the case of hexadecimal digits. The 0x prefix is always lowercase.
With hexadecimalValue: "lowercase", use 0xff and 0xffn instead of
0xFF and 0xFFn.
Differences from upstream
Vue single-file components and template expressions are not supported by
rslint's parser. For example, this rule does not check {{ 1.2E3 }} inside
a Vue template.
The TypeScript parser rejects legacy numeric spellings such as 0777 and
0888 before lint rules run, even in scripts. Upstream accepts these in
sloppy-mode JavaScript and leaves them unchanged.