项目原始demo,不改动
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.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
 
 
 
 

40 lines
1.0 KiB

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