src/rules/label-has-for.js
function validateNesting(node) {
  let queue = [...node.parent.children];
  let child;
  let opener;
  while (queue.length) {
    child = queue.shift();
    opener = child.openingElement;
    if (child.type === 'JSXElement' && opener && (opener.name.name === 'input' || opener.name.name === 'textarea')) {
      return true;
    }
    if (child.children) {
      queue = queue.concat(child.children);
    }
  }
  return false;
}
function validateNesting(node) {
  let queue = [...node.parent.children];
  let child;
  let opener;
  while (queue.length) {
    child = queue.shift();
    opener = child.openingElement;
    if (child.type === 'JSXElement' && opener && (opener.name.name === 'input' || opener.name.name === 'textarea')) {
      return true;
    }
    if (child.children) {
      queue = queue.concat(child.children);
    }
  }
  return false;
}
function validateNesting ( node ) { let queue = [ ... node . parent . children ] ; let child ; let opener ; while ( queue . length ) { child = queue . shift ( ) ; opener = child . openingElement ; if ( child . type === 'JSXElement' && opener && ( opener . name . name === 'input' || opener . name . name === 'textarea' ) ) { return true ; } if ( child . children ) { queue = queue . concat ( child . children ) ; } } return false ; }
Breadth-first search, assuming that HTML for forms is shallow.
Breadth - first search assuming that HTML for forms is shallow .