Urara-Blog/node_modules/.pnpm-store/v3/files/52/db23cf086e936559b40405618e65422b3b2058c4bd020a9fb191aeced5b29852623c03e66a35173c6dc1ef75be8a812eae7843078376d433c896304e58d058
2022-08-14 01:14:53 +08:00

46 lines
1.2 KiB
Text

/**
* @fileoverview A rule to disallow negated left operands of the `in` operator
* @author Michael Ficarra
* @deprecated in ESLint v3.3.0
*/
"use strict";
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
/** @type {import('../shared/types').Rule} */
module.exports = {
meta: {
type: "problem",
docs: {
description: "Disallow negating the left operand in `in` expressions",
recommended: false,
url: "https://eslint.org/docs/rules/no-negated-in-lhs"
},
replacedBy: ["no-unsafe-negation"],
deprecated: true,
schema: [],
messages: {
negatedLHS: "The 'in' expression's left operand is negated."
}
},
create(context) {
return {
BinaryExpression(node) {
if (node.operator === "in" && node.left.type === "UnaryExpression" && node.left.operator === "!") {
context.report({ node, messageId: "negatedLHS" });
}
}
};
}
};