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:
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user