summaryrefslogtreecommitdiff
path: root/tools/eslint/lib/rules/no-extra-boolean-cast.js
diff options
context:
space:
mode:
Diffstat (limited to 'tools/eslint/lib/rules/no-extra-boolean-cast.js')
-rw-r--r--tools/eslint/lib/rules/no-extra-boolean-cast.js2
1 files changed, 2 insertions, 0 deletions
diff --git a/tools/eslint/lib/rules/no-extra-boolean-cast.js b/tools/eslint/lib/rules/no-extra-boolean-cast.js
index bd7495b891..c7ee1adc6b 100644
--- a/tools/eslint/lib/rules/no-extra-boolean-cast.js
+++ b/tools/eslint/lib/rules/no-extra-boolean-cast.js
@@ -31,6 +31,7 @@ module.exports = function(context) {
return (
(BOOLEAN_NODE_TYPES.indexOf(parent.type) !== -1 &&
node === parent.test) ||
+
// !<bool>
(parent.type === "UnaryExpression" &&
parent.operator === "!")
@@ -52,6 +53,7 @@ module.exports = function(context) {
}
if (isInBooleanContext(parent, grandparent) ||
+
// Boolean(<bool>) and new Boolean(<bool>)
((grandparent.type === "CallExpression" || grandparent.type === "NewExpression") &&
grandparent.callee.type === "Identifier" &&