Skip to content

Commit

Permalink
feat: adds erb-lint
Browse files Browse the repository at this point in the history
Adds erb-lint to lint views to bundle.
Adds rake task to do both erb and rubocop linting.
Adds a settings file for erb lint
  • Loading branch information
elasticspoon committed Jan 24, 2024
1 parent 5043655 commit 9b66463
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 1 deletion.
12 changes: 12 additions & 0 deletions .erb-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
EnableDefaultLinters: true
linters:
AllowedScriptType:
enabled: true
allowed_types:
- "application/json"
- "text/javascript"
- "text/html"
- "module"
- "esms-options"
disallow_inline_scripts: false
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@ group :development, :test do
gem "rubocop-rails", "~> 2.23.1"
# Default rules for Rubocop.
gem "standard", "~> 1.33"
# Erb linter.
gem "erb_lint"
end

group :development do
Expand Down
18 changes: 17 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,13 @@ GEM
erubi (>= 1.0.0)
rack (>= 0.9.0)
rouge (>= 1.0.0)
better_html (2.0.2)
actionview (>= 6.0)
activesupport (>= 6.0)
ast (~> 2.0)
erubi (~> 1.4)
parser (>= 2.4)
smart_properties
bindex (0.8.1)
binding_of_caller (1.0.0)
debug_inspector (>= 0.0.1)
Expand Down Expand Up @@ -183,6 +190,13 @@ GEM
dry-inflector (~> 1.0)
dry-logic (~> 1.4)
zeitwerk (~> 2.6)
erb_lint (0.5.0)
activesupport
better_html (>= 2.0.1)
parser (>= 2.7.1.4)
rainbow
rubocop
smart_properties
erubi (1.12.0)
et-orbi (1.2.7)
tzinfo
Expand Down Expand Up @@ -403,7 +417,7 @@ GEM
activerecord (>= 6.1)
request_store (~> 1.4)
parallel (1.24.0)
parser (3.3.0.2)
parser (3.3.0.5)
ast (~> 2.4.1)
racc
pdf-core (0.9.0)
Expand Down Expand Up @@ -581,6 +595,7 @@ GEM
rack-protection (= 3.1.0)
tilt (~> 2.0)
slop (3.6.0)
smart_properties (1.17.0)
snaky_hash (2.0.1)
hashie
version_gem (~> 1.1, >= 1.1.1)
Expand Down Expand Up @@ -676,6 +691,7 @@ DEPENDENCIES
discard (~> 1.3)
dotenv-rails
dry-struct
erb_lint
factory_bot_rails
faker
filterrific
Expand Down
4 changes: 4 additions & 0 deletions bin/lint
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

bundle exec rubocop -A
bundle exec erblint --lint-all -a

0 comments on commit 9b66463

Please sign in to comment.