Class: SCSSLint::Linter::SelectorFormat
Overview
Checks that selector names use a specified convention
Constant Summary
Constants included
from Utils
Utils::COLOR_REGEX
Instance Attribute Summary
#config, #engine, #lints
Instance Method Summary
collapse
extract_linters_from, included
#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?
#visit_selector
Instance Method Details
#visit_attribute(attribute) ⇒ Object
12
13
14
|
# File 'lib/scss_lint/linter/selector_format.rb', line 12
def visit_attribute(attribute)
check(attribute, 'attribute') unless @ignored_types.include?('attribute')
end
|
#visit_class(klass) ⇒ Object
16
17
18
|
# File 'lib/scss_lint/linter/selector_format.rb', line 16
def visit_class(klass)
check(klass, 'class') unless @ignored_types.include?('class')
end
|
#visit_element(element) ⇒ Object
20
21
22
|
# File 'lib/scss_lint/linter/selector_format.rb', line 20
def visit_element(element)
check(element, 'element') unless @ignored_types.include?('element')
end
|
#visit_id(id) ⇒ Object
24
25
26
|
# File 'lib/scss_lint/linter/selector_format.rb', line 24
def visit_id(id)
check(id, 'id') unless @ignored_types.include?('id')
end
|
#visit_placeholder(placeholder) ⇒ Object
28
29
30
|
# File 'lib/scss_lint/linter/selector_format.rb', line 28
def visit_placeholder(placeholder)
check(placeholder, 'placeholder') unless @ignored_types.include?('placeholder')
end
|
#visit_root(_node) ⇒ Object
6
7
8
9
10
|
# File 'lib/scss_lint/linter/selector_format.rb', line 6
def visit_root(_node)
@ignored_names = Array(config['ignored_names']).to_set
@ignored_types = Array(config['ignored_types']).to_set
yield
end
|