Sha256: 5e458c9182b3ad23989b87570c398a269285fa1db886078fa85bae791c070fb5

Contents?: true

Size: 482 Bytes

Versions: 3

Compression:

Stored size: 482 Bytes

Contents

module SCSSLint
  class Linter::IdWithExtraneousSelector < Linter
    include LinterRegistry

    def visit_simple_sequence(seq)
      id_sel = seq.members.find { |simple| simple.is_a?(Sass::Selector::Id) }
      return unless id_sel

      if seq.members.any? { |simple| !simple.is_a?(Sass::Selector::Id) }
        add_lint(seq, "Selector `#{seq}` can be simplified to `#{id_sel}`, " <<
                      'since IDs should be uniquely identifying')
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
scss-lint-0.11.1 lib/scss_lint/linter/id_with_extraneous_selector.rb
scss-lint-0.10.1 lib/scss_lint/linter/id_with_extraneous_selector.rb
scss-lint-0.10.0 lib/scss_lint/linter/id_with_extraneous_selector.rb