Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign updisallow negating the left operand of relational operators (no-unsafe-negation) #595
Comments
feross
added
the
enhancement
label
Aug 19, 2016
feross
modified the milestone:
v8
Aug 19, 2016
feross
added a commit
to standard/eslint-config-standard
that referenced
this issue
Aug 19, 2016
feross
closed this
Aug 19, 2016
Merged
lock
bot
locked as resolved and limited conversation to collaborators
May 10, 2018
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
feross commentedAug 19, 2016
Just as developers might type
-a + bwhen they mean-(a + b)for the negative of a sum, they might type!key in objectby mistake when they almost certainly mean!(key in object)to test that a key is not in an object.!obj instanceof Ctoris similar.Rule Details
This rule disallows negating the left operand of Relational Operators.
Relational Operators are:
inoperator.instanceofoperator.Examples of incorrect code for this rule:
Examples of correct code for this rule:
http://eslint.org/docs/rules/no-unsafe-negation
Likely to catch bugs, and there's basically never a reason to write code that this would flag, so I'll merge this into the standard v8 beta.