Sha256: 4c8fd49b9812e33c628928b2e91386090665d1ec0017f37a8e41f731266851a6
Contents?: true
Size: 550 Bytes
Versions: 3
Compression:
Stored size: 550 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(/(?:\W|^)(#\h+)(?:\W|$)/) do |match| check_hex(match.first, node) end end private HEX_REGEX = /(#(\h{3}|\h{6}|\h{8}))(?!\h)/.freeze 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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
scss_lint-0.60.0 | lib/scss_lint/linter/hex_validation.rb |
scss_lint-0.59.0 | lib/scss_lint/linter/hex_validation.rb |
scss_lint-0.58.0 | lib/scss_lint/linter/hex_validation.rb |