You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Choose one: is this a bug report or feature request? Bug report
The React isCompatTag accepts a leading dash '-' in tag names. This means it will accept JSX tag names like <-div>.
Input Code
Adding a test suite for the React isCompatTag validator:
suite("isCompatTag",function(){it("rejects leading dash '-'",function(){assert(t.react.isCompatTag("-div")===false);assert(t.react.isCompatTag("-span")===false);assert(t.react.isCompatTag("-a")===false);assert(t.react.isCompatTag("-input")===false);});});
Produces this error:
7752 passing (2m)
94 pending
1 failing
1) rejects leading dash '-':
AssertionError [ERR_ASSERTION]: false == true
+ expected - actual
-false
+true
at Context.<anonymous> (packages/babel-types/test/validators.js:58:7)
Hey @claudiopro! We really appreciate you taking the time to report an issue. The collaborators
on this project attempt to help as many people as possible, but we're a limited number of volunteers,
so it's possible this won't be addressed swiftly.
If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack
community that typically always has someone willing to help. You can sign-up here
for an invite.
Choose one: is this a bug report or feature request? Bug report
The React
isCompatTag
accepts a leading dash'-'
in tag names. This means it will accept JSX tag names like<-div>
.Input Code
Adding a test suite for the React
isCompatTag
validator:Produces this error:
Babel/Babylon Configuration (.babelrc, package.json, cli command)
N/A, reproduced in unit tests
Expected Behavior
Tag names with leading dash characters
'-'
are not validCurrent Behavior
Tag names with leading dash characters
'-'
are acceptedPossible Solution
Fix this regexp:
https://github.com/babel/babel/blob/master/packages/babel-types/src/validators/react/isCompatTag.js#L3
Context
Spotted in @hzoo's tweet: https://twitter.com/left_pad/status/949301094903099393
Your Environment
The text was updated successfully, but these errors were encountered: