Class: SCSSLint::Linter::TrailingSemicolonAfterPropertyValue
- Inherits:
-
SCSSLint::Linter
- Object
- Sass::Tree::Visitors::Base
- SCSSLint::Linter
- SCSSLint::Linter::TrailingSemicolonAfterPropertyValue
- Includes:
- SCSSLint::LinterRegistry
- Defined in:
- lib/scss_lint/linter/trailing_semicolon_after_property_value.rb
Overview
Checks properties for a trailing semicolon (unless that property is a namespace which has nested properties).
Instance Attribute Summary
Attributes inherited from SCSSLint::Linter
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
Constructor Details
This class inherits a constructor from SCSSLint::Linter
Instance Method Details
#visit_prop(node) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/scss_lint/linter/trailing_semicolon_after_property_value.rb', line 7 def visit_prop(node) has_nested_props = has_nested_properties?(node) unless has_nested_props if has_space_before_semicolon?(node) line = node.source_range.end_pos add_lint line, 'Property declaration should be terminated by a semicolon' elsif !ends_with_semicolon?(node) # Adjust line since lack of semicolon results in end of source range # being on the next line line = node.source_range.end_pos.line - 1 add_lint line, 'Property declaration should not have a space before ' \ 'the terminating semicolon' end end yield if has_nested_props end |