Sha256: a7f9989ffb7def3a933c2c6964f6d5b432e9ad35084eef2aed4a019adb3a971f

Contents?: true

Size: 861 Bytes

Versions: 10

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?('-')
      return if KNOWN_PROPERTIES.include?(name) ||
        @extra_properties.include?(name)

      add_lint(node, "Unknown property #{name}")
    end

  private

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

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
scss-lint-0.29.0 lib/scss_lint/linter/property_spelling.rb
scss-lint-0.28.0 lib/scss_lint/linter/property_spelling.rb
scss-lint-0.27.0 lib/scss_lint/linter/property_spelling.rb
scss-lint-0.26.2 lib/scss_lint/linter/property_spelling.rb
scss-lint-0.26.1 lib/scss_lint/linter/property_spelling.rb
scss-lint-0.26.0 lib/scss_lint/linter/property_spelling.rb
scss-lint-0.25.1 lib/scss_lint/linter/property_spelling.rb
scss-lint-0.25.0 lib/scss_lint/linter/property_spelling.rb
scss-lint-0.24.1 lib/scss_lint/linter/property_spelling.rb
scss-lint-0.24.0 lib/scss_lint/linter/property_spelling.rb