Skip to content

Commit

Permalink
Fix linting errors [#5]
Browse files Browse the repository at this point in the history
  • Loading branch information
sgilroy committed Sep 30, 2018
1 parent 02b0ca4 commit ebd10de
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions __testfixtures__/async-await.input.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,11 @@ function returnsSomethingDone() {
return promise.then(doSomething);
}

function returnsSomethingDone(options) {
function returnsSomethingDone2(options) {
return promise.then(options.doSomething);
}

function returnsSomethingDone2(options) {
function returnsSomethingDone3(options) {
return getPromise(options).then(options.doSomething);
}

Expand Down
4 changes: 2 additions & 2 deletions __testfixtures__/async-await.output.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,12 @@ async function returnsSomethingDone() {
return doSomething(promiseResult);
}

async function returnsSomethingDone(options) {
async function returnsSomethingDone2(options) {
const promiseResult = await promise;
return options.doSomething(promiseResult);
}

async function returnsSomethingDone2(options) {
async function returnsSomethingDone3(options) {
const getPromiseResult = await getPromise(options);
return options.doSomething(getPromiseResult);
}
Expand Down
4 changes: 3 additions & 1 deletion async-await.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ module.exports = function transformer(file, api) {
const getRestFromCallBack = (callBack, lastExp, resultIdentifierName) => {
let rest;
if (!callBack.body) {
const callBackCall = j.callStatement(callBack, [j.identifier(resultIdentifierName)]);
const callBackCall = j.callStatement(callBack, [
j.identifier(resultIdentifierName)
]);
if (lastExp.type === 'ReturnStatement') {
// "return promise.then(doSomething)" becomes "return doSomething(promiseResult)"
rest = [j.returnStatement(callBackCall.expression)];
Expand Down
2 changes: 1 addition & 1 deletion lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ module.exports = {
* @param {Node} callExp
* @return {{errorCallBack: Node, callBack: Node, thenCalleeObject: Node}}
*/
parseCallExpression: (callExp) => {
parseCallExpression: callExp => {
let errorCallBack, callBack;
let thenCalleeObject;
if (callExp.callee.property.name === 'catch') {
Expand Down

0 comments on commit ebd10de

Please sign in to comment.