Skip to content

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

@kliph-gladly

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.

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