项目原始demo,不改动
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
Repozitorijs ir arhivēts. Tam var aplūkot failus un to var klonēt, bet nevar iesūtīt jaunas izmaiņas, kā arī atvērt jaunas problēmas/izmaiņu pieprasījumus.

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /**
  2. * @fileoverview Rule to flag use of an object property of the global object (Math and JSON) as a function
  3. * @author James Allardice
  4. */
  5. "use strict";
  6. //------------------------------------------------------------------------------
  7. // Rule Definition
  8. //------------------------------------------------------------------------------
  9. module.exports = {
  10. meta: {
  11. docs: {
  12. description: "disallow calling global object properties as functions",
  13. category: "Possible Errors",
  14. recommended: true,
  15. url: "https://eslint.org/docs/rules/no-obj-calls"
  16. },
  17. schema: []
  18. },
  19. create(context) {
  20. return {
  21. CallExpression(node) {
  22. if (node.callee.type === "Identifier") {
  23. const name = node.callee.name;
  24. if (name === "Math" || name === "JSON" || name === "Reflect") {
  25. context.report({ node, message: "'{{name}}' is not a function.", data: { name } });
  26. }
  27. }
  28. }
  29. };
  30. }
  31. };