src/language-js/printer-estree.js/printClass
function printClass(path, options, print) {
  const n = path.getValue();
  const parts = [];

  if (n.abstract) {
    parts.push("abstract ");
  }

  parts.push("class");

  // Keep old behaviour of extends in same line
  // If there is only on extends and there are not comments
  const groupMode =
    (n.id && hasTrailingComment(n.id)) ||
    (n.superClass &&
      n.superClass.comments &&
      n.superClass.comments.length !== 0) ||
    (n.extends && n.extends.length !== 0) || // DeclareClass
    (n.mixins && n.mixins.length !== 0) ||
    (n.implements && n.implements.length !== 0);

  const partsGroup = [];

  if (n.id) {
    partsGroup.push(" ", path.call(print, "id"));
  }

  partsGroup.push(path.call(print, "typeParameters"));

  function printList(listName) {
    if (n[listName] && n[listName].length !== 0) {
      const printedLeadingComments = comments.printDanglingComments(
        path,
        options,
        /* sameIndent */ true,
        ({ marker }) => marker === listName
      );
      partsGroup.push(
        line,
        printedLeadingComments,
        printedLeadingComments && hardline,
        listName,
        group(
          indent(
            concat([line, join(concat([",", line]), path.map(print, listName))])
          )
        )
      );
    }
  }

  if (n.superClass) {
    const printed = concat([
      "extends ",
      path.call(print, "superClass"),
      path.call(print, "superTypeParameters"),
    ]);
    const printedWithComments = path.call(
      (superClass) =>
        comments.printComments(superClass, () => printed, options),
      "superClass"
    );
    if (groupMode) {
      partsGroup.push(line, group(printedWithComments));
    } else {
      partsGroup.push(" ", printedWithComments);
    }
  } else {
    printList("extends");
  }

  printList("mixins");
  printList("implements");

  if (groupMode) {
    parts.push(group(indent(concat(partsGroup))));
  } else {
    parts.push(...partsGroup);
  }

  parts.push(" ", path.call(print, "body"));

  return parts;
}