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-iterator.js 1.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /**
  2. * @fileoverview Rule to flag usage of __iterator__ property
  3. * @author Ian Christian Myers
  4. */
  5. "use strict";
  6. //------------------------------------------------------------------------------
  7. // Rule Definition
  8. //------------------------------------------------------------------------------
  9. module.exports = {
  10. meta: {
  11. type: "suggestion",
  12. docs: {
  13. description: "disallow the use of the `__iterator__` property",
  14. category: "Best Practices",
  15. recommended: false,
  16. url: "https://eslint.org/docs/rules/no-iterator"
  17. },
  18. schema: []
  19. },
  20. create(context) {
  21. return {
  22. MemberExpression(node) {
  23. if (node.property &&
  24. (node.property.type === "Identifier" && node.property.name === "__iterator__" && !node.computed) ||
  25. (node.property.type === "Literal" && node.property.value === "__iterator__")) {
  26. context.report({ node, message: "Reserved name '__iterator__'." });
  27. }
  28. }
  29. };
  30. }
  31. };