Closed
Description
Repro
{
"rules": {
"no-unsafe-negation": ["error", { "enforceForOrderingRelations": true }],
}
}
const a = 1;
const b = 2;
let foo;
if (!a < b) {
/**/
}
while (!a > b) {
/**/
}
foo = !a <= b;
foo = !a >= b;
const myObject = {};
const key = "";
const Ctor = Function;
if (!key in myObject) {
// operator precedence makes it equivalent to (!key) in object
// and type conversion makes it equivalent to (key ? "false" : "true") in object
}
if (!myObject instanceof Ctor) {
// operator precedence makes it equivalent to (!obj) instanceof Ctor
// and it equivalent to always false since boolean values are not objects.
}
Expected Result
TS errors only.
Actual Result
TS and ESLint errors.
Additional Info
enforceForOrderingRelations
is actually off by default, so technically TS2365
is probably not being duplicated.
Versions
package | version |
---|---|
@typescript-eslint/eslint-plugin |
2.5.0 |
@typescript-eslint/parser |
2.5.0 |
TypeScript |
3.5.3 |
ESLint |
6.6.0 |
node |
12.13.0 |
npm |
6.12.0 |