Report a SyntaxError for } and > in JSX text (#12451)
cherry-pick #11046 Co-Authored-By: Kai Cataldo <kai@kaicataldo.com> Co-Authored-By: Nicolò Ribaudo <nicolo.ribaudo@gmail.com> Co-authored-by: Brad Zacher <brad.zacher@gmail.com> Co-authored-by: Kai Cataldo <kai@kaicataldo.com>
This commit is contained in:
@@ -125,6 +125,19 @@ export default (superClass: Class<Parser>): Class<Parser> =>
|
||||
chunkStart = this.state.pos;
|
||||
break;
|
||||
|
||||
case charCodes.greaterThan:
|
||||
case charCodes.rightCurlyBrace:
|
||||
if (process.env.BABEL_8_BREAKING) {
|
||||
const htmlEntity =
|
||||
ch === charCodes.rightCurlyBrace ? "}" : ">";
|
||||
const char = this.input[this.state.pos];
|
||||
this.raise(
|
||||
this.state.pos,
|
||||
`Unexpected token \`${char}\`. Did you mean \`${htmlEntity}\` or \`{'${char}'}\`?`,
|
||||
);
|
||||
}
|
||||
/* falls through */
|
||||
|
||||
default:
|
||||
if (isNewLine(ch)) {
|
||||
out += this.input.slice(chunkStart, this.state.pos);
|
||||
|
||||
Reference in New Issue
Block a user