Sha256: 12de7c80504df0d5def5f5053128028bd4faf4b96a338a46db2a8d086a29fa50

Contents?: true

Size: 615 Bytes

Versions: 2

Compression:

Stored size: 615 Bytes

Contents

module SCSSLint
  # Checks for uses of chained classes (e.g. .foo.bar).
  class Linter::ChainedClasses < Linter
    include LinterRegistry

    def visit_sequence(sequence)
      sequence.members.each do |simple_sequence|
        next unless chained_class?(simple_sequence)
        add_lint(simple_sequence.line,
                 'Prefer using a distinct class over chained classes ' \
                 '(e.g. .new-class over .foo.bar')
      end
    end

  private

    def chained_class?(simple_sequence)
      simple_sequence.members.count { |member| member.is_a?(Sass::Selector::Class) } >= 2
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
scss_lint-0.43.1 lib/scss_lint/linter/chained_classes.rb
scss_lint-0.43.0 lib/scss_lint/linter/chained_classes.rb