Skip to content

Commit

Permalink
fix: better follow prettiers trailingComma config (#39)
Browse files Browse the repository at this point in the history
  • Loading branch information
DylanPiercey authored Jun 16, 2023
1 parent 8eb2d7a commit 0c0f507
Show file tree
Hide file tree
Showing 22 changed files with 136 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{ aaaaaaaaaa: 1, bbbbbbbbbb: 2, cccccccccc: 3 },
aaaaaaaaaa,
bbbbbbbbbb,
cccccccccc,
cccccccccc
)/>
-- ${test}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ div foo(
{ aaaaaaaaaa: 1, bbbbbbbbbb: 2, cccccccccc: 3 },
aaaaaaaaaa,
bbbbbbbbbb,
cccccccccc,
cccccccccc
)
-- ${test}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{ aaaaaaaaaa: 1, bbbbbbbbbb: 2, cccccccccc: 3 },
aaaaaaaaaa,
bbbbbbbbbb,
cccccccccc,
cccccccccc
)/>
-- ${test}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{ aaaaaaaaaa: 1, bbbbbbbbbb: 2, cccccccccc: 3 },
aaaaaaaaaa,
bbbbbbbbbb,
cccccccccc,
cccccccccc
)/>
-- ${test}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
{ aaaaaaaaaa: 1, bbbbbbbbbb: 2, cccccccccc: 3 },
aaaaaaaaaa,
bbbbbbbbbb,
cccccccccc,
cccccccccc
)/>
<foo(a, b)/>
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ foo(
{ aaaaaaaaaa: 1, bbbbbbbbbb: 2, cccccccccc: 3 },
aaaaaaaaaa,
bbbbbbbbbb,
cccccccccc,
cccccccccc
)
foo(a, b)
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
{ aaaaaaaaaa: 1, bbbbbbbbbb: 2, cccccccccc: 3 },
aaaaaaaaaa,
bbbbbbbbbb,
cccccccccc,
cccccccccc
)/>
<foo(a, b)/>
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
{ aaaaaaaaaa: 1, bbbbbbbbbb: 2, cccccccccc: 3 },
aaaaaaaaaa,
bbbbbbbbbb,
cccccccccc,
cccccccccc
)/>
<foo(a, b)/>
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
{ aaaaaaaaaa: 1, bbbbbbbbbb: 2, cccccccccc: 3 },
aaaaaaaaaa,
bbbbbbbbbb,
cccccccccc,
cccccccccc
)/>
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ div foo(
{ aaaaaaaaaa: 1, bbbbbbbbbb: 2, cccccccccc: 3 },
aaaaaaaaaa,
bbbbbbbbbb,
cccccccccc,
cccccccccc
)
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
{ aaaaaaaaaa: 1, bbbbbbbbbb: 2, cccccccccc: 3 },
aaaaaaaaaa,
bbbbbbbbbb,
cccccccccc,
cccccccccc
)/>
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
{ aaaaaaaaaa: 1, bbbbbbbbbb: 2, cccccccccc: 3 },
aaaaaaaaaa,
bbbbbbbbbb,
cccccccccc,
cccccccccc
)/>
25 changes: 25 additions & 0 deletions src/__tests__/__snapshots__/if-condition.expected/auto.marko
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<if(
thisPerson.address &&
thisPerson.phone &&
thisPerson.age &&
thisPerson.nationality
)>
<person-card
address=thisPerson.address
phone=thisPerson.phone
age=thisPerson.age
/>
</if>

<if(
thisPerson.address &&
thisPerson.phone &&
thisPerson.age &&
thisPerson.nationality
)>
<person-card
address=thisPerson.address
phone=thisPerson.phone
age=thisPerson.age
/>
</if>
23 changes: 23 additions & 0 deletions src/__tests__/__snapshots__/if-condition.expected/concise.marko
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
if(
thisPerson.address &&
thisPerson.phone &&
thisPerson.age &&
thisPerson.nationality
)
person-card [
address=thisPerson.address
phone=thisPerson.phone
age=thisPerson.age
]

if(
thisPerson.address &&
thisPerson.phone &&
thisPerson.age &&
thisPerson.nationality
)
person-card [
address=thisPerson.address
phone=thisPerson.phone
age=thisPerson.age
]
25 changes: 25 additions & 0 deletions src/__tests__/__snapshots__/if-condition.expected/html.marko
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<if(
thisPerson.address &&
thisPerson.phone &&
thisPerson.age &&
thisPerson.nationality
)>
<person-card
address=thisPerson.address
phone=thisPerson.phone
age=thisPerson.age
/>
</if>

<if(
thisPerson.address &&
thisPerson.phone &&
thisPerson.age &&
thisPerson.nationality
)>
<person-card
address=thisPerson.address
phone=thisPerson.phone
age=thisPerson.age
/>
</if>
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<if(
thisPerson.address &&
thisPerson.phone &&
thisPerson.age &&
thisPerson.nationality
)>
<person-card
address=thisPerson.address
phone=thisPerson.phone
age=thisPerson.age
/>
</if>

<if(
thisPerson.address &&
thisPerson.phone &&
thisPerson.age &&
thisPerson.nationality
)>
<person-card
address=thisPerson.address
phone=thisPerson.phone
age=thisPerson.age
/>
</if>
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
{ aaaaaaaaaa: 1, bbbbbbbbbb: 2, cccccccccc: 3 },
aaaaaaaaaa,
bbbbbbbbbb,
cccccccccc,
cccccccccc
)/>
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ foo(
{ aaaaaaaaaa: 1, bbbbbbbbbb: 2, cccccccccc: 3 },
aaaaaaaaaa,
bbbbbbbbbb,
cccccccccc,
cccccccccc
)
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
{ aaaaaaaaaa: 1, bbbbbbbbbb: 2, cccccccccc: 3 },
aaaaaaaaaa,
bbbbbbbbbb,
cccccccccc,
cccccccccc
)/>
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
{ aaaaaaaaaa: 1, bbbbbbbbbb: 2, cccccccccc: 3 },
aaaaaaaaaa,
bbbbbbbbbb,
cccccccccc,
cccccccccc
)/>
20 changes: 20 additions & 0 deletions src/__tests__/fixtures/if-condition.marko
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<if(thisPerson.address && thisPerson.phone && thisPerson.age && thisPerson.nationality)>
<person-card
address=thisPerson.address
phone=thisPerson.phone
age=thisPerson.age
/>
</if>

<if(
thisPerson.address &&
thisPerson.phone &&
thisPerson.age &&
thisPerson.nationality,
)>
<person-card
address=thisPerson.address
phone=thisPerson.phone
age=thisPerson.age
/>
</if>
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ export const printers: Record<string, Printer<Node>> = {
[",", b.line],
tagPath.map((it) => print(it), "arguments")
),
opts.trailingComma ? b.ifBreak(",") : "",
opts.trailingComma === "all" ? b.ifBreak(",") : "",
]),
b.softline,
")",
Expand Down Expand Up @@ -591,7 +591,7 @@ export const printers: Record<string, Printer<Node>> = {
[",", b.line],
attrPath.map((it) => print(it), "arguments")
),
opts.trailingComma ? b.ifBreak(",") : "",
opts.trailingComma === "all" ? b.ifBreak(",") : "",
]),
b.softline,
")",
Expand Down

0 comments on commit 0c0f507

Please sign in to comment.