Sha256: 6c28dc7d9a04b920789736b0b096b4093ec37af5db089df01e2c144da85b6fe2
Contents?: true
Size: 936 Bytes
Versions: 1
Compression:
Stored size: 936 Bytes
Contents
module SCSSLint # Enforce a particular value for empty borders. class Linter::BorderZero < Linter include LinterRegistry CONVENTION_TO_PREFERENCE = { 'zero' => %w[0 none], 'none' => %w[none 0], }.freeze BORDER_PROPERTIES = %w[ border border-top border-right border-bottom border-left ].freeze def visit_root(_node) @preference = CONVENTION_TO_PREFERENCE[config['convention']] yield # Continue linting children end def visit_prop(node) return unless BORDER_PROPERTIES.include?(node.name.first.to_s) check_border(node, node.value.to_sass.strip) end private def check_border(node, border) return unless %w[0 none].include?(border) return if @preference[0] == border add_lint(node, "`border: #{@preference[0]}` is preferred over " \ "`border: #{@preference[1]}`") end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
scss_lint-0.44.0 | lib/scss_lint/linter/border_zero.rb |