Sha256: e06b1146917d57b71c01db3783ae771d01d6fc896e381c60076869a41f5c2e7f
Contents?: true
Size: 526 Bytes
Versions: 21
Compression:
Stored size: 526 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{8}))(?!\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
21 entries across 21 versions & 3 rubygems