From 79eaa5a6e1fac5f74d3184388d973d1c40b2b4fe Mon Sep 17 00:00:00 2001 From: Simon Lydell Date: Tue, 12 Sep 2017 16:28:57 +0200 Subject: [PATCH] Remove reassignment in createUsage --- src/cli-util.js | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/src/cli-util.js b/src/cli-util.js index 7a2f4f0d..34f8358a 100644 --- a/src/cli-util.js +++ b/src/cli-util.js @@ -334,7 +334,7 @@ function createUsage() { return current; }, {}); - let usage = "Usage: prettier [opts] [filename ...]\n\n"; + const usageSummary = "Usage: prettier [opts] [filename ...]"; const categoryOrder = ["Command", "Format", "Config", "Other"]; @@ -361,19 +361,17 @@ function createUsage() { } }); - usage += categoryOrder - .map(category => { - return `${category} options:\n\n${indent( - groupedOptions[category] - .filter(option => option.description) - .map(option => createOptionUsage(option, 25)) - .join("\n"), - 2 - )}`; - }) - .join("\n\n"); + const optionsUsage = categoryOrder.map(category => { + return `${category} options:\n\n${indent( + groupedOptions[category] + .filter(option => option.description) + .map(option => createOptionUsage(option, 25)) + .join("\n"), + 2 + )}`; + }); - return usage + "\n\n"; + return [usageSummary].concat(optionsUsage, [""]).join("\n\n"); } function createOptionUsage(option, threshold) {