Class: SCSSLint::Linter::PropertySpelling

Inherits:
SCSSLint::Linter
  • Object
show all
Includes:
SCSSLint::LinterRegistry
Defined in:
lib/scss_lint/linter/property_spelling.rb

Overview

Checks for misspelled properties.

Constant Summary collapse

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

Instance Attribute Summary

Attributes inherited from SCSSLint::Linter

#config, #engine, #lints

Instance Method Summary collapse

Methods included from SCSSLint::LinterRegistry

extract_linters_from, included

Methods inherited from SCSSLint::Linter

#initialize, #name, #run

Methods included from Utils

#extract_string_selectors, #node_siblings, #pluralize, #previous_node, #remove_quoted_strings, #same_position?

Methods included from SelectorVisitor

#visit_selector

Constructor Details

This class inherits a constructor from SCSSLint::Linter

Instance Method Details

#visit_prop(node) ⇒ Object


16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/scss_lint/linter/property_spelling.rb', line 16

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

  nested_properties = node.children.select { |child| child.is_a?(Sass::Tree::PropNode) }
  if nested_properties.any?
    # Treat nested properties specially, as they are a concatenation of the
    # parent with child property
    nested_properties.each do |nested_prop|
      check_property(nested_prop, node.name.join)
    end
  else
    check_property(node)
  end
end

#visit_root(_node) ⇒ Object


11
12
13
14
# File 'lib/scss_lint/linter/property_spelling.rb', line 11

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