Sha256: 87cc63aeed25e7d5032ae615043565f079407b0e95676492aa83adccec50361d

Contents?: true

Size: 822 Bytes

Versions: 4

Compression:

Stored size: 822 Bytes

Contents

# frozen_string_literal: true

require_relative "helpers"
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 < Linter
      include Helpers
      include Autocorrectable

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

      CLASSES = %w[btn btn-link].freeze
      MESSAGE = "We are migrating buttons to use [Primer::ButtonComponent](https://primer.style/view-components/components/button), please try to use that instead of raw HTML."
      ARGUMENT_MAPPER = ArgumentMappers::Button
      COMPONENT = "Primer::ButtonComponent"
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
primer_view_components-0.0.52 lib/primer/view_components/linters/button_component_migration_counter.rb
primer_view_components-0.0.51 lib/primer/view_components/linters/button_component_migration_counter.rb
primer_view_components-0.0.50 lib/primer/view_components/linters/button_component_migration_counter.rb
primer_view_components-0.0.49 lib/primer/view_components/linters/button_component_migration_counter.rb