no-self-compare
eslint
No autofix
eslint.config.js
export default [
{
rules: {
"no-self-compare": "error",
},
},
];Disallow comparisons where both sides are exactly the same
let x = 10;
if (x === x) {
x = 20;
}The documentation shows no correct example for this rule.
Examples from the ESLint documentation.
no-self-compare
eslint
export default [
{
rules: {
"no-self-compare": "error",
},
},
];no-self-compare
eslint plugin · pedantic
{
"rules": {
"no-self-compare": "error"
}
}suspicious/noSelfCompare
suspicious · since 1.0.0
{
"linter": {
"rules": {
"suspicious": {
"noSelfCompare": "error"
}
}
}
}Disallow octal escape sequences in string literals
Disallow the use of eval()-like methods