Sha256: b1500884de7f460df528c696efac929a34050b59a47fee88110ab2a83b1c3427
Contents?: true
Size: 1 KB
Versions: 18
Compression:
Stored size: 1 KB
Contents
module SCSSLint # Checks for spaces following the colon that separates a property's name from # its value. class Linter::SpaceAfterPropertyColon < Linter include LinterRegistry EXPECTED_SPACES_AFTER_COLON = 1 def visit_prop(node) spaces = spaces_after_colon(node) if spaces != EXPECTED_SPACES_AFTER_COLON add_lint node, 'Colon after property should be followed by ' << "#{pluralize(EXPECTED_SPACES_AFTER_COLON, 'space')} instead of " << pluralize(spaces, 'space') end end private def spaces_after_colon(node) spaces = 0 offset = 1 # Handle quirk where Sass parser doesn't include colon in source range # when property name is followed by spaces if character_at(node.name_source_range.end_pos, offset) == ':' offset += 1 end while character_at(node.name_source_range.end_pos, offset) == ' ' spaces += 1 offset += 1 end spaces end end end
Version data entries
18 entries across 18 versions & 1 rubygems