Sha256: 20cc12a525261a93ef4df5531198b674dcbd3af0248ebd5e427e726c04b2cb57
Contents?: true
Size: 520 Bytes
Versions: 7
Compression:
Stored size: 520 Bytes
Contents
module SCSSLint # Checks for invalid hexadecimal colors. class Linter::HexValidation < Linter include LinterRegistry def visit_script_string(node) return unless node.type == :identifier node.value.scan(/(#\h+)/) do |match| check_hex(match.first, node) end end private HEX_REGEX = /(#(\h{3}|\h{6}))(?!\h)/ def check_hex(hex, node) return if HEX_REGEX.match(hex) add_lint(node, "Colors must have either three or six digits: `#{hex}`") end end end
Version data entries
7 entries across 7 versions & 1 rubygems