require-number-to-fixed-digits-argument
March 27, 2026 ยท View on GitHub
๐ Enforce using the digits argument with Number#toFixed().
๐ผ This rule is enabled in the following configs: โ
recommended, โ๏ธ unopinionated.
๐ง This rule is automatically fixable by the --fix CLI option.
It's better to make it clear what the value of the digits argument is when calling Number#toFixed(), instead of relying on the default value of 0.
Examples
// โ
const string = number.toFixed();
// โ
const string = number.toFixed(0);
// โ
const string = number.toFixed(2);