Sha256: 5509f7231e753122ebe25be74e745414b57be6ae1941c474ade01078dde8073a

Contents?: true

Size: 595 Bytes

Versions: 13

Compression:

Stored size: 595 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) && !simple.is_a?(Sass::Selector::Pseudo) }
        add_lint(seq, "Selector `#{seq}` can be simplified to `#{id_sel}`, " <<
                      'since IDs should be uniquely identifying')
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
scss-lint-0.20.3 lib/scss_lint/linter/id_with_extraneous_selector.rb
scss-lint-0.20.2 lib/scss_lint/linter/id_with_extraneous_selector.rb
scss-lint-0.20.1 lib/scss_lint/linter/id_with_extraneous_selector.rb
scss-lint-0.20.0 lib/scss_lint/linter/id_with_extraneous_selector.rb
scss-lint-0.19.0 lib/scss_lint/linter/id_with_extraneous_selector.rb
scss-lint-0.18.0 lib/scss_lint/linter/id_with_extraneous_selector.rb
scss-lint-0.17.3 lib/scss_lint/linter/id_with_extraneous_selector.rb
scss-lint-0.17.2 lib/scss_lint/linter/id_with_extraneous_selector.rb
scss-lint-0.17.1 lib/scss_lint/linter/id_with_extraneous_selector.rb
scss-lint-0.17.0 lib/scss_lint/linter/id_with_extraneous_selector.rb
scss-lint-0.16.1 lib/scss_lint/linter/id_with_extraneous_selector.rb
scss-lint-0.16.0 lib/scss_lint/linter/id_with_extraneous_selector.rb
scss-lint-0.15.0 lib/scss_lint/linter/id_with_extraneous_selector.rb