'use strict';

const listSequences = require('./list-sequences');
const shouldIgnoreRule = require('./should-ignore-rule');
const shouldIgnoreSelector = require('./should-ignore-selector');
const getSelectors = require('./get-selectors');

/**
 * @param {Object} config
 * @param {Rule} config.rule - PostCSS Rule
 * @param {RegExp} config.utilityPattern
 * @param {RegExp} config.ignorePattern
 * @param {Result} config.result - PostCSS Result, for registering warnings
 */
module.exports = config => {
  if (shouldIgnoreRule(config.rule)) return;
  const selectors = getSelectors(config.rule);

  selectors.forEach(selector => {
    const allSequences = listSequences(selector);
    let sequence;
    for (let i = 0, l = allSequences.length; i < l; i++) {
      sequence = allSequences[i];
      if (config.ignorePattern && shouldIgnoreSelector(sequence, config.ignorePattern)) continue;
      if (config.utilityPattern.test(sequence)) continue;
      config.result.warn(
        `Invalid utility selector "${selector}"`,
        {
          node: config.rule,
          word: selector,
        }
      );
      return;
    }
  });
}

@@ -682,86 +682,18 @@
     
-let sequence;%0A    for (let i = 0, l = allSequences.length; i %3C l; i++) %7B%0A     
+for (const
  seq
@@ -698,17 +698,18 @@
 equence 
-=
+of
  allSequ
@@ -717,12 +717,11 @@
 nces
-%5Bi%5D;
+) %7B
 %0A   

Use for in loop