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

#add_lint, #character_at, #initialize, #location_from_range, #node_on_single_line?, #run, #source_from_range, #visit, #visit_children

Methods included from Utils

#can_be_condensed?, #extract_string_selectors, #pluralize, #previous_node, #remove_quoted_strings, #shortest_hex_form

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?('-')

  unless KNOWN_PROPERTIES.include?(name) || @extra_properties.include?(name)
    add_lint(node, "Unknown property #{name}")
  end
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