diff --git a/lib/erb/formatter.rb b/lib/erb/formatter.rb
index dbc6f8a..2b6d6fe 100644
--- a/lib/erb/formatter.rb
+++ b/lib/erb/formatter.rb
@@ -9,6 +9,7 @@
require 'erb/formatter/version'
require 'syntax_tree'
+require 'syntax_tree/plugin/trailing_comma'
class ERB::Formatter
module SyntaxTreeCommandPatch
diff --git a/test/erb/test_formatter.rb b/test/erb/test_formatter.rb
index ab34c34..adb4454 100644
--- a/test/erb/test_formatter.rb
+++ b/test/erb/test_formatter.rb
@@ -128,7 +128,7 @@ def test_format_ruby
"
\n" \
" <%= render MyComponent.new(\n" \
" foo: barbarbarbarbarbarbarbar,\n" \
- " bar: bazbazbazbazbazbazbazbaz\n" \
+ " bar: bazbazbazbazbazbazbazbaz,\n" \
" ) %>\n" \
"
\n",
ERB::Formatter.format(" <%=render MyComponent.new(foo:barbarbarbarbarbarbarbar,bar:bazbazbazbazbazbazbazbaz)%>
"),
diff --git a/test/fixtures/complex_case_when.html.expected.erb b/test/fixtures/complex_case_when.html.expected.erb
index efb2be4..5a0e743 100644
--- a/test/fixtures/complex_case_when.html.expected.erb
+++ b/test/fixtures/complex_case_when.html.expected.erb
@@ -16,8 +16,8 @@
<% else %>
<% Rails.logger.error.report(
StandardError.new(
- "No human readable name found for payment method #{payment_method.class}"
- )
+ "No human readable name found for payment method #{payment_method.class}",
+ ),
) %>
<% end %>
<% else %>
diff --git a/test/fixtures/formatted-2.html.expected.erb b/test/fixtures/formatted-2.html.expected.erb
index dfda216..169ba7f 100644
--- a/test/fixtures/formatted-2.html.expected.erb
+++ b/test/fixtures/formatted-2.html.expected.erb
@@ -10,7 +10,7 @@
{ greeting: "Hello from react-rails." },
{ greeting: "Hello from react-rails." },
{ greeting: "Hello from react-rails." },
- { greeting: "Hello from react-rails." }
+ { greeting: "Hello from react-rails." },
) %>
diff --git a/test/fixtures/long_deep_nested-2.html.expected.erb b/test/fixtures/long_deep_nested-2.html.expected.erb
index c3c50d3..216894f 100644
--- a/test/fixtures/long_deep_nested-2.html.expected.erb
+++ b/test/fixtures/long_deep_nested-2.html.expected.erb
@@ -20,14 +20,14 @@
"HelloWorld",
{
greeting:
- "Hello from react-rails react-rails react-rails react-rails react-rails react-rails react-rails."
+ "Hello from react-rails react-rails react-rails react-rails react-rails react-rails react-rails.",
},
{
greeting:
- "Hello from react-rails react-rails react-rails react-rails react-rails react-rails react-rails."
+ "Hello from react-rails react-rails react-rails react-rails react-rails react-rails react-rails.",
},
{ greeting: "Hello from react-rails." },
- { greeting: "Hello from react-rails." }
+ { greeting: "Hello from react-rails." },
) %>
diff --git a/test/fixtures/trailing_comma.html.erb b/test/fixtures/trailing_comma.html.erb
new file mode 100644
index 0000000..6caa6e8
--- /dev/null
+++ b/test/fixtures/trailing_comma.html.erb
@@ -0,0 +1,6 @@
+<%= render component("ui/table").new(
+ id: "option-types-list",
+ data: {
+ rows: @option_types,url: ->(option_type) { edit_admin_option_type_path(option_type) },columns: columns,batch_actions: batch_actions,
+ },
+ ) %>
diff --git a/test/fixtures/trailing_comma.html.expected.erb b/test/fixtures/trailing_comma.html.expected.erb
new file mode 100644
index 0000000..206c678
--- /dev/null
+++ b/test/fixtures/trailing_comma.html.expected.erb
@@ -0,0 +1,9 @@
+<%= render component("ui/table").new(
+ id: "option-types-list",
+ data: {
+ rows: @option_types,
+ url: ->(option_type) { edit_admin_option_type_path(option_type) },
+ columns: columns,
+ batch_actions: batch_actions,
+ },
+) %>