A number literal has a trailing decimal point or zeros after it, as 1.0 or 2.50

tx0/ts:number-literal-trailing-zerosallwarningstyle/formattingdepth faststyle

What it finds

1.0 and 1 are the same number in JavaScript, which has no separate integer type, and 2.50 is 2.5. The extra digits suggest a precision or type that is not there.

Reported are decimal number literals with a fractional part that ends in 0 or is empty.

From the rule's source, number_literal_trailing_zeros.rs.

Example from the rule's tests
export const scale = 1.0;tx0 reports: 1.0 has digits after the point that change nothingexport const half = 0.5;
Highlighted lines are the ones tx0 reports, with its message under each; the other lines are left alone.

Turn it on, off or suppress it

The rule runs from the all tier up. To turn it on in a lower tier, give it a level in tx0.toml:

tx0.toml
[rules]
"tx0/ts:number-literal-trailing-zeros" = "warning"

To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:

// tx0: ignore[tx0/ts:number-literal-trailing-zeros] reason="..."

tx0 explain tx0/ts:number-literal-trailing-zeros shows the same in the terminal. Found a false positive? Report it.