src/language-js/printer-estree.js/willPrintOwnComments
function willPrintOwnComments(path) {
  const node = path.getValue();
  const parent = path.getParentNode();

  return (
    ((node && isJSXNode(node)) ||
      (parent &&
        (parent.type === "JSXSpreadAttribute" ||
          parent.type === "JSXSpreadChild" ||
          parent.type === "UnionTypeAnnotation" ||
          parent.type === "TSUnionType" ||
          ((parent.type === "ClassDeclaration" ||
            parent.type === "ClassExpression") &&
            parent.superClass === node)))) &&
    !privateUtil.hasIgnoreComment(path)
  );
}