Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
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-async-promise-executor.js 1.1KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. /**
  2. * @fileoverview disallow using an async function as a Promise executor
  3. * @author Teddy Katz
  4. */
  5. "use strict";
  6. //------------------------------------------------------------------------------
  7. // Rule Definition
  8. //------------------------------------------------------------------------------
  9. module.exports = {
  10. meta: {
  11. type: "problem",
  12. docs: {
  13. description: "disallow using an async function as a Promise executor",
  14. category: "Possible Errors",
  15. recommended: true,
  16. url: "https://eslint.org/docs/rules/no-async-promise-executor"
  17. },
  18. fixable: null,
  19. schema: [],
  20. messages: {
  21. async: "Promise executor functions should not be async."
  22. }
  23. },
  24. create(context) {
  25. return {
  26. "NewExpression[callee.name='Promise'][arguments.0.async=true]"(node) {
  27. context.report({
  28. node: context.getSourceCode().getFirstToken(node.arguments[0], token => token.value === "async"),
  29. messageId: "async"
  30. });
  31. }
  32. };
  33. }
  34. };