Add ERB lint checks using erb-formatter

This commit is contained in:
Elia Schito 2023-10-25 12:24:49 +02:00
parent 83510581ea
commit bb8dde3b3e
No known key found for this signature in database
GPG Key ID: 9A79FC0070180BEE
6 changed files with 19 additions and 8 deletions

View File

@ -234,9 +234,17 @@ jobs:
- checkout
- run: 'bundle install'
- run:
name: Check with rubocop
name: Check Ruby
command: |
bundle exec rubocop --parallel --format junit --out "$PWD/test-results/rubocop-results.xml" --format progress
- run:
name: Check ERB
command: |
# enable recursive globbing with "**"
shopt -s globstar
# we're only interested in errors
bundle exec erb-format **/*.html.erb > /dev/null
- run:
name: Check JavaScript
command: |

6
.format-erb-ignore Normal file
View File

@ -0,0 +1,6 @@
sandbox/**
tmp/**
**/generators/**
# this file is using tail `if` checks which are not supported by erb-formatter
backend/app/views/spree/admin/shared/_product_tabs.html.erb

View File

@ -54,6 +54,7 @@ group :admin do
end
group :utils do
gem 'erb-formatter', require: false
gem 'pry'
gem 'launchy', require: false
gem 'rubocop', '~> 1', require: false

View File

@ -103,7 +103,7 @@
content_tag(:span, "0", "data-#{stimulus_id}-target": "selectedRowsCount"),
" #{t('.rows_selected')}.",
])), colspan: @columns.count - 1) %>
</div>
</tr>
</thead>
<% end %>

View File

@ -13,11 +13,7 @@
"spree/admin/shared/modal",
target: "modal-image-#{image.id}",
title: image.alt,
content: %{
<div class='align-center'>
#{image_tag(image.url(:large))}
</div>
}.html_safe
content: tag.div(image_tag(image.url(:large)), class: 'align-center')
) %>
</td>

View File

@ -19,7 +19,7 @@
</tr>
<% end %>
</table>
<p>
<p></p>
</td>
<td class="expander"></td>
</tr>