oxc/bad-replace-all-arg
oxc plugin · correctness
{
"rules": {
"oxc/bad-replace-all-arg": "error"
}
}This rule warns when the replaceAll method is called with a regular expression that does not have the global flag (g).
withSpaces.replaceAll(/\s+/, ',');withSpaces.replaceAll(/\s+/g, ',');Examples from the Oxlint documentation.
ESLint does not have this rule.
oxc/bad-replace-all-arg
oxc plugin · correctness
{
"rules": {
"oxc/bad-replace-all-arg": "error"
}
}nursery/useGlobalRegexInReplaceAll
nursery · since 2.6.7
{
"linter": {
"rules": {
"nursery": {
"useGlobalRegexInReplaceAll": "error"
}
}
}
}Checks for comparisons between object and array literals.
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).
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 matchAll method is called with a regular expression that does not have the global flag (g).
Checks whether the throw keyword is missing in front of a new expression.