Sha256: 93d4d1d4bdbd43ee3b1917bf6e112bc1ceb44776dd555f782c1c5247728c5967

Contents?: true

Size: 861 Bytes

Versions: 16

Compression:

Stored size: 861 Bytes

Contents

module SCSSLint
  # Checks for misspelled properties.
  class Linter::PropertySpelling < Linter
    include LinterRegistry

    def visit_root(node)
      @extra_properties = config['extra_properties'].to_set
      yield # Continue linting children
    end

    def visit_prop(node)
      # Ignore properties with interpolation
      return if node.name.count > 1 || !node.name.first.is_a?(String)

      name = node.name.join

      # Ignore vendor-prefixed properties
      return if name.start_with?('-')

      unless KNOWN_PROPERTIES.include?(name) || @extra_properties.include?(name)
        add_lint(node, "Unknown property #{name}")
      end
    end

  private

    KNOWN_PROPERTIES = File.open(File.join(SCSS_LINT_DATA, 'properties.txt'))
                           .read
                           .split
                           .to_set
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
scss-lint-0.23.1 lib/scss_lint/linter/property_spelling.rb
scss-lint-0.23.0 lib/scss_lint/linter/property_spelling.rb
scss-lint-0.22.0 lib/scss_lint/linter/property_spelling.rb
scss-lint-0.21.0 lib/scss_lint/linter/property_spelling.rb
scss-lint-0.20.3 lib/scss_lint/linter/property_spelling.rb
scss-lint-0.20.2 lib/scss_lint/linter/property_spelling.rb
scss-lint-0.20.1 lib/scss_lint/linter/property_spelling.rb
scss-lint-0.20.0 lib/scss_lint/linter/property_spelling.rb
scss-lint-0.19.0 lib/scss_lint/linter/property_spelling.rb
scss-lint-0.18.0 lib/scss_lint/linter/property_spelling.rb
scss-lint-0.17.3 lib/scss_lint/linter/property_spelling.rb
scss-lint-0.17.2 lib/scss_lint/linter/property_spelling.rb
scss-lint-0.17.1 lib/scss_lint/linter/property_spelling.rb
scss-lint-0.17.0 lib/scss_lint/linter/property_spelling.rb
scss-lint-0.16.1 lib/scss_lint/linter/property_spelling.rb
scss-lint-0.16.0 lib/scss_lint/linter/property_spelling.rb