From c9f7f1308ff6949995fc4675cc3747a7d2a789a2 Mon Sep 17 00:00:00 2001 From: Boshen Date: Sat, 18 Nov 2023 15:42:39 +0800 Subject: [PATCH] chore(prettier): allow trailing comma in some macros (#1405) --- crates/oxc_prettier/src/format/module.rs | 2 +- crates/oxc_prettier/src/macros.rs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/oxc_prettier/src/format/module.rs b/crates/oxc_prettier/src/format/module.rs index 6b1816021..13bff05b7 100644 --- a/crates/oxc_prettier/src/format/module.rs +++ b/crates/oxc_prettier/src/format/module.rs @@ -87,7 +87,7 @@ pub fn print_module_specifiers<'a, T: Format<'a>>( ], if_break!(p, if p.should_print_es5_comma() { "," } else { "" }), if p.options.bracket_spacing { line!() } else { softline!() }, - ss!("}") + ss!("}"), ]); } else { parts.push(ss!("{")); diff --git a/crates/oxc_prettier/src/macros.rs b/crates/oxc_prettier/src/macros.rs index 6c70b8740..636e695cb 100644 --- a/crates/oxc_prettier/src/macros.rs +++ b/crates/oxc_prettier/src/macros.rs @@ -24,7 +24,7 @@ macro_rules! string { #[macro_export] macro_rules! indent { - ($p:ident, $( $x:expr ),* ) => { + ($p:ident, $( $x:expr ),* $(,)?) => { { let mut temp_vec = $p.vec(); $( @@ -58,7 +58,7 @@ macro_rules! hardline { #[macro_export] macro_rules! array { - ($p:ident, $( $x:expr ),* ) => { + ($p:ident, $( $x:expr ),* $(,)?) => { { let mut temp_vec = $p.vec(); $( @@ -71,7 +71,7 @@ macro_rules! array { #[macro_export] macro_rules! group { - ($p:ident, $( $x:expr ),* ) => { + ($p:ident, $( $x:expr ),* $(,)?) => { { let mut temp_vec = $p.vec(); $(