From a72e83c0013300636ace831588e27304f5c0fc91 Mon Sep 17 00:00:00 2001 From: Taylan Kenanoglu Date: Mon, 1 Oct 2018 09:37:51 +0200 Subject: [PATCH 1/2] Refactored combined use of await and .then to use await only. --- src/extensions/functions/updateVersions.ts | 29 +++++++++++----------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/src/extensions/functions/updateVersions.ts b/src/extensions/functions/updateVersions.ts index 3b99f28..c915c54 100644 --- a/src/extensions/functions/updateVersions.ts +++ b/src/extensions/functions/updateVersions.ts @@ -15,19 +15,18 @@ module.exports = async (context: SolidarityRunContext): Promise => { ) // run the array of promises you just created - await Promise.all(checks) - .then(results => { - const updates = flatten(results) - if (isEmpty(updates)) { - print.success('\n No Changes') - } else { - setSolidaritySettings(solidaritySettings, context) - const ruleMessage = pluralize('Rule', updates.length, true) - print.success(`\n ${ruleMessage} updated`) - } - }) - .catch(err => { - print.error(err) - process.exit(2) - }) + try { + const results = await Promise.all(checks); + const updates = flatten(results) + if (isEmpty(updates)) { + print.success('\n No Changes') + } else { + setSolidaritySettings(solidaritySettings, context) + const ruleMessage = pluralize('Rule', updates.length, true) + print.success(`\n ${ruleMessage} updated`) + } + } catch (err) { + print.error(err) + process.exit(2) + } } From 0a763347e2fe0f8b2315bde516264416534806fc Mon Sep 17 00:00:00 2001 From: Taylan Kenanoglu Date: Mon, 1 Oct 2018 09:55:18 +0200 Subject: [PATCH 2/2] Removed an unnecessary semicolon --- src/extensions/functions/updateVersions.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/extensions/functions/updateVersions.ts b/src/extensions/functions/updateVersions.ts index c915c54..fb8047d 100644 --- a/src/extensions/functions/updateVersions.ts +++ b/src/extensions/functions/updateVersions.ts @@ -16,7 +16,7 @@ module.exports = async (context: SolidarityRunContext): Promise => { // run the array of promises you just created try { - const results = await Promise.all(checks); + const results = await Promise.all(checks) const updates = flatten(results) if (isEmpty(updates)) { print.success('\n No Changes')