Skip to content

oxc/bad-min-max-func Correctness

This rule is turned on by default.

What it does

Checks whether the clamp function Math.min(Math.max(x, y), z) always evaluate to a constant result because the arguments are in the wrong order.

Example

javascript
Math.min(Math.max(100, x), 0);
Math.max(1000, Math.min(0, z));

References

Released under the MIT License.