lib/rules/sort-declarations-alphabetically.js
function isValidAtomicRule(rule) {
  const decls = rule.nodes.filter(node => node.type === "decl");
  if (decls.length < 0) {
    return { isValid: true };
  }

  for (let i = 1; i < decls.length; i++) {
    const current = decls[i].prop;
    const prev = decls[i - 1].prop;
    if (current < prev) {
      const loc = {
        start: {
          line: decls[i - 1].source.start.line,
          column: decls[i - 1].source.start.column - 1
        },
        end: {
          line: decls[i].source.end.line,
          column: decls[i].source.end.column - 1
        }
      };

      return { isValid: false, loc };
    }
  }

  return { isValid: true };
}
function isValidAtomicRule(rule) {
  const decls = rule.nodes.filter(node => node.type === "decl");
  if (decls.length < 0) {
    return { isValid: true };
  }

  for (let i = 1; i < decls.length; i++) {
    const current = decls[i].prop;
    const prev = decls[i - 1].prop;
    if (current < prev) {
      const loc = {
        start: {
          line: decls[i - 1].source.start.line,
          column: decls[i - 1].source.start.column - 1
        },
        end: {
          line: decls[i].source.end.line,
          column: decls[i].source.end.column - 1
        }
      };

      return { isValid: false, loc };
    }
  }

  return { isValid: true };
}
function isValidAtomicRule ( rule ) { const decls = rule . nodes . filter ( node => node . type === "decl" ) ; if ( decls . length < 0 ) { return { isValid : true } ; } for ( let i = 1 ; i < decls . length ; i ++ ) { const current = decls [ i ] . prop ; const prev = decls [ i - 1 ] . prop ; if ( current < prev ) { const loc = { start : { line : decls [ i - 1 ] . source . start . line , column : decls [ i - 1 ] . source . start . column - 1 } , end : { line : decls [ i ] . source . end . line , column : decls [ i ] . source . end . column - 1 } } ; return { isValid : false , loc } ; } } return { isValid : true } ; }
An atomic rule is a rule without nested rules.
An atomic rule is a rule without nested rules .