Repository: prettier/prettier
File: src/language-css/print/comma-separated-value-group.js (JavaScript)

Code before:
      declAncestorProp.startsWith("grid-template"));
  const atRuleAncestorNode = path.findAncestor(
    (node) => node.type === "css-atrule",
  );
  const isControlDirective =
    atRuleAncestorNode &&
    isSCSSControlDirectiveNode(atRuleAncestorNode, options);
  const hasInlineComment = node.groups.some((node) =>
    isInlineValueCommentNode(node),
  );

  const printed = path.map(print, "groups");
  const parts = [];
  const insideURLFunction = insideValueFunctionNode(path, "url");

  let insideSCSSInterpolationInString = false;
  let didBreak = false;

  for (let i = 0; i < node.groups.length; ++i) {
    const iPrevNode = node.groups[i - 1];
    const iNode = node.groups[i];
    const iNextNode = node.groups[i + 1];
    const iNextNextNode = node.groups[i + 2];

    // if the node is comment and last node print it in a line suffix
    if (isInlineValueCommentNode(iNode) && iNextNode === undefined) {
      parts.push(lineSuffix([" ", printed[i], breakParent]));
      continue;
    }

    parts.push(printed[i]);

    if (insideURLFunction) {
      if ((iNextNode && isAdditionNode(iNextNode)) || isAdditionNode(iNode)) {
        parts.push(" ");
      }
      continue;
    }

    // Ignore SCSS @forward wildcard suffix
    if (
      insideAtRuleNode(path, "forward") &&
      iNode.type === "value-word" &&
      iNode.value &&
      iPrevNode !== undefined &&
      iPrevNode.type === "value-word" &&
      iPrevNode.value === "as" &&
      iNextNode.type === "value-operator" &&
      iNextNode.value === "*"
    ) {
      continue;

Review comment (suggestion):
```suggestion
    // If the node is comment and last node print it in a line suffix
    if (isInlineValueCommentNode(iNode) && !iNextNode) {
```

Code after:
  const isGridValue =
    declAncestorProp &&
    parentNode.type === "value-value" &&
    (declAncestorProp === "grid" ||
      declAncestorProp.startsWith("grid-template"));
  const atRuleAncestorNode = path.findAncestor(
    (node) => node.type === "css-atrule",
  );
  const isControlDirective =
    atRuleAncestorNode &&
    isSCSSControlDirectiveNode(atRuleAncestorNode, options);
  const hasInlineComment = node.groups.some((node) =>
    isInlineValueCommentNode(node),
  );

  const printed = path.map(print, "groups");
  /*
   * We assume parts always meet following conditions:
   * - parts.length is odd
   * - odd (0-indexed) elements are line-like doc
   * We can achieve this by following way:
   * - if we push line-like doc, we push empty string after it
   * - if we push non-line-like doc, push [parts.pop(), doc] instead
   */
  /** @type {Doc[]} */
  let parts = [""];
  const insideURLFunction = insideValueFunctionNode(path, "url");

  let insideSCSSInterpolationInString = false;
  let didBreak = false;

  for (let i = 0; i < node.groups.length; ++i) {
    const iPrevNode = node.groups[i - 1];
    const iNode = node.groups[i];
    const iNextNode = node.groups[i + 1];
    const iNextNextNode = node.groups[i + 2];

    // If the node is comment and last node print it in a line suffix
    if (isInlineValueCommentNode(iNode) && !iNextNode) {
      // TODO: Improve this part
      // This `lineSuffix` should be done in `value-comment` print
      // But since we add `line` to groups in `value-paren_group`,
      // The format result looks bad for now
      parts.push([parts.pop(), lineSuffix([" ", printed[i]])]);
      continue;
    }

    parts.push([parts.pop(), printed[i]]);

    if (insideURLFunction) {
      if ((iNextNode && isAdditionNode(iNextNode)) || isAdditionNode(iNode)) {