oxc/bad-object-literal-comparison
oxc plugin · correctness
{
"rules": {
"oxc/bad-object-literal-comparison": "error"
}
}Checks for comparisons between object and array literals.
if (x === {}) { }
if (arr !== []) { }if (typeof x === 'object' && Object.keys(x).length === 0) { }
if (Array.isArray(x) && x.length === 0) { }Examples from the Oxlint documentation.
ESLint does not have this rule.
oxc/bad-object-literal-comparison
oxc plugin · correctness
{
"rules": {
"oxc/bad-object-literal-comparison": "error"
}
}nursery/noObjectLiteralComparison
nursery · since 2.6.5
{
"linter": {
"rules": {
"nursery": {
"noObjectLiteralComparison": "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.
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 the matchAll method is called with a regular expression that does not have the global flag (g).
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).
This rule applies when the comparison operator is applied two or more times in a row.