lib/scss_lint/linter/zero_unit.rb in scss-lint-0.22.0 vs lib/scss_lint/linter/zero_unit.rb in scss-lint-0.23.0
- old
+ new
@@ -19,10 +19,15 @@
end
end
private
- ZERO_UNIT_REGEX = /\b(0[a-z]+)\b/i
+ ZERO_UNIT_REGEX = %r{
+ \b
+ (?<!\.|\#) # Ignore zeroes following `#` or `.` (colors / decimals)
+ (0[a-z]+) # Zero followed by letters (indicating some sort of unit)
+ \b
+ }ix
MESSAGE_FORMAT = '`%s` should be written without units as `0`'
def zero_with_units?(string)
string =~ /^0[a-z]+/