Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2.8k
Closed
Description
Repro
{"rules": {"no-unsafe-negation": ["error", {"enforceForOrderingRelations":true }], }}
consta=1;constb=2;letfoo;if(!a<b){/**/}while(!a>b){/**/}foo=!a<=b;foo=!a>=b;constmyObject={};constkey="";constCtor=Function;if(!keyinmyObject){// operator precedence makes it equivalent to (!key) in object// and type conversion makes it equivalent to (key ? "false" : "true") in object}if(!myObjectinstanceofCtor){// 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 technicallyTS2365
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 |