HEX
Server: Apache
System: Linux webd004.cluster130.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64
User: frenchy (106757)
PHP: 7.4.33
Disabled: _dyuweyrj4,_dyuweyrj4r,dl
Upload Files
File: /home/frenchy/www/french-american.org/current/node_modules/stylelint/lib/utils/isFirstNested.js
/* @flow */
"use strict";

module.exports = function(statement /*: postcss$node*/) /*: boolean*/ {
  const parentNode = statement.parent;

  if (parentNode === undefined || parentNode.type === "root") {
    return false;
  }

  if (statement === parentNode.first) {
    return true;
  }

  /*
   * Search for the statement in the parent's nodes, ignoring comment
   * nodes on the same line as the parent's opening brace.
   */

  const parentNodes = parentNode.nodes;
  const firstNode = parentNodes[0];

  if (firstNode.type !== "comment" || firstNode.raws.before.includes("\n")) {
    return false;
  }

  const openingBraceLine = firstNode.source.start.line;

  if (openingBraceLine !== firstNode.source.end.line) {
    return false;
  }

  for (let i = 1; i < parentNodes.length; i++) {
    const node = parentNodes[i];

    if (node === statement) {
      return true;
    }

    if (node.type !== "comment" || node.source.end.line !== openingBraceLine) {
      return false;
    }
  }

  /* istanbul ignore next: Should always return in the loop */
  return false;
};