lib/scss_lint/linter/shorthand_linter.rb in scss-lint-0.5.2 vs lib/scss_lint/linter/shorthand_linter.rb in scss-lint-0.6
- old
+ new
@@ -18,13 +18,22 @@
def description
'Property values should use the shortest shorthand syntax allowed'
end
private
+ SHORTHANDABLE_PROPERTIES = %w[border-color
+ border-radius
+ border-style
+ border-width
+ margin
+ padding]
def check_valid_shorthand_value(prop_node)
- if prop_node.value.is_a?(Sass::Script::String) &&
- prop_node.value.to_s.strip =~ /\A(\S+\s+\S+(\s+\S+){0,2})\Z/
+ unless SHORTHANDABLE_PROPERTIES.include? prop_node.name.first.to_s
+ return
+ end
+
+ if prop_node.value.to_s.strip =~ /\A(\S+\s+\S+(\s+\S+){0,2})\Z/
return create_lint(prop_node) unless valid_shorthand?($1)
end
end
def valid_shorthand?(shorthand)