Sha256: f01c7d831211fac0a930d322f58ca16614d754a8e203f715de9c439a04c8e659

Contents?: true

Size: 958 Bytes

Versions: 2

Compression:

Stored size: 958 Bytes

Contents

# frozen_string_literal: true

require_relative "base_linter"
require_relative "autocorrectable"
require_relative "argument_mappers/button"

module ERBLint
  module Linters
    # Counts the number of times a HTML button is used instead of the component.
    class ButtonComponentMigrationCounter < BaseLinter
      include Autocorrectable

      TAGS = Yattho::ViewComponents::Constants.get(
        component: "Yattho::Beta::BaseButton",
        constant: "TAG_OPTIONS"
      ).freeze

      # CloseButton component has preference when this class is seen in conjunction with `btn`.
      DISALLOWED_CLASSES = %w[close-button].freeze
      CLASSES = %w[btn btn-link].freeze
      MESSAGE = "We are migrating buttons to use [Yattho::Beta::Button](https://yattho.com/view-components/components/beta/button), please try to use that instead of raw HTML."
      ARGUMENT_MAPPER = ArgumentMappers::Button
      COMPONENT = "Yattho::Beta::Button"
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
yattho_view_components-0.1.1 lib/yattho/view_components/linters/button_component_migration_counter.rb
yattho_view_components-0.0.1 lib/yattho/view_components/linters/button_component_migration_counter.rb