Reports unnecessary Math.min and Math.max calls with constant arguments or incorrect clamping patterns.
✅ This rule is included in the ts logical presets.
Math.min and Math.max are commonly used to constrain values to specific ranges.
However, when all arguments are constant values, the result is always predictable and should be replaced with the constant directly.
Additionally, nested Math.min/max calls are often accidentally swapped to never return a value in-range
This rule reports on Math.min and Math.max calls that don’t correctly clamp.
If you have a codebase that intentionally uses Math.min/max with constants for code generation or readability purposes, you might choose to disable this rule.
However, in most cases, replacing constant Math operations with their computed results makes the code more efficient and clearer.