Sha256: 4f7aa31c04a05b0bd4cb2f464ce8c79859a23c4366f5a5af3a9cf64dcd608ecd

Contents?: true

Size: 816 Bytes

Versions: 3

Compression:

Stored size: 816 Bytes

Contents

module SCSSLint
  class Linter::CapitalizationInSelector < Linter
    include LinterRegistry

    def visit_attribute(attribute)
      check(attribute)
    end

    def visit_class(klass)
      check(klass)
    end

    def visit_element(element)
      check(element)
    end

    def visit_id(id)
      check(id)
    end

    def visit_placeholder(placeholder)
      check(placeholder)
    end

    def visit_pseudo(pseudo)
      check(pseudo, 'Pseudo-selector')
    end

  private

    def check(node, selector_name = nil)
      name = node.name.join
      if name =~ /[A-Z]/
        selector_name ||= node.class.name.split('::').last
        add_lint(node, "#{selector_name} `#{name}` in selector should be " <<
                       "written in all lowercase as `#{name.downcase}`")
      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/capitalization_in_selector.rb
scss-lint-0.10.1 lib/scss_lint/linter/capitalization_in_selector.rb
scss-lint-0.10.0 lib/scss_lint/linter/capitalization_in_selector.rb