-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make sure
COMPONENT_TO_USE_INSTEAD
keys are aligned with officially…
… deprecated components (#1242) * add check to ensure statuses.json matches * Remove check from linter and test * Add CI check * Add print statement * Update lib/tasks/deprecated.rake Co-authored-by: Cameron Dutro <camertron@gmail.com> * Add static:dump task @camertron suggestion * Fix rubocop Co-authored-by: Cameron Dutro <camertron@gmail.com> Co-authored-by: Jon Rohan <yes@jonrohan.codes>
- Loading branch information
1 parent
918cfe3
commit 3b2bec4
Showing
4 changed files
with
38 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters