Sha256: c167d304c28691d916d2816d1a18e15be52fcd1005f7cf53ca500fa7d3ef0f5a

Contents?: true

Size: 929 Bytes

Versions: 24

Compression:

Stored size: 929 Bytes

Contents

module SCSSLint
  # Checks for the use of double colons with pseudo elements.
  class Linter::PseudoElement < Linter
    include LinterRegistry

    # https://msdn.microsoft.com/en-us/library/windows/apps/hh767361.aspx
    # https://developer.mozilla.org/en-US/docs/Web/CSS/Mozilla_Extensions
    # http://tjvantoll.com/2013/04/15/list-of-pseudo-elements-to-style-form-controls/
    PSEUDO_ELEMENTS = File.open(File.join(SCSS_LINT_DATA, 'pseudo-elements.txt'))
                          .read
                          .split
                          .to_set

    def visit_pseudo(pseudo)
      if PSEUDO_ELEMENTS.include?(pseudo.name)
        return if pseudo.syntactic_type == :element
        add_lint(pseudo, 'Begin pseudo elements with double colons: `::`')
      else
        return if pseudo.syntactic_type != :element
        add_lint(pseudo, 'Begin pseudo classes with a single colon: `:`')
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
scss_lint-0.45.0 lib/scss_lint/linter/pseudo_element.rb
scss_lint-0.44.0 lib/scss_lint/linter/pseudo_element.rb
scss_lint-0.43.2 lib/scss_lint/linter/pseudo_element.rb
scss_lint-0.43.1 lib/scss_lint/linter/pseudo_element.rb