<commit_before>import postcss from 'postcss';
import getRulesMatcher from './rulesMatcher';
import getReset from './resetRules';
import createResetRule from './createResetRule';

const contains = (array, item) => array.indexOf(item) !== -1;

export default postcss.plugin('postcss-autoreset', (opts = {})=> {
  opts.rulesMatcher = opts.rulesMatcher || 'bem';
  opts.reset = opts.reset || 'initial';
  const rulesMatcher = getRulesMatcher(opts.rulesMatcher);
  const reset = getReset(opts.reset);
  return (css) => {
    const matchedSelectors = [];
    css.walkRules((rule)=> {
      const {selector} = rule;
      if (rule.parent.name === 'keyframes') return;
      if (!contains(matchedSelectors, selector) && rulesMatcher(rule)) {
        matchedSelectors.push(selector);
      }
    });
    if (!matchedSelectors.length) return;
    css.prepend(
      createResetRule(matchedSelectors, reset)<commit_msg>Changed keyframe test to also ignore keyframes with vendor prefixes<commit_after>import postcss from 'postcss';
import getRulesMatcher from './rulesMatcher';
import getReset from './resetRules';
import createResetRule from './createResetRule';

const contains = (array, item) => array.indexOf(item) !== -1;

export default postcss.plugin('postcss-autoreset', (opts = {})=> {
  opts.rulesMatcher = opts.rulesMatcher || 'bem';
  opts.reset = opts.reset || 'initial';
  const rulesMatcher = getRulesMatcher(opts.rulesMatcher);
  const reset = getReset(opts.reset);
  return (css) => {
    const matchedSelectors = [];
    css.walkRules((rule)=> {
      const {selector} = rule;
      if (/^(-(webkit|moz|ms|o)-)?keyframes$/.test(rule.parent.name)) return;
      if (!contains(matchedSelectors, selector) && rulesMatcher(rule)) {
        matchedSelectors.push(selector);
      }
    });
    if (!matchedSelectors.length) return;
    css.prepend(
      createResetRule(matchedSelectors, reset)
{'fraction_non_alphanumeric': 0.14767932489451477, 'fraction_numerical': 0.0010548523206751054, 'mean_word_length': 4.225895316804408, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '861102', 'n_tokens_mistral': 555, 'n_tokens_neox': 553, 'n_words': 129}