From a90254ede75ba7e7dbc8cf1edf3baead9a4a433f Mon Sep 17 00:00:00 2001 From: Wilfred Hughes Date: Sat, 29 Jun 2024 16:20:29 -0700 Subject: [PATCH] Ignore trailing commas where they're not semantically meaningful --- sample_files/compare.expected | 3 +++ sample_files/trailing_commas_1.js | 4 ++++ sample_files/trailing_commas_2.js | 13 +++++++++++++ 3 files changed, 20 insertions(+) create mode 100644 sample_files/trailing_commas_1.js create mode 100644 sample_files/trailing_commas_2.js diff --git a/sample_files/compare.expected b/sample_files/compare.expected index baf586488..4696d527d 100644 --- a/sample_files/compare.expected +++ b/sample_files/compare.expected @@ -283,6 +283,9 @@ sample_files/todomvc_1.gleam sample_files/todomvc_2.gleam sample_files/toml_1.toml sample_files/toml_2.toml c331bdb54c00b0a5b5a622dbd250042a - +sample_files/trailing_commas_1.js sample_files/trailing_commas_2.js +9ca72e199466c75f85d00f4d521e85ff - + sample_files/trailling_newline_1.yaml sample_files/trailling_newline_2.yaml 8e37febfec957288576f9c2020cfc4f2 - diff --git a/sample_files/trailing_commas_1.js b/sample_files/trailing_commas_1.js new file mode 100644 index 000000000..be6576a58 --- /dev/null +++ b/sample_files/trailing_commas_1.js @@ -0,0 +1,4 @@ +function foo(x, y) { + var z = [1, 2]; + var zz = {a: 1, b: 2}; +} diff --git a/sample_files/trailing_commas_2.js b/sample_files/trailing_commas_2.js new file mode 100644 index 000000000..4ab8ccd04 --- /dev/null +++ b/sample_files/trailing_commas_2.js @@ -0,0 +1,13 @@ +function foo( + x, + y, +) { + var z = [ + 1, + 2, + ]; + var zz = { + a: 1, + b: 2, + }; +}