Skip to content

Commit 1ec144b

Browse files
committed
allow hyphen in jsx prop names
1 parent 104fe9f commit 1ec144b

File tree

5 files changed

+10
-1
lines changed

5 files changed

+10
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020

2121
- Improve error when using '@deriving(accessors)' on a variant with record arguments. https://github.com/rescript-lang/rescript-compiler/pull/6712
2222

23+
- Stop escaping JSX prop names with hyphens. https://github.com/rescript-lang/rescript-compiler/pull/6705
24+
2325
# 11.1.0-rc.7
2426

2527
#### :bug: Bug Fix

jscomp/syntax/src/res_printer.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4410,6 +4410,7 @@ and printJsxProps ~state args cmtTbl : Doc.t * Parsetree.expression option =
44104410
loop [] args
44114411

44124412
and printJsxProp ~state arg cmtTbl =
4413+
let printIdentLike ident = printIdentLike ~allowHyphen:true ident in
44134414
match arg with
44144415
| ( ((Asttypes.Labelled lblTxt | Optional lblTxt) as lbl),
44154416
{

jscomp/syntax/tests/printer/expr/expected/exoticIdent.res.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ lazy \"let"
6262
let x = 1
6363

6464
let x =
65-
<div \"aria-foo"=\"type">
65+
<div aria-foo=\"type">
6666
\"module"
6767
\"let"
6868
</div>

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@ let x =
4747
{a}
4848
<B />
4949
</Foo.custom-tag>
50+
let x =
51+
<custom-tag data-custom-state=true>
52+
{a}
53+
<B />
54+
</custom-tag>
5055

5156
let x = <div className="container" className2="container2" className3="container3" onClick />
5257

jscomp/syntax/tests/printer/expr/jsx.res

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ let x = <A> {a} </A>
1717
let x = <A> {a} {b} </A>
1818
let x = <custom-tag className="container" > {a} <B/> </custom-tag>
1919
let x = <Foo.custom-tag className="container" > {a} <B/> </Foo.custom-tag>
20+
let x = <custom-tag data-custom-state=true > {a} <B/> </custom-tag>
2021

2122
let x =
2223
<div

0 commit comments

Comments
 (0)