Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

no-negated-in-lhs.js 1.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. "use strict";
  7. //------------------------------------------------------------------------------
  8. // Rule Definition
  9. //------------------------------------------------------------------------------
  10. module.exports = {
  11. meta: {
  12. type: "problem",
  13. docs: {
  14. description: "disallow negating the left operand in `in` expressions",
  15. category: "Possible Errors",
  16. recommended: false,
  17. url: "https://eslint.org/docs/rules/no-negated-in-lhs"
  18. },
  19. replacedBy: ["no-unsafe-negation"],
  20. deprecated: true,
  21. schema: []
  22. },
  23. create(context) {
  24. return {
  25. BinaryExpression(node) {
  26. if (node.operator === "in" && node.left.type === "UnaryExpression" && node.left.operator === "!") {
  27. context.report({ node, message: "The 'in' expression's left operand is negated." });
  28. }
  29. }
  30. };
  31. }
  32. };