Sha256: 7c5846a1190833b8cf13f85f06ffafacea9279a89fa65e720864e5bded0ee72b

Contents?: true

Size: 554 Bytes

Versions: 4

Compression:

Stored size: 554 Bytes

Contents

module SCSSLint
  # Checks for a selector with an ID combined with some other selector.
  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

4 entries across 4 versions & 1 rubygems

Version Path
scss-lint-0.14.0 lib/scss_lint/linter/id_with_extraneous_selector.rb
scss-lint-0.13.0 lib/scss_lint/linter/id_with_extraneous_selector.rb
scss-lint-0.12.1 lib/scss_lint/linter/id_with_extraneous_selector.rb
scss-lint-0.12.0 lib/scss_lint/linter/id_with_extraneous_selector.rb