class SCSSLint::Linter::Compass::PropertyWithMixin
Checks for uses of properties where a Compass mixin would be preferred.
Constants
- PROPERTIES_WITH_MIXINS
Set of properties where the Compass mixin version is preferred
Public Instance Methods
visit_prop(node)
click to toggle source
# File lib/scss_lint/linter/compass/property_with_mixin.rb, line 6 def visit_prop(node) check_for_properties_with_mixins(node) check_for_inline_block(node) end
Private Instance Methods
check_for_inline_block(node)
click to toggle source
# File lib/scss_lint/linter/compass/property_with_mixin.rb, line 33 def check_for_inline_block(node) prop_name = node.name.join return unless prop_name == 'display' && node.value.to_sass == 'inline-block' && !ignore_compass_mixin?('inline-block') add_lint node, 'Use the Compass `inline-block` mixin instead of `display: inline-block`' end
check_for_properties_with_mixins(node)
click to toggle source
# File lib/scss_lint/linter/compass/property_with_mixin.rb, line 25 def check_for_properties_with_mixins(node) prop_name = node.name.join return unless PROPERTIES_WITH_MIXINS.include?(prop_name) && !ignore_compass_mixin?(prop_name) add_lint node, "Use the Compass `#{prop_name}` mixin instead of the property" end
ignore_compass_mixin?(prop_name)
click to toggle source
# File lib/scss_lint/linter/compass/property_with_mixin.rb, line 43 def ignore_compass_mixin?(prop_name) config.fetch('ignore', []).include?(prop_name) end