code: function printDanglingComments(path, options, sameIndent, filter) {
    const parts = [];
    const node = path.getValue();
  
    if (!node || !node.comments) {
      return "";
    }
  
    path.each(commentPath => {
      const comment = commentPath.getValue();
      if (
        comment &&
        !comment.leading &&
        !comment.trailing &&
        (!filter || filter(comment))
      ) {
        parts.push(printComment(commentPath, options));
      }
    }, "comments");
  
    if (parts.length === 0) {
      return "";
    }
  
    if (sameIndent) {
      return join(hardline, parts);
    }
    return indent(concat([hardline, join(hardline, parts)]));
  }
docs: https://github.com/prettier/prettier/blob/master/src/main/comments.js#L440