1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 | "use strict";
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 | module.exports = {
|
14 | meta: {
|
15 | docs: {
|
16 | description: "disallow negating the left operand in `in` expressions",
|
17 | category: "Possible Errors",
|
18 | recommended: true,
|
19 | replacedBy: ["no-unsafe-negation"]
|
20 | },
|
21 | deprecated: true,
|
22 |
|
23 | schema: []
|
24 | },
|
25 |
|
26 | create(context) {
|
27 |
|
28 | return {
|
29 |
|
30 | BinaryExpression(node) {
|
31 | if (node.operator === "in" && node.left.type === "UnaryExpression" && node.left.operator === "!") {
|
32 | context.report(node, "The 'in' expression's left operand is negated.");
|
33 | }
|
34 | }
|
35 | };
|
36 |
|
37 | }
|
38 | };
|