diff --git a/.better-html.yml b/.better-html.yml
new file mode 100644
index 0000000..e4533d3
--- /dev/null
+++ b/.better-html.yml
@@ -0,0 +1,3 @@
+---
+allow_single_quoted_attributes: false
+allow_unquoted_attributes: false
diff --git a/.erb-lint.yml b/.erb-lint.yml
new file mode 100644
index 0000000..9fe3eb1
--- /dev/null
+++ b/.erb-lint.yml
@@ -0,0 +1,46 @@
+---
+glob: "**/app/**/*.{html,turbo_stream,js}{+*,}.erb"
+exclude:
+ - '*vendor/*'
+ - '*app/views/svg/*'
+linters:
+ AllowedScriptType:
+ enabled: true
+ ClosingErbTagIndent:
+ enabled: true
+ DeprecatedClasses:
+ enabled: true
+ ErbSafety:
+ enabled: true
+ better_html_config: .better-html.yml
+ ExtraNewline:
+ enabled: true
+ FinalNewline:
+ enabled: true
+ HardCodedString:
+ enabled: false
+ NoJavascriptTagHelper:
+ enabled: true
+ ParserErrors:
+ enabled: true
+ RightTrim:
+ enabled: false
+ RequireInputAutocomplete:
+ enabled: false
+ RubocopText:
+ enabled: true
+ Rubocop:
+ enabled: true
+ rubocop_config:
+ inherit_from:
+ - .rubocop.yml
+ SelfClosingTag:
+ enabled: false
+ SpaceAroundErbTag:
+ enabled: true
+ SpaceInHtmlTag:
+ enabled: true
+ SpaceIndentation:
+ enabled: true
+ TrailingWhitespace:
+ enabled: true
diff --git a/.overcommit.yml b/.overcommit.yml
new file mode 100644
index 0000000..310421d
--- /dev/null
+++ b/.overcommit.yml
@@ -0,0 +1,41 @@
+# Use this file to configure the Overcommit hooks you wish to use. This will
+# extend the default configuration defined in:
+# https://github.com/sds/overcommit/blob/master/config/default.yml
+#
+# At the topmost level of this YAML file is a key representing type of hook
+# being run (e.g. pre-commit, commit-msg, etc.). Within each type you can
+# customize each hook, such as whether to only run it on certain files (via
+# `include`), whether to only display output if it fails (via `quiet`), etc.
+#
+# For a complete list of hooks, see:
+# https://github.com/sds/overcommit/tree/master/lib/overcommit/hook
+#
+# For a complete list of options that you can use to customize hooks, see:
+# https://github.com/sds/overcommit#configuration
+#
+# Uncomment the following lines to make the configuration take effect.
+
+verify_signatures: false
+
+PreCommit:
+ Rubocop:
+ enabled: true
+ required: true
+ command: ['bundle', 'exec', 'rubocop', '-A']
+ ErbLint:
+ enabled: true
+ required: true
+ command: ['bundle', 'exec', 'erblint', '--lint-all', '-a']
+
+# PrePush:
+# RSpec:
+# enabled: true
+# required: true
+# command: ['bundle', 'exec', 'rspec']
+#
+# PostCheckout:
+# ALL: # Special hook name that customizes all hooks of this type
+# quiet: true # Change all post-checkout hooks to only display output on failure
+#
+# IndexTags:
+# enabled: true # Generate a tags file with `ctags` each time HEAD changes
diff --git a/.rubocop.yml b/.rubocop.yml
index f9d86d4..b1b2aca 100644
--- a/.rubocop.yml
+++ b/.rubocop.yml
@@ -6,3 +6,28 @@ inherit_gem: { rubocop-rails-omakase: rubocop.yml }
# # Use `[a, [b, c]]` not `[ a, [ b, c ] ]`
# Layout/SpaceInsideArrayLiteralBrackets:
# Enabled: false
+#
+# Temp solution for now, need to look into it
+# The gist is that by default, this
+#
+# <%= yield %>
+#
+# caused
+#
+# Layout/TrailingEmptyLines: Final newline missing.
+# In file: app/views/layouts/application.html.erb
+#
+# The autofix resulted in
+# <%= yield
+# %>
+#
+# which is not desirable.
+#
+# Not sure if this happens due to some exotic combo of
+# erb_lint + rubocop + better_html or what, but
+# I don't feel like researching right now
+#
+Layout/TrailingEmptyLines:
+ Enabled: true
+ Exclude:
+ - "**/app/**/*.{html,turbo_stream,js}{+*,}.erb"
diff --git a/Gemfile b/Gemfile
index 6a848d9..a9e275b 100644
--- a/Gemfile
+++ b/Gemfile
@@ -13,6 +13,9 @@ gem "puma", ">= 5.0"
gem "redis", ">= 4.0.1"
group :development do
+ gem "better_html", require: false
+ gem "erb_lint", require: false
+ gem "overcommit", require: false
gem "web-console"
end
diff --git a/Gemfile.lock b/Gemfile.lock
index 1f6b69b..b321c7b 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -73,6 +73,13 @@ GEM
public_suffix (>= 2.0.2, < 7.0)
ast (2.4.2)
base64 (0.2.0)
+ better_html (2.1.1)
+ actionview (>= 6.0)
+ activesupport (>= 6.0)
+ ast (~> 2.0)
+ erubi (~> 1.4)
+ parser (>= 2.4)
+ smart_properties
bigdecimal (3.1.8)
bindex (0.8.1)
bootsnap (1.18.3)
@@ -89,6 +96,7 @@ GEM
rack-test (>= 0.6.3)
regexp_parser (>= 1.5, < 3.0)
xpath (~> 3.2)
+ childprocess (5.0.0)
concurrent-ruby (1.3.3)
connection_pool (2.4.1)
crass (1.0.6)
@@ -99,11 +107,19 @@ GEM
irb (~> 1.10)
reline (>= 0.3.8)
drb (2.2.1)
+ erb_lint (0.5.0)
+ activesupport
+ better_html (>= 2.0.1)
+ parser (>= 2.7.1.4)
+ rainbow
+ rubocop
+ smart_properties
erubi (1.13.0)
globalid (1.2.1)
activesupport (>= 6.1)
i18n (1.14.5)
concurrent-ruby (~> 1.0)
+ iniparse (1.5.0)
io-console (0.7.2)
irb (1.13.2)
rdoc (>= 4.0.0)
@@ -148,6 +164,10 @@ GEM
racc (~> 1.4)
nokogiri (1.16.6-x86_64-linux)
racc (~> 1.4)
+ overcommit (0.63.0)
+ childprocess (>= 0.6.3, < 6)
+ iniparse (~> 1.4)
+ rexml (~> 3.2)
parallel (1.25.1)
parser (3.3.3.0)
ast (~> 2.4.1)
@@ -250,6 +270,7 @@ GEM
rexml (~> 3.2, >= 3.2.5)
rubyzip (>= 1.2.2, < 3.0)
websocket (~> 1.0)
+ smart_properties (1.17.0)
sqlite3 (2.0.2-aarch64-linux-gnu)
sqlite3 (2.0.2-aarch64-linux-musl)
sqlite3 (2.0.2-arm-linux-gnu)
@@ -305,12 +326,15 @@ PLATFORMS
x86_64-linux-musl
DEPENDENCIES
+ better_html
bootsnap
brakeman
capybara
cssbundling-rails
debug
+ erb_lint
jsbundling-rails
+ overcommit
propshaft
puma (>= 5.0)
rails (~> 7.2.0.beta2)
@@ -320,7 +344,6 @@ DEPENDENCIES
sqlite3 (>= 1.4)
stimulus-rails
turbo-rails
- tzinfo-data
web-console
BUNDLED WITH