75bdf7319216b1dabb5fefb88e55d6eb3a507a97
[platform/framework/web/crosswalk-tizen.git] /
1 /**
2  * @fileoverview A rule to disallow negated left operands of the `in` operator
3  * @author Michael Ficarra
4  */
5
6 "use strict";
7
8 //------------------------------------------------------------------------------
9 // Rule Definition
10 //------------------------------------------------------------------------------
11
12 module.exports = function(context) {
13
14     return {
15
16         "BinaryExpression": function(node) {
17             if (node.operator === "in" && node.left.type === "UnaryExpression" && node.left.operator === "!") {
18                 context.report(node, "The `in` expression's left operand is negated");
19             }
20         }
21     };
22
23 };