class ERBLint::Linters::FlashMigrationCounter

Counts the number of times a HTML flash is used instead of the component.

def map_arguments(tag, tag_tree)

def map_arguments(tag, tag_tree)
  # We can only autocorrect elements with simple text as content.
  return nil if tag_tree[:children].size != 1
  # Hash children indicates that there are tags in the content.
  return nil if tag_tree[:children].first.is_a?(Hash)
  content = tag_tree[:children].first
  # Don't accept content with ERB blocks
  return nil if content.type != :text || content.children&.any? { |n| n.try(:type) == :erb }
  ARGUMENT_MAPPER.new(tag).to_s
rescue ArgumentMappers::ConversionError
  nil
end