π Prefer flat Math.min() and Math.max() calls over nested calls.
πΌ This rule is enabled in the following configs: β
recommended, βοΈ unopinionated.
π§ This rule is automatically fixable by the --fix CLI option.
Math.min() and Math.max() accept any number of arguments, so nesting the same call is unnecessary.
// β
const biggest = Math.max(Math.max(a, b), c);
// β
const biggest = Math.max(a, b, c);// β
const smallest = Math.min(a, Math.min(b, c));
// β
const smallest = Math.min(a, b, c);// β
const clamped = Math.max(Math.min(value, upper), lower);