lib/scss_lint/linter/trailing_semicolon.rb in scss-lint-0.26.0 vs lib/scss_lint/linter/trailing_semicolon.rb in scss-lint-0.26.1
- old
+ new
@@ -1,33 +1,34 @@
module SCSSLint
# Checks for a trailing semicolon on statements within rule sets.
class Linter::TrailingSemicolon < Linter
include LinterRegistry
- def visit_prop(node)
- if has_nested_properties?(node)
- yield # Continue checking children
- else
- check_semicolon(node)
- end
- end
-
def visit_extend(node)
check_semicolon(node)
end
- def visit_mixin(node)
+ def visit_variable(node)
check_semicolon(node)
end
- def visit_variable(node)
- check_semicolon(node)
+ def visit_possible_parent(node)
+ if has_nested_properties?(node)
+ yield # Continue checking children
+ else
+ check_semicolon(node)
+ end
end
+ alias_method :visit_mixin, :visit_possible_parent
+ alias_method :visit_prop, :visit_possible_parent
+
private
def has_nested_properties?(node)
- node.children.any? { |n| n.is_a?(Sass::Tree::PropNode) }
+ node.children.any? do |n|
+ n.is_a?(Sass::Tree::PropNode) || n.is_a?(Sass::Tree::RuleNode)
+ end
end
def check_semicolon(node)
if has_space_before_semicolon?(node)
line = node.source_range.start_pos.line