oxc/bad-char-at-comparison
oxc plugin · correctness
{
"rules": {
"oxc/bad-char-at-comparison": "error"
}
}This rule warns when a character accessed with charAt, at, or bracket notation is compared with a string of length greater than 1.
a.charAt(4) === 'a2';
'abc'.at(4) === 'a2';
'abc'[4] === 'a2';
a.charAt(4) === '/n';a.charAt(4) === 'a'
a.charAt(4) === '\n';Examples from the Oxlint documentation.
ESLint does not have this rule.
oxc/bad-char-at-comparison
oxc plugin · correctness
{
"rules": {
"oxc/bad-char-at-comparison": "error"
}
}nursery/useValidCharacterComparison
nursery · since 2.6.7
{
"linter": {
"rules": {
"nursery": {
"useValidCharacterComparison": "error"
}
}
}
}This rule applies when an array method is called on the arguments object itself.
This rule applies when the comparison operator is applied two or more times in a row.
This rule warns when the matchAll method is called with a regular expression that does not have the global flag (g).
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.
Checks for comparisons between object and array literals.
This rule warns when the replaceAll method is called with a regular expression that does not have the global flag (g).