Skip to content

Unexpected comment placement after transformation #25

Description

@raphinesse

Again, thanks for this code mod. It works very well so far!

I just wanted to pass on some examples where comments in the transformed code were not placed like I expected them to be.

Environment

  • @codemodsquad/asyncify: 2.0.5
  • jscodeshift: 0.11.0
    • babel: 7.10.2
    • babylon: 7.10.2
    • flow: 0.138.0
    • recast: 0.20.4

Input

function a (x) {
    // Apply f to x because ...
    return f(x)
        .then(() => x);
}

function b (x) {
    return f(x)
        // Always return true because ...
        .then(() => true);
}

Actual Output

async function a(x) {
    await f(x);
    // Apply f to x because ...
    return x;
}

async function b(x) {
    await // Always return true because ...
    f(x);

    return true;
}

Expected Output

async function a(x) {
    // Apply f to x because ...
    await f(x);
    return x;
}

async function b(x) {
    await f(x);
    // Always return true because ...
    return true;
}

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions