numericTrailingZeros
Reports trailing zeros in numeric values.
✅ This rule is included in the yaml stylistic presets.
Trailing zeros in decimal numbers are unnecessary and can be removed without changing the numeric value. Removing trailing zeros makes numeric values more concise and easier to read.
Examples
Section titled “Examples”price: 10.00rate: 0.100value: 1.50price: 10rate: 0.1value: 1.5Options
Section titled “Options”This rule is not configurable.
When Not To Use It
Section titled “When Not To Use It”If your project requires trailing zeros for formatting purposes (e.g., currency display or alignment), you may not need this rule. Some systems may require numeric values to have a specific number of decimal places for compatibility.
Further Reading
Section titled “Further Reading”Equivalents in Other Linters
Section titled “Equivalents in Other Linters”- ESLint:
yml/no-trailing-zeros
Made with ❤️🔥 in Boston by
Josh Goldberg and contributors.