Add better parser error when using jsx (#11722)

* Add "<" parser tests

*  No {jsx,flow,typescript} plugin

* Type parameter

* Valid JS Code

* Add: better parser error when using jsx

Address #11499

* Add: babel parser test

Test parser with no plugins and when jsx is given with a js expression

* Add: no flow but with typescript test

* Add: type paramter test with no plugins (no flow)

* Add: unclosed jsx element test
This commit is contained in:
Jorge Henriquez
2020-06-22 15:12:52 -07:00
committed by GitHub
parent 601c824873
commit beca7e2d8e
16 changed files with 154 additions and 0 deletions

View File

@@ -1177,6 +1177,12 @@ export default class ExpressionParser extends LValParser {
}
}
// fall through
case tt.relational: {
if (this.state.value === "<") {
throw this.expectOnePlugin(["jsx", "flow", "typescript"]);
}
}
// fall through
default:
throw this.unexpected();
}