From de8873ab233544712012e287a1f95e3f294ff29c Mon Sep 17 00:00:00 2001 From: Davy Duperron Date: Mon, 20 Feb 2017 16:15:46 +0100 Subject: [PATCH] Add missing explanatory comment in ForStatement case (#748) * Add missing explanatory comment in ForStatement case :notepad-spiral:. * Update comment :rocket:. --- src/printer.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/printer.js b/src/printer.js index a4e368cb..d7ec07e2 100644 --- a/src/printer.js +++ b/src/printer.js @@ -989,6 +989,9 @@ function genericPrintNoParens(path, options, print) { case "ForStatement": { const body = adjustClause(path.call(print, "body"), options); + // We want to keep dangling comments above the loop to stay consistent. + // Any comment positioned between the for statement and the parentheses + // is going to be printed before the statement. const dangling = comments.printDanglingComments(path, options, /* sameLine */ true); const printedComments = dangling ? concat([dangling, softline]) : "";