Sha256: 8dc17c02289eec3f584420c66fd3c338c2c4d7e3c5c5cbc10d265040a5cb5e9e

Contents?: true

Size: 960 Bytes

Versions: 142

Compression:

Stored size: 960 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::Beta::Button](https://primer.style/view-components/components/beta/button), please try to use that instead of raw HTML."
      ARGUMENT_MAPPER = ArgumentMappers::Button
      COMPONENT = "Primer::Beta::Button"
    end
  end
end

Version data entries

142 entries across 142 versions & 2 rubygems

Version Path
primer_view_components-0.36.5 lib/primer/view_components/linters/button_component_migration_counter.rb
openproject-primer_view_components-0.52.2 lib/primer/view_components/linters/button_component_migration_counter.rb
primer_view_components-0.36.4 lib/primer/view_components/linters/button_component_migration_counter.rb
openproject-primer_view_components-0.52.1 lib/primer/view_components/linters/button_component_migration_counter.rb
openproject-primer_view_components-0.52.0 lib/primer/view_components/linters/button_component_migration_counter.rb
primer_view_components-0.36.3 lib/primer/view_components/linters/button_component_migration_counter.rb
openproject-primer_view_components-0.51.0 lib/primer/view_components/linters/button_component_migration_counter.rb
primer_view_components-0.36.2 lib/primer/view_components/linters/button_component_migration_counter.rb
openproject-primer_view_components-0.50.1 lib/primer/view_components/linters/button_component_migration_counter.rb
openproject-primer_view_components-0.50.0 lib/primer/view_components/linters/button_component_migration_counter.rb
primer_view_components-0.36.1 lib/primer/view_components/linters/button_component_migration_counter.rb
primer_view_components-0.36.0 lib/primer/view_components/linters/button_component_migration_counter.rb
openproject-primer_view_components-0.49.2 lib/primer/view_components/linters/button_component_migration_counter.rb
primer_view_components-0.35.2 lib/primer/view_components/linters/button_component_migration_counter.rb
openproject-primer_view_components-0.49.1 lib/primer/view_components/linters/button_component_migration_counter.rb
openproject-primer_view_components-0.49.0 lib/primer/view_components/linters/button_component_migration_counter.rb
primer_view_components-0.35.1 lib/primer/view_components/linters/button_component_migration_counter.rb
primer_view_components-0.35.0 lib/primer/view_components/linters/button_component_migration_counter.rb
openproject-primer_view_components-0.48.2 lib/primer/view_components/linters/button_component_migration_counter.rb
openproject-primer_view_components-0.48.1 lib/primer/view_components/linters/button_component_migration_counter.rb