sgilroy / async-await-codemod

Codemod script for migrating promise-based functions to use async/await syntax
29 stars 4 forks source link

Errors on empty array destructuring #2

Closed turadg closed 6 years ago

turadg commented 6 years ago

For example,

}).then(([, session]) => {
sgilroy commented 6 years ago

@turadg Can you please provide a more complete example?

I tested with the following, and there was no error from the code mod:

function arrayDestructuring() {
  return b().then(([, destructuredArrayElement]) => {
    return destructuredArrayElement.d;
  });
}

Result:

async function arrayDestructuring() {
  const [, destructuredArrayElement] = await b();
  return destructuredArrayElement.d;
}
turadg commented 6 years ago

Sorry, can't find the example anymore. But I did file a couple more detailed bug report.

FWIW, here's the success rate on my repo,

136 errors
2324 unmodified
2 skipped
6 ok
sgilroy commented 6 years ago

@turadg Please provide details if you can reproduce.