oxc/bad-min-max-func
oxc plugin · correctness
{
"rules": {
"oxc/bad-min-max-func": "error"
}
}Checks whether the clamp function Math.min(Math.max(x, y), z) always evaluates to a constant result because the arguments are in the wrong order.
Math.min(Math.max(100, x), 0);
Math.max(1000, Math.min(0, z));Math.max(0, Math.min(100, x));
Math.min(1000, Math.max(0, z));Examples from the Oxlint documentation.
ESLint does not have this rule.
oxc/bad-min-max-func
oxc plugin · correctness
{
"rules": {
"oxc/bad-min-max-func": "error"
}
}correctness/noConstantMathMinMaxClamp
correctness · since 1.7.0
{
"linter": {
"rules": {
"correctness": {
"noConstantMathMinMaxClamp": "error"
}
}
}
}This rule warns when the matchAll method is called with a regular expression that does not have the global flag (g).
Checks for comparisons between object and array literals.
This rule applies when the comparison operator is applied two or more times in a row.
This rule warns when the replaceAll method is called with a regular expression that does not have the global flag (g).
This rule warns when a character accessed with charAt, at, or bracket notation is compared with a string of length greater than 1.
Checks for redundant or logically impossible comparisons. This includes: - Ineffective double comparisons against constants. - Impossible comparisons involving constants. - Redundant comparisons where both operands are the same (e.g., a < a).