Skip to content

Async codemod introduces improper awaits and does not create async anonymous function contexts #87

Description

@kliph-gladly

Running the async codemod on the following code

const foo = function() {
  mySyncFunctionDoesNotReturnAPromiseOrEvenExist();
};

produces

const foo = function() {
  await mySyncFunctionDoesNotReturnAPromiseOrEvenExist();
};

This is syntactically incorrect for two reasons.

  • The outer function context foo is not async so it doesn't make sense to use await within it.
  • The function called in the inner scope mySyncFunctionDoesNotReturnAPromiseOrEvenExist does not return a Promise, so it doesn't make sense to use await.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions