Sha256: ac770eb9fff4eb52308df1475319bfee2293a02f3f42f871bb11f80f263979f8
Contents?: true
Size: 1.05 KB
Versions: 2
Compression:
Stored size: 1.05 KB
Contents
# frozen_string_literal: true require "rubocop" # :nocov: module RuboCop module Cop module Primer # This cop ensures that components don't use deprecated component names # # bad # Primer::ComponentNameComponent.new() # # good # Primer::Beta::ComponentName.new() class ComponentNameMigration < BaseCop DEPRECATIONS = { "Primer::BlankslateComponent" => "Primer::Beta::Blankslate", "Primer::BorderBoxComponent" => "Primer::Beta::BorderBox", "Primer::BaseButton" => "Primer::Beta::BaseButton", "Primer::TestComponent" => "Primer::Beta::Test" }.freeze def on_send(node) return unless node.method_name == :new && !node.receiver.nil? && DEPRECATIONS.key?(node.receiver.const_name) add_offense(node.receiver, message: "Don't use deprecated names") end def autocorrect(node) lambda do |corrector| corrector.replace(node, DEPRECATIONS[node.const_name]) end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
primer_view_components-0.0.87 | lib/rubocop/cop/primer/component_name_migration.rb |
primer_view_components-0.0.86 | lib/rubocop/cop/primer/component_name_migration.rb |