src/main/comments.js/printLeadingComment
function printLeadingComment(path, options) {
  const comment = path.getValue();
  const parts = [printComment(path, options)];

  const { printer, originalText, locStart, locEnd } = options;
  const isBlock = printer.isBlockComment && printer.isBlockComment(comment);

  // Leading block comments should see if they need to stay on the
  // same line or not.
  if (isBlock) {
    const lineBreak = hasNewline(originalText, locEnd(comment))
      ? hasNewline(originalText, locStart(comment), {
          backwards: true,
        })
        ? hardline
        : line
      : " ";

    parts.push(lineBreak);
  } else {
    parts.push(hardline);
  }

  const index = skipNewline(
    originalText,
    skipSpaces(originalText, locEnd(comment))
  );

  if (index !== false && hasNewline(originalText, index)) {
    parts.push(hardline);
  }

  return parts;
}