Skip to content
This repository was archived by the owner on Jun 15, 2023. It is now read-only.

Commit 4a96418

Browse files
committed
fix formatting of jsx spread props
1 parent 2fd8f0c commit 4a96418

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

src/res_printer.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4337,7 +4337,7 @@ and printJsxProp ~customLayout arg cmtTbl =
43374337
| Optional _lbl -> Doc.concat [Doc.question; printIdentLike ident])
43384338
| Asttypes.Labelled "_spreadProps", expr ->
43394339
let doc = printExpressionWithComments ~customLayout expr cmtTbl in
4340-
Doc.concat [Doc.lbrace; Doc.dotdotdot; Doc.softLine; doc; Doc.rbrace]
4340+
Doc.concat [Doc.lbrace; Doc.dotdotdot; doc; Doc.rbrace]
43414341
| lbl, expr ->
43424342
let argLoc, expr =
43434343
match expr.pexp_attributes with

tests/printer/expr/expected/jsx.res.txt

+7
Original file line numberDiff line numberDiff line change
@@ -410,3 +410,10 @@ let v =
410410
</A>
411411

412412
let x = <A x="y" {...str} />
413+
414+
// https://github.com/rescript-lang/rescript-compiler/issues/6002
415+
let x = props =>
416+
<A
417+
{...props}
418+
className="inline-block px-6 py-2.5 bg-blue-600 text-white font-medium text-xs leading-tight"
419+
/>

tests/printer/expr/jsx.res

+8-1
Original file line numberDiff line numberDiff line change
@@ -402,4 +402,11 @@ let v =
402402
</B>
403403
</A>
404404

405-
let x = <A x="y" {...str} />
405+
let x = <A x="y" {...str} />
406+
407+
// https://github.com/rescript-lang/rescript-compiler/issues/6002
408+
let x = props =>
409+
<A
410+
{...props}
411+
className="inline-block px-6 py-2.5 bg-blue-600 text-white font-medium text-xs leading-tight"
412+
/>

0 commit comments

Comments
 (0)