Class: SCSSLint::Linter::TrailingSemicolon

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

Overview

Checks for a trailing semicolon on statements within rule sets.

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_extend(node) ⇒ Object



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

def visit_extend(node)
  check_semicolon(node)
end

#visit_import(node) ⇒ Object



30
31
32
33
34
# File 'lib/scss_lint/linter/trailing_semicolon.rb', line 30

def visit_import(node)
  # Ignore all but the last import for comma-separated @imports
  return if source_from_range(node.source_range) =~ /,\s*$/
  check_semicolon(node)
end

#visit_mixin(node) ⇒ Object



22
23
24
25
26
27
28
# File 'lib/scss_lint/linter/trailing_semicolon.rb', line 22

def visit_mixin(node)
  if node.children.any?
    yield # Continue checking children
  else
    check_semicolon(node)
  end
end

#visit_prop(node) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/scss_lint/linter/trailing_semicolon.rb', line 14

def visit_prop(node)
  if node.children.any? { |n| n.is_a?(Sass::Tree::PropNode) }
    yield # Continue checking children
  else
    check_semicolon(node)
  end
end

#visit_variable(node) ⇒ Object



10
11
12
# File 'lib/scss_lint/linter/trailing_semicolon.rb', line 10

def visit_variable(node)
  check_semicolon(node)
end