Class: SCSSLint::Linter::SpaceAfterPropertyColon

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

Overview

Checks for spaces following the colon that separates a property’s name from its value.

Constant Summary

Constants included from Utils

Utils::COLOR_REGEX

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

#color?, #color_hex?, #color_keyword?, #color_keyword_to_code, #extract_string_selectors, #node_ancestor, #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



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

def visit_prop(node)
  whitespace = whitespace_after_colon(node)

  case config['style']
  when 'no_space'
    check_for_no_spaces(node, whitespace)
  when 'one_space'
    check_for_one_space(node, whitespace)
  when 'at_least_one_space'
    check_for_at_least_one_space(node, whitespace)
  when 'one_space_or_newline'
    check_for_one_space_or_newline(node, whitespace)
  end

  yield # Continue linting children
end

#visit_rule(node) ⇒ Object



7
8
9
10
11
12
13
# File 'lib/scss_lint/linter/space_after_property_colon.rb', line 7

def visit_rule(node)
  if config['style'] == 'aligned'
    check_properties_alignment(node)
  end

  yield # Continue linting children
end