class HamlLint::Linter::IdNames

Checks for ‘id` attributes in specific cases on tags.

Constants

STYLES
STYLIZED_NAMES

Public Instance Methods

visit_tag(node) click to toggle source
# File lib/haml_lint/linter/id_names.rb, line 22
def visit_tag(node)
  return unless (id = node.tag_id)

  style = config['style'] || 'lisp_case'
  matcher = STYLES[style]
  record_lint(node, "`id` attribute must be in #{STYLIZED_NAMES[style]}") unless id&.match?(matcher)
end