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.

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



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/scss_lint/linter/property_spelling.rb', line 11

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

#visit_root(_node) ⇒ Object



6
7
8
9
# File 'lib/scss_lint/linter/property_spelling.rb', line 6

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