src/language-js/print/array.js/printArrayItemsConcisely
function printArrayItemsConcisely(path, options, print, trailingComma) {
  const parts = [];

  path.each((childPath, i, elements) => {
    const isLast = i === elements.length - 1;

    parts.push([print(), isLast ? trailingComma : ","]);

    if (!isLast) {
      parts.push(
        isNextLineEmpty(childPath.getValue(), options)
          ? [hardline, hardline]
          : hasComment(
              elements[i + 1],
              CommentCheckFlags.Leading | CommentCheckFlags.Line
            )
          ? hardline
          : line
      );
    }
  }, "elements");

  return fill(parts);
}