Sha256: 2fdeaaf1aab9e353bbd99ce935bc940270bf8fa64d1bbcd51cb6500ea42d5d29
Contents?: true
Size: 876 Bytes
Versions: 18
Compression:
Stored size: 876 Bytes
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::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
18 entries across 18 versions & 1 rubygems