Skip to content

Commit

Permalink
Upgrade to the latest versions of rubocop-rails-accessibility and erb…
Browse files Browse the repository at this point in the history
…lint-github (#3100)

Co-authored-by: camertron <camertron@users.noreply.github.com>
  • Loading branch information
camertron and camertron committed Sep 19, 2024
1 parent 21034a6 commit 53a11d2
Show file tree
Hide file tree
Showing 37 changed files with 80 additions and 79 deletions.
4 changes: 2 additions & 2 deletions .erb-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ linters:
Enabled: false
Exclude:
- app/components/primer/layout_component.html.erb
Primer/Migrations/IconButtonComponent:
Migrations/IconButtonComponent:
Enabled: true
Primer/Migrations/TruncateComponent:
Migrations/TruncateComponent:
Enabled: true
10 changes: 2 additions & 8 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,11 @@ jobs:
demo/**/*.rb
test/**/*.rb
- uses: ruby/setup-ruby@v1
if: steps.changed-files.outputs.any_changed == 'true'
with:
ruby-version: '3.3'
bundler-cache: true
- name: Lint with Rubocop
if: steps.changed-files.outputs.any_changed == 'true'
run: |
bundle exec rubocop ${{ steps.changed-files.outputs.all_changed_files }} --format github
run: script/rubocop --format github

erblint:
runs-on: ubuntu-latest
Expand All @@ -67,14 +64,11 @@ jobs:
files: |
app/components/**/*.erb
- uses: ruby/setup-ruby@v1
if: steps.changed-files.outputs.any_changed == 'true'
with:
ruby-version: '3.3'
bundler-cache: true
- name: Lint with ERB Lint
if: steps.changed-files.outputs.any_changed == 'true'
run: |
bundle exec erblint ${{ steps.changed-files.outputs.all_changed_files }} --format github
run: script/erblint --format github

eslint:
runs-on: ubuntu-latest
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ group :development do
gem "capybara", "~> 3.40.0"
gem "cuprite", "~> 0.15"
gem "debug"
gem "erb_lint", "~> 0.5.0"
gem "erblint-github", "~> 0.5.1"
gem "erb_lint", "~> 0.6"
gem "erblint-github", "~> 1.0"
gem "listen", "~> 3.9"
gem "matrix", "~> 0.4.2"
gem "mocha"
Expand All @@ -63,7 +63,7 @@ group :development do
gem "rubocop-github", "~> 0.20.0"
gem "rubocop-performance"
gem "rubocop-rails"
gem "rubocop-rails-accessibility", "~> 0.2.0"
gem "rubocop-rails-accessibility", "~> 1.0"
gem "selenium-webdriver", "~> 4.18"
gem "simplecov", "~> 0.22.0"
gem "simplecov-console", "~> 0.9.1"
Expand Down
35 changes: 16 additions & 19 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,14 @@ GEM
docile (1.4.0)
drb (2.2.1)
dry-cli (1.1.0)
erb_lint (0.5.0)
erb_lint (0.6.0)
activesupport
better_html (>= 2.0.1)
parser (>= 2.7.1.4)
rainbow
rubocop
rubocop (>= 1)
smart_properties
erblint-github (0.5.1)
erblint-github (1.0.1)
erubi (1.13.0)
ferrum (0.14)
addressable (~> 2.5)
Expand All @@ -103,7 +103,7 @@ GEM
hashdiff (1.1.0)
htmlbeautifier (1.4.3)
htmlentities (4.3.4)
i18n (1.14.5)
i18n (1.14.6)
concurrent-ruby (~> 1.0)
io-console (0.7.2)
irb (1.14.0)
Expand Down Expand Up @@ -148,8 +148,8 @@ GEM
nokogiri (1.16.7-x86_64-linux)
racc (~> 1.4)
octicons (19.9.0)
parallel (1.24.0)
parser (3.3.2.0)
parallel (1.26.3)
parser (3.3.5.0)
ast (~> 2.4.1)
racc
pry (0.14.2)
Expand Down Expand Up @@ -199,21 +199,19 @@ GEM
regexp_parser (2.9.2)
reline (0.5.10)
io-console (~> 0.5)
rexml (3.2.8)
strscan (>= 3.0.9)
rexml (3.3.7)
rouge (4.2.1)
rubocop (1.64.1)
rubocop (1.66.1)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.31.1, < 2.0)
regexp_parser (>= 2.4, < 3.0)
rubocop-ast (>= 1.32.2, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.31.3)
rubocop-ast (1.32.3)
parser (>= 3.3.1.0)
rubocop-github (0.20.0)
rubocop (>= 1.37)
Expand All @@ -227,7 +225,7 @@ GEM
rack (>= 1.1)
rubocop (>= 1.33.0, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
rubocop-rails-accessibility (0.2.0)
rubocop-rails-accessibility (1.0.1)
rubocop (>= 1.0.0)
ruby-progressbar (1.13.0)
ruby2_keywords (0.0.5)
Expand Down Expand Up @@ -257,14 +255,13 @@ GEM
activesupport (>= 5.2)
sprockets (>= 3.0.0)
stringio (3.1.1)
strscan (3.1.0)
terminal-table (3.0.2)
unicode-display_width (>= 1.1.1, < 3)
thor (1.3.2)
timecop (0.9.9)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unicode-display_width (2.5.0)
unicode-display_width (2.6.0)
view_component (3.12.1)
activesupport (>= 5.2.0, < 8.0)
concurrent-ruby (~> 1.0)
Expand Down Expand Up @@ -305,8 +302,8 @@ DEPENDENCIES
cssbundling-rails (~> 1.4)
cuprite (~> 0.15)
debug
erb_lint (~> 0.5.0)
erblint-github (~> 0.5.1)
erb_lint (~> 0.6)
erblint-github (~> 1.0)
kramdown (~> 2.4)
listen (~> 3.9)
lookbook (~> 2.3.1)
Expand All @@ -322,7 +319,7 @@ DEPENDENCIES
rubocop-github (~> 0.20.0)
rubocop-performance
rubocop-rails
rubocop-rails-accessibility (~> 0.2.0)
rubocop-rails-accessibility (~> 1.0)
selenium-webdriver (~> 4.18)
simplecov (~> 0.22.0)
simplecov-console (~> 0.9.1)
Expand Down
1 change: 0 additions & 1 deletion lib/primer/forms/select.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@
<%= builder.select(@input.name, options, @input.select_arguments, **@input.input_arguments) %>
<% end %>
<% end %>

2 changes: 1 addition & 1 deletion previews/primer/alpha/action_bar_preview/inline.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<%= render(Primer::BaseComponent.new(tag: :div, flex_items: :center, display: :flex)) do %>
<%= render(Primer::Beta::Heading.new(tag: :h1, font_size: 3, mr: 2)) { "Title" }%>
<%= render(Primer::Beta::Heading.new(tag: :h1, font_size: 3, mr: 2)) { "Title" } %>
<%= render(Primer::Alpha::ActionBar.new) do |component| %>
<% component.with_item_icon_button(icon: :search, label: "Search") %>
<% component.with_item_icon_button(icon: :pencil, label: "Edit") %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<% d.with_show_button { "Show Dialog" } %>
<% d.with_body do %>
<form>
<input type="text" placeholder="This element is focused on open" autofocus>
<input type="text" placeholder="This element is focused on open" autofocus autocomplete="off">
</form>
<% end %>
<% end %>
4 changes: 3 additions & 1 deletion previews/primer/alpha/dialog_preview/custom_header.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<%= render(Primer::Alpha::Dialog.new(id: "my-dialog", title: title, subtitle: subtitle, visually_hide_title: false)) do |d| %>
<% d.with_header(show_divider: show_divider) do %>
<button class="btn">Custom Header Controls</button>
<%= render(Primer::Beta::Button.new) do %>
Custom Header Controls
<% end %>
<% end %>
<% d.with_show_button { button_text } %>
<% d.with_body { "Hello World" } %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
<% d.with_show_button { button_text } %>
<% d.with_body { body_text } %>
<% d.with_footer(show_divider: true) do %>
<%= render(Primer::ButtonComponent.new(data: { "close-dialog-id": "dialog-one" })) { "Cancel" } %>
<%= render(Primer::Beta::Button.new(data: { "close-dialog-id": "dialog-one" })) { "Cancel" } %>
<% end %>
<% end %>
<% end %>
<% end %>

<script type="module">
document.getElementById('overlay-show-first-overlay')?.addEventListener('click', e => {
<script>
document.getElementById('overlay-show-first-overlay')?.addEventListener('click', e => {
setTimeout(() => {
document.getElementById('first-overlay').querySelector('button')?.click()
document.getElementById('first-overlay').querySelector('button')?.click()
});
});
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<% end %>

<div style="margin-top:2rem">
<%= render(Primer::Beta::Flash.new(scheme: :warning)) do %>
<%= render(Primer::Alpha::Banner.new(scheme: :warning)) do %>
<p>Please be careful nesting dialogs! Note that in this example, opening the second dialog does not close the first.</p>
<p>Closing a dialog while opening a dialog inside, will cause both to be invisible which will lead to undesired effects!</p>
<% end %>
Expand Down
4 changes: 2 additions & 2 deletions previews/primer/alpha/dialog_preview/with_footer.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<% d.with_show_button { button_text } %>
<% d.with_body { "Content" } %>
<% d.with_footer(show_divider: show_divider) do %>
<%= render(Primer::ButtonComponent.new(data: { "close-dialog-id": "my-dialog" })) { "Cancel" } %>
<%= render(Primer::ButtonComponent.new(scheme: :primary)) { "Submit" } %>
<%= render(Primer::Beta::Button.new(data: { "close-dialog-id": "my-dialog" })) { "Cancel" } %>
<%= render(Primer::Beta::Button.new(scheme: :primary)) { "Submit" } %>
<% end %>
<% end %>
4 changes: 2 additions & 2 deletions previews/primer/alpha/dialog_preview/with_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
This is a custom dialog with the body and footer wrapped in a form tag.
<% end %>
<%= render(Primer::Alpha::Dialog::Footer.new(show_divider: show_divider)) do %>
<%= render(Primer::ButtonComponent.new(data: { "close-dialog-id": "my-dialog" })) { "Cancel" } %>
<%= render(Primer::ButtonComponent.new(scheme: :primary)) { "Submit" } %>
<%= render(Primer::Beta::Button.new(data: { "close-dialog-id": "my-dialog" })) { "Cancel" } %>
<%= render(Primer::Beta::Button.new(scheme: :primary)) { "Submit" } %>
<% end %>
</form>
<% end %>
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<form>
<label for="dialog-text-input-example">Example input</label>
<input id="dialog-text-input-example" type="text" value="Some text goes in here">
<input id="dialog-text-input-example" type="text" value="Some text goes in here" autocomplete="off">
</form>
<% end %>
<% end %>
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@
<% d.with_body { "This is a long body for the overlay dialog. <br>".html_safe * 20 } %>
<% end %>
</div>
<div style="height:3000px;"></div>
<div style="height:3000px;"></div>
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
<% d.with_show_button { "Show Overlay" } %>
<% d.with_footer { "Large Dialog Footer" } %>
<% d.with_body { "This is a long body for the overlay dialog. <br>".html_safe * 20 } %>
<% end %>
<% end %>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<script type="application/javascript">
<script>
function ready(fn) {
if (document.readyState !== 'loading') {
fn()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<%= render(Primer::BaseComponent.new(tag: :div, flex_items: :center, display: :flex)) do %>
<%= render(Primer::BaseComponent.new(tag: :div, flex_items: :center, display: :flex)) do %>
<%= form_with(url: action_menu_form_action_path(format: route_format)) do |f| %>
<%= render(Primer::Alpha::ActionMenu.new(select_variant: :single, form_arguments: { builder: f, name: "foo" })) do |menu| %>
<% menu.with_show_button(classes: "rounded-right-0 border-right-0") { |button| button.with_trailing_action_icon(icon: :"triangle-down"); "Filter" } %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
Open Overlay
<% b.with_tooltip(text: "Opens an overlay") %>
<% end %>
<% d.with_header do %>
<% d.with_header do %>
An overlay
<% end %>
<% d.with_body do %>
<% d.with_body do %>
<%= render(Primer::Beta::Button.new(id: "overlay-button")) do |b| %>
<% b.with_tooltip(text: "This is a tooltip in an Overlay") %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<% end %>
<label>
An input
<input type="text" id="input">
<input type="text" id="input" autocomplete="off">
</label>
<script>
document.querySelector('#my-dialog').addEventListener('close', function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
<% component.with_tab(href: "#", selected: i.zero?) { "Item #{i + 1}" } %>
<% end %>
<% component.with_actions do %>
<%= render(Primer::ButtonComponent.new) { "Button" } %>
<%= render(Primer::Beta::Button.new) { "Button" } %>
<% end %>
<% end %>
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
<% component.with_tab(href: "#", selected: i.zero?) { "Item #{i + 1}" } %>
<% end %>
<% component.with_actions do %>
<%= render(Primer::ButtonComponent.new) { "Button" } %>
<%= render(Primer::Beta::Button.new) { "Button" } %>
<% end %>
<% end %>
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
<div class="d-flex flex-items-start flex-column flex-sm-row flex-sm-items-end" style="gap: .5rem">
<%= render(
Primer::Beta::AutoComplete.new(
label_text: label_text,
input_id: input_id,
list_id: list_id,
src: autocomplete_index_path,
show_clear_button: show_clear_button,
visually_hide_label: visually_hide_label,
placeholder: placeholder,
size: size,
full_width: full_width,
disabled: disabled,
invalid: invalid,
input_name: input_name
)) do |component| %>
<% component.with_leading_visual_icon(icon: :search) %>
<% end %>
<%= render(Primer::ButtonComponent.new(scheme: :primary)) { "Submit" } %>
<%= render(
Primer::Beta::AutoComplete.new(
label_text: label_text,
input_id: input_id,
list_id: list_id,
src: autocomplete_index_path,
show_clear_button: show_clear_button,
visually_hide_label: visually_hide_label,
placeholder: placeholder,
size: size,
full_width: full_width,
disabled: disabled,
invalid: invalid,
input_name: input_name
)) do |component| %>
<% component.with_leading_visual_icon(icon: :search) %>
<% end %>
<%= render(Primer::Beta::Button.new(scheme: :primary)) { "Submit" } %>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
<%= render(Primer::Beta::Breadcrumbs.new) do |breadcrumbs| %>
<% texts.each_with_index do |text, i| %>
<% breadcrumbs.with_item(href: "##{i}") do %>
<%= render(Primer::Truncate.new(inline: true, max_width: 135)) { text } %>
<%=
render(Primer::Truncate.new(inline: true, max_width: 135)) { text } # rubocop:disable Migrations/TruncateComponent
%>
<% end %>
<% end %>
<% end %>
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,3 @@
<% end %>
<p>A wrapping `details` tag is required when using the button with the `:summary` tag</p>
</details>

1 change: 0 additions & 1 deletion previews/primer/beta/subhead_preview/actions.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,3 @@
<% end %>
<% end %>
<% end %>

3 changes: 2 additions & 1 deletion script/erblint
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
bundle exec erblint \
app/**/*.html.erb \
lib/**/*.html.erb \
demo/app/**/*.html.erb \
previews/**/*.html.erb \
test/**/*.html.erb \
demo/app/**/*.html.erb \
${@}
Loading

0 comments on commit 53a11d2

Please sign in to comment.