]> git.proxmox.com Git - pve-eslint.git/blame - eslint/lib/rules/no-negated-in-lhs.js
import 8.3.0 source
[pve-eslint.git] / eslint / lib / rules / no-negated-in-lhs.js
CommitLineData
eb39fafa
DC
1/**
2 * @fileoverview A rule to disallow negated left operands of the `in` operator
3 * @author Michael Ficarra
4 * @deprecated in ESLint v3.3.0
5 */
6
7"use strict";
8
9//------------------------------------------------------------------------------
10// Rule Definition
11//------------------------------------------------------------------------------
12
13module.exports = {
14 meta: {
15 type: "problem",
16
17 docs: {
18 description: "disallow negating the left operand in `in` expressions",
eb39fafa
DC
19 recommended: false,
20 url: "https://eslint.org/docs/rules/no-negated-in-lhs"
21 },
22
23 replacedBy: ["no-unsafe-negation"],
24
25 deprecated: true,
26 schema: [],
27
28 messages: {
29 negatedLHS: "The 'in' expression's left operand is negated."
30 }
31 },
32
33 create(context) {
34
35 return {
36
37 BinaryExpression(node) {
38 if (node.operator === "in" && node.left.type === "UnaryExpression" && node.left.operator === "!") {
39 context.report({ node, messageId: "negatedLHS" });
40 }
41 }
42 };
43
44 }
45};