Sha256: 6eeb6d363eeee4abebd27212b19d7bdecee11b3fa97540a12764955b8f2dbd36
Contents?: true
Size: 741 Bytes
Versions: 22
Compression:
Stored size: 741 Bytes
Contents
module SCSSLint # Checks for uses of chained classes (e.g. .foo.bar). class Linter::ChainedClasses < Linter include LinterRegistry def visit_sequence(sequence) line_offset = 0 sequence.members.each do |member| line_offset += 1 if member =~ /\n/ next unless chained_class?(member) add_lint(member.line + line_offset, 'Prefer using a distinct class over chained classes ' \ '(e.g. .new-class over .foo.bar') end end private def chained_class?(simple_sequence) return unless simple_sequence.is_a?(Sass::Selector::SimpleSequence) simple_sequence.members.count { |member| member.is_a?(Sass::Selector::Class) } >= 2 end end end
Version data entries
22 entries across 22 versions & 1 rubygems
Version | Path |
---|---|
scss_lint-0.44.0 | lib/scss_lint/linter/chained_classes.rb |
scss_lint-0.43.2 | lib/scss_lint/linter/chained_classes.rb |