Skip to content

Commit 5cab851

Browse files
committed
install erb_lint and lint all ERB/html files
1 parent b4eb2ad commit 5cab851

34 files changed

+131
-115
lines changed

CRUSH.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
- `bundle exec rubocop` - Run linter (uses rubocop-rails-omakase)
1313
- `bundle exec rubocop -a` - Auto-fix safe corrections
1414
- `bundle exec brakeman` - Security analysis
15+
- `bundle exec erb_lint --lint-all` - Run linter on ERB/HTML
16+
- `bundle exec erb_lint --lint-all -a` - Auto-fix safe corrections
17+
1518

1619
**Development**
1720
- `rails server` - Start development server

Gemfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ group :development, :test do
5151
gem "rubocop-rails-omakase", require: false
5252

5353
gem "ruby-lsp"
54+
55+
gem 'erb_lint', require: false
5456
end
5557

5658
group :development do

Gemfile.lock

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,13 @@ GEM
7979
bcrypt (3.1.20)
8080
bcrypt_pbkdf (1.1.1)
8181
benchmark (0.4.1)
82+
better_html (2.1.1)
83+
actionview (>= 6.0)
84+
activesupport (>= 6.0)
85+
ast (~> 2.0)
86+
erubi (~> 1.4)
87+
parser (>= 2.4)
88+
smart_properties
8289
bigdecimal (3.2.2)
8390
bindex (0.8.1)
8491
bootsnap (1.18.6)
@@ -107,6 +114,13 @@ GEM
107114
drb (2.2.3)
108115
ed25519 (1.4.0)
109116
erb (5.0.2)
117+
erb_lint (0.9.0)
118+
activesupport
119+
better_html (>= 2.0.1)
120+
parser (>= 2.7.1.4)
121+
rainbow
122+
rubocop (>= 1)
123+
smart_properties
110124
erubi (1.13.1)
111125
et-orbi (1.3.0)
112126
tzinfo
@@ -373,6 +387,7 @@ GEM
373387
rexml (~> 3.2, >= 3.2.5)
374388
rubyzip (>= 1.2.2, < 4.0)
375389
websocket (~> 1.0)
390+
smart_properties (1.17.0)
376391
solid_cable (3.0.12)
377392
actioncable (>= 7.2)
378393
activejob (>= 7.2)
@@ -465,6 +480,7 @@ DEPENDENCIES
465480
brakeman
466481
capybara
467482
debug
483+
erb_lint
468484
faraday-http-cache (~> 2.5)
469485
feedjira (~> 4.0)
470486
image_processing (~> 1.14)

app/views/blog/_form.html.erb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,22 @@
55
<%= form.label :title, class: "block text-sm font-medium text-gray-700 dark:text-gray-200" %>
66
<%= form.text_field :title, class: "mt-1 block w-full rounded-md border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 text-gray-900 dark:text-white shadow-sm focus:border-indigo-500 focus:ring-indigo-500" %>
77
</div>
8-
8+
99
<div class="space-y-2">
1010
<%= form.label :slug, class: "block text-sm font-medium text-gray-700 dark:text-gray-200" %>
1111
<%= form.text_field :slug, class: "mt-1 block w-full rounded-md border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 text-gray-900 dark:text-white shadow-sm focus:border-indigo-500 focus:ring-indigo-500" %>
1212
</div>
13-
13+
1414
<div class="space-y-2">
1515
<%= form.label :post_tags, class: "block text-sm font-medium text-gray-700 dark:text-gray-200" %>
1616
<%= form.text_field :post_tags, class: "mt-1 block w-full rounded-md border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 text-gray-900 dark:text-white shadow-sm focus:border-indigo-500 focus:ring-indigo-500" %>
1717
</div>
18-
18+
1919
<div class="space-y-2">
2020
<%= form.label :draft, class: "block text-sm font-medium text-gray-700 dark:text-gray-200" %>
2121
<%= form.checkbox :draft, class: "mt-1 block rounded-md border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 text-gray-900 dark:text-white shadow-sm focus:border-indigo-500 focus:ring-indigo-500" %>
2222
</div>
23-
23+
2424
<div class="space-y-2">
2525
<%= form.label :markdown_excerpt, class: "block text-sm font-medium text-gray-700 dark:text-gray-200" %>
2626
<%= form.textarea :markdown_excerpt, rows: 5, data: { controller: "uploading" }, class: "mt-1 block w-full rounded-md border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 text-gray-900 dark:text-white shadow-sm focus:border-indigo-500 focus:ring-indigo-500" %>
@@ -35,4 +35,4 @@
3535
<div>
3636
<%= form.submit class: "rounded-md bg-indigo-600 px-4 py-2 text-sm font-semibold text-white shadow-sm hover:bg-indigo-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600" %>
3737
</div>
38-
<% end %>
38+
<% end %>

app/views/blog/index.html.erb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,29 +4,29 @@
44
<h2 class="text-2xl font-semibold text-gray-800 dark:text-gray-100 mb-2">
55
<%= link_to post.title, dated_post_path(year: post.year, day: post.day, month: post.month, id: post), class: "hover:text-gray-600 dark:hover:text-gray-300" %>
66
</h2>
7-
7+
88
<time class="text-sm text-gray-500 dark:text-gray-400 mb-4 block">
99
<%= post.created_at.strftime('%Y-%m-%d') %>
1010
</time>
11-
11+
1212
<div class="text-gray-900 dark:text-gray-100">
1313
<%= post.rendered_excerpt.html_safe %>
1414
</div>
15-
15+
1616
<div class="flex flex-wrap gap-2 my-4">
1717
<%= render "shared/tags", post: post %>
1818
</div>
19-
19+
2020
<div class="mt-4">
2121
<% if authenticated? %>
22-
<%= link_to "Edit", edit_post_path(post),
22+
<%= link_to "Edit", edit_post_path(post),
2323
class: "text-blue-600 dark:text-blue-400 hover:text-blue-800 dark:hover:text-blue-300 font-medium" %>
2424
|
2525
<% end %>
26-
<%= link_to "Read more →", dated_post_path(year: post.year, day: post.day, month: post.month, id: post),
26+
<%= link_to "Read more →", dated_post_path(year: post.year, day: post.day, month: post.month, id: post),
2727
class: "text-blue-600 dark:text-blue-400 hover:text-blue-800 dark:hover:text-blue-300 font-medium" %>
2828
</div>
2929
</article>
3030
<% end %>
3131
<%= paginate @posts %>
32-
</div>
32+
</div>

app/views/blog/index_by_tag.html.erb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,29 +23,29 @@
2323
<h2 class="text-2xl font-semibold text-gray-800 dark:text-gray-100 mb-2">
2424
<%= link_to post.title, dated_post_path(year: post.year, day: post.day, month: post.month, id: post), class: "hover:text-gray-600 dark:hover:text-gray-300" %>
2525
</h2>
26-
26+
2727
<time class="text-sm text-gray-500 dark:text-gray-400 mb-4 block">
2828
<%= post.created_at.strftime('%Y-%m-%d') %>
2929
</time>
30-
30+
3131
<div class="text-gray-900 dark:text-gray-100">
3232
<%= post.rendered_excerpt.html_safe %>
3333
</div>
34-
34+
3535
<div class="flex flex-wrap gap-2 my-4">
3636
<%= render "shared/tags", post: post %>
3737
</div>
38-
38+
3939
<div class="mt-4">
4040
<% if authenticated? %>
41-
<%= link_to "Edit", edit_post_path(post),
41+
<%= link_to "Edit", edit_post_path(post),
4242
class: "text-blue-600 dark:text-blue-400 hover:text-blue-800 dark:hover:text-blue-300 font-medium" %>
4343
|
4444
<% end %>
45-
<%= link_to "Read more →", dated_post_path(year: post.year, day: post.day, month: post.month, id: post),
45+
<%= link_to "Read more →", dated_post_path(year: post.year, day: post.day, month: post.month, id: post),
4646
class: "text-blue-600 dark:text-blue-400 hover:text-blue-800 dark:hover:text-blue-300 font-medium" %>
4747
</div>
4848
</article>
4949
<% end %>
5050
<%= paginate @posts %>
51-
</div>
51+
</div>

app/views/blog/show.html.erb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@
1414
<h1 class="text-3xl md:text-4xl font-bold text-gray-900 dark:text-white mb-4">
1515
<%= @post.title %>
1616
</h1>
17-
17+
1818
<div class="flex flex-col sm:flex-row sm:items-center text-gray-600 dark:text-gray-300 gap-4">
1919
<time class="text-sm">
2020
<%= @post.created_at.strftime("%Y-%m-%d") %>
2121
</time>
2222
<span class="hidden sm:block">·</span>
2323
<% if authenticated? %>
24-
<%= link_to "Edit", edit_post_path(@post),
24+
<%= link_to "Edit", edit_post_path(@post),
2525
class: "text-blue-600 dark:text-blue-400 hover:text-blue-800 dark:hover:text-blue-300 font-medium" %>
2626
<% end %>
2727
</div>
@@ -34,4 +34,4 @@
3434
<div class="flex flex-wrap gap-2">
3535
<%= render "shared/tags", post: @post %>
3636
</div>
37-
</article>
37+
</article>

app/views/feed_posts/_feed_post.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,4 @@
4747
<% end %>
4848
</div>
4949
</div>
50-
</article>
50+
</article>

app/views/feed_posts/index.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@
99
<%= render @feed_posts %>
1010
</div>
1111
<%= paginate @feed_posts %>
12-
</div>
12+
</div>

app/views/feeds/_feed.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@
1818
<% end %>
1919
</div>
2020
</td>
21-
</tr>
21+
</tr>

0 commit comments

Comments
 (0)