no-negated-in-lhs
eslint
No autofix
eslint.config.js
export default [
{
rules: {
"no-negated-in-lhs": "error",
},
},
];This rule is deprecated. Check its documentation for a replacement before enabling it.
if(!key in object) {
// operator precedence makes it equivalent to (!key) in object
// and type conversion makes it equivalent to (key ? "false" : "true") in object
}if(!(key in object)) {
// key is not in object
}
if(('' + !key) in object) {
// make operator precedence and type conversion explicit
// in a rare situation when that is the intended meaning
}Examples from the ESLint documentation.
no-negated-in-lhs
eslint
export default [
{
rules: {
"no-negated-in-lhs": "error",
},
},
];Oxlint does not have this rule.
suspicious/noUnsafeNegation
suspicious · since 1.0.0
{
"linter": {
"rules": {
"suspicious": {
"noUnsafeNegation": "error"
}
}
}
}Enforce consistent naming when capturing the current execution context
Disallow use of this in contexts where the value of this is undefined
Enforce a maximum depth that blocks can be nested
Enforce a maximum number of lines per file
Enforce a maximum number of parameters in function definitions
Disallow shorthand type conversions