Class: SCSSLint::Linter::BorderZero

Inherits:
SCSSLint::Linter
  • Object
show all
Includes:
SCSSLint::LinterRegistry
Defined in:
lib/scss_lint/linter/border_zero.rb

Overview

Enforce a particular value for empty borders.

Constant Summary collapse

CONVENTION_TO_PREFERENCE =
{
  'zero' => %w[0 none],
  'none' => %w[none 0],
}
BORDER_PROPERTIES =
%w[
  border
  border-top
  border-right
  border-bottom
  border-left
]

Constants included from Utils

Utils::COLOR_REGEX

Instance Attribute Summary

Attributes inherited from SCSSLint::Linter

#config, #engine, #lints

Instance Method Summary collapse

Methods included from SCSSLint::LinterRegistry

extract_linters_from, included

Methods inherited from SCSSLint::Linter

#initialize, #name, #run

Methods included from Utils

#color?, #color_hex?, #color_keyword?, #color_keyword_to_code, #extract_string_selectors, #node_ancestor, #node_siblings, #pluralize, #previous_node, #remove_quoted_strings, #same_position?

Methods included from SelectorVisitor

#visit_selector

Constructor Details

This class inherits a constructor from SCSSLint::Linter

Instance Method Details

#visit_prop(node) ⇒ Object



24
25
26
27
# File 'lib/scss_lint/linter/border_zero.rb', line 24

def visit_prop(node)
  return unless BORDER_PROPERTIES.include?(node.name.first.to_s)
  check_border(node, node.value.to_sass.strip)
end

#visit_root(_node) ⇒ Object



19
20
21
22
# File 'lib/scss_lint/linter/border_zero.rb', line 19

def visit_root(_node)
  @preference = CONVENTION_TO_PREFERENCE[config['convention']]
  yield # Continue linting children
end