Sha256: 2cb95216c22c20c63dfaa8cd766976999276424393bd0ea06a31a6c4431023b3

Contents?: true

Size: 464 Bytes

Versions: 5

Compression:

Stored size: 464 Bytes

Contents

require 'sass'

module SCSSLint
  class Linter::TypeInIdSelectorLinter < Linter
    include LinterRegistry

    def visit_rule(node)
      selectors = node.rule.first.to_s.split(',')
      selectors.each do |selector|
        add_lint(node) if selector.strip =~ /^[a-z0-9]+#.*/i
      end

      yield # Continue linting children
    end

    def description
      'Avoid ID names with unnecessary type selectors (e.g. prefer `#id` over `p#id`)'
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
scss-lint-0.7.1 lib/scss_lint/linter/type_in_id_selector_linter.rb
scss-lint-0.7.0 lib/scss_lint/linter/type_in_id_selector_linter.rb
scss-lint-0.6.7 lib/scss_lint/linter/type_in_id_selector_linter.rb
scss-lint-0.6.6 lib/scss_lint/linter/type_in_id_selector_linter.rb
scss-lint-0.6.5 lib/scss_lint/linter/type_in_id_selector_linter.rb