Sha256: fe7ec18da47524243661ec47baa3864a69952f7a9fd3038eb85d4012607f90cb

Contents?: true

Size: 1.34 KB

Versions: 8

Compression:

Stored size: 1.34 KB

Contents

# frozen_string_literal: true

namespace :deprecated do
  task :check do
    require_relative "./../primer/view_components/linters/helpers/deprecated_components_helpers"
    require_relative "../primer/view_components/statuses"

    puts "Checking that officially deprecated components are linted by `DeprecatedComponents` linter...."

    if Primer::ViewComponents::STATUSES.select { |_, value| value == "deprecated" }.keys.sort != ERBLint::Linters::Helpers::DeprecatedComponentsHelpers::COMPONENT_TO_USE_INSTEAD.keys.sort
      puts "\n**************************************************************************************************************************"
      raise "Please make sure that components are officially deprecated by setting the `status :deprecated` within the component file.\n"\
      "Run `bundle exec rake static:dump` so the deprecated status is reflected in `statuses.json`.\n"\
      "Make sure to provide an alternative component for each deprecated component in `ERBLint::Linters::Helpers::DeprecatedComponentsHelpers::COMPONENT_TO_USE_INSTEAD`.\n"\
      "If there is no alternative to suggest, set the value to nil."
    end

    puts "\n============================================================================="
    puts "All good!"
    puts "============================================================================="
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
primer_view_components-0.0.93 lib/tasks/deprecated.rake
primer_view_components-0.0.92 lib/tasks/deprecated.rake
primer_view_components-0.0.91 lib/tasks/deprecated.rake
primer_view_components-0.0.90 lib/tasks/deprecated.rake
primer_view_components-0.0.89 lib/tasks/deprecated.rake
primer_view_components-0.0.88 lib/tasks/deprecated.rake
primer_view_components-0.0.87 lib/tasks/deprecated.rake
primer_view_components-0.0.86 lib/tasks/deprecated.rake