brodycj / prettierx

a less opinionated fork of Prettier code formatter
MIT License
209 stars 22 forks source link

[prettierx] Fix --align-object-properties for computed property #700

Open Yikes2000 opened 2 years ago

Yikes2000 commented 2 years ago

Fixed bug and added test coverage.

diff --git a/tests/format/x/js/align-object-properties/o.js b/tests/format/x/js/align-object-properties/o.js
index d5655e86a..aa63549a4 100644
--- a/tests/format/x/js/align-object-properties/o.js
+++ b/tests/format/x/js/align-object-properties/o.js
@@ -87,3 +87,11 @@ o = {
     next:2},
   keyasdf:3
 }
+
+// computed property
+o = {
+  [name.id]: 'value',
+  2:3,
+  "k-2":2,
+  keyasdf:3
+}
Yikes2000 commented 2 years ago

Missed a test snapshot. Updated.

jurisv commented 2 years ago

Also got bitten by this bug. Nice fix. Thank you!