Sha256: 114760fd072c66dec438e72699d4bfb9a8823a4269c30a71a94cd168e27dfe73

Contents?: true

Size: 961 Bytes

Versions: 34

Compression:

Stored size: 961 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 = Primer::ViewComponents::Constants.get(
        component: "Primer::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 [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

34 entries across 34 versions & 1 rubygems

Version Path
primer_view_components-0.0.119 lib/primer/view_components/linters/button_component_migration_counter.rb
primer_view_components-0.0.118 lib/primer/view_components/linters/button_component_migration_counter.rb
primer_view_components-0.0.117 lib/primer/view_components/linters/button_component_migration_counter.rb
primer_view_components-0.0.116 lib/primer/view_components/linters/button_component_migration_counter.rb
primer_view_components-0.0.115 lib/primer/view_components/linters/button_component_migration_counter.rb
primer_view_components-0.0.114 lib/primer/view_components/linters/button_component_migration_counter.rb
primer_view_components-0.0.113 lib/primer/view_components/linters/button_component_migration_counter.rb
primer_view_components-0.0.112 lib/primer/view_components/linters/button_component_migration_counter.rb
primer_view_components-0.0.111 lib/primer/view_components/linters/button_component_migration_counter.rb
primer_view_components-0.0.110 lib/primer/view_components/linters/button_component_migration_counter.rb
primer_view_components-0.0.109 lib/primer/view_components/linters/button_component_migration_counter.rb
primer_view_components-0.0.108 lib/primer/view_components/linters/button_component_migration_counter.rb
primer_view_components-0.0.107 lib/primer/view_components/linters/button_component_migration_counter.rb
primer_view_components-0.0.106 lib/primer/view_components/linters/button_component_migration_counter.rb
primer_view_components-0.0.105 lib/primer/view_components/linters/button_component_migration_counter.rb
primer_view_components-0.0.104 lib/primer/view_components/linters/button_component_migration_counter.rb
primer_view_components-0.0.103 lib/primer/view_components/linters/button_component_migration_counter.rb
primer_view_components-0.0.102 lib/primer/view_components/linters/button_component_migration_counter.rb
primer_view_components-0.0.101 lib/primer/view_components/linters/button_component_migration_counter.rb
primer_view_components-0.0.100 lib/primer/view_components/linters/button_component_migration_counter.rb