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:
parent
0dbc3dd4a0
commit
fbef603c43
@ -125,6 +125,19 @@ export default (superClass: Class<Parser>): Class<Parser> =>
|
|||||||
chunkStart = this.state.pos;
|
chunkStart = this.state.pos;
|
||||||
break;
|
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:
|
default:
|
||||||
if (isNewLine(ch)) {
|
if (isNewLine(ch)) {
|
||||||
out += this.input.slice(chunkStart, this.state.pos);
|
out += this.input.slice(chunkStart, this.state.pos);
|
||||||
|
|||||||
@ -1 +0,0 @@
|
|||||||
<LeftRight left=<a /> right=<b>monkeys /> gorillas</b> />
|
|
||||||
@ -1,105 +0,0 @@
|
|||||||
{
|
|
||||||
"type": "File",
|
|
||||||
"start":0,"end":57,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":57}},
|
|
||||||
"program": {
|
|
||||||
"type": "Program",
|
|
||||||
"start":0,"end":57,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":57}},
|
|
||||||
"sourceType": "script",
|
|
||||||
"interpreter": null,
|
|
||||||
"body": [
|
|
||||||
{
|
|
||||||
"type": "ExpressionStatement",
|
|
||||||
"start":0,"end":57,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":57}},
|
|
||||||
"expression": {
|
|
||||||
"type": "JSXElement",
|
|
||||||
"start":0,"end":57,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":57}},
|
|
||||||
"openingElement": {
|
|
||||||
"type": "JSXOpeningElement",
|
|
||||||
"start":0,"end":57,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":57}},
|
|
||||||
"name": {
|
|
||||||
"type": "JSXIdentifier",
|
|
||||||
"start":1,"end":10,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":10}},
|
|
||||||
"name": "LeftRight"
|
|
||||||
},
|
|
||||||
"attributes": [
|
|
||||||
{
|
|
||||||
"type": "JSXAttribute",
|
|
||||||
"start":11,"end":21,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":21}},
|
|
||||||
"name": {
|
|
||||||
"type": "JSXIdentifier",
|
|
||||||
"start":11,"end":15,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":15}},
|
|
||||||
"name": "left"
|
|
||||||
},
|
|
||||||
"value": {
|
|
||||||
"type": "JSXElement",
|
|
||||||
"start":16,"end":21,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":21}},
|
|
||||||
"openingElement": {
|
|
||||||
"type": "JSXOpeningElement",
|
|
||||||
"start":16,"end":21,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":21}},
|
|
||||||
"name": {
|
|
||||||
"type": "JSXIdentifier",
|
|
||||||
"start":17,"end":18,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":18}},
|
|
||||||
"name": "a"
|
|
||||||
},
|
|
||||||
"attributes": [],
|
|
||||||
"selfClosing": true
|
|
||||||
},
|
|
||||||
"closingElement": null,
|
|
||||||
"children": []
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "JSXAttribute",
|
|
||||||
"start":22,"end":54,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":54}},
|
|
||||||
"name": {
|
|
||||||
"type": "JSXIdentifier",
|
|
||||||
"start":22,"end":27,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":27}},
|
|
||||||
"name": "right"
|
|
||||||
},
|
|
||||||
"value": {
|
|
||||||
"type": "JSXElement",
|
|
||||||
"start":28,"end":54,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":54}},
|
|
||||||
"openingElement": {
|
|
||||||
"type": "JSXOpeningElement",
|
|
||||||
"start":28,"end":31,"loc":{"start":{"line":1,"column":28},"end":{"line":1,"column":31}},
|
|
||||||
"name": {
|
|
||||||
"type": "JSXIdentifier",
|
|
||||||
"start":29,"end":30,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":30}},
|
|
||||||
"name": "b"
|
|
||||||
},
|
|
||||||
"attributes": [],
|
|
||||||
"selfClosing": false
|
|
||||||
},
|
|
||||||
"closingElement": {
|
|
||||||
"type": "JSXClosingElement",
|
|
||||||
"start":50,"end":54,"loc":{"start":{"line":1,"column":50},"end":{"line":1,"column":54}},
|
|
||||||
"name": {
|
|
||||||
"type": "JSXIdentifier",
|
|
||||||
"start":52,"end":53,"loc":{"start":{"line":1,"column":52},"end":{"line":1,"column":53}},
|
|
||||||
"name": "b"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"children": [
|
|
||||||
{
|
|
||||||
"type": "JSXText",
|
|
||||||
"start":31,"end":50,"loc":{"start":{"line":1,"column":31},"end":{"line":1,"column":50}},
|
|
||||||
"extra": {
|
|
||||||
"rawValue": "monkeys /> gorillas",
|
|
||||||
"raw": "monkeys /> gorillas"
|
|
||||||
},
|
|
||||||
"value": "monkeys /> gorillas"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"selfClosing": true
|
|
||||||
},
|
|
||||||
"closingElement": null,
|
|
||||||
"children": []
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"directives": []
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -0,0 +1 @@
|
|||||||
|
<div>></div>
|
||||||
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"BABEL_8_BREAKING": false
|
||||||
|
}
|
||||||
52
packages/babel-parser/test/fixtures/jsx/basic/jsx-text-closing-angle-bracket-babel-7/output.json
vendored
Normal file
52
packages/babel-parser/test/fixtures/jsx/basic/jsx-text-closing-angle-bracket-babel-7/output.json
vendored
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
{
|
||||||
|
"type": "File",
|
||||||
|
"start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}},
|
||||||
|
"program": {
|
||||||
|
"type": "Program",
|
||||||
|
"start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}},
|
||||||
|
"sourceType": "script",
|
||||||
|
"interpreter": null,
|
||||||
|
"body": [
|
||||||
|
{
|
||||||
|
"type": "ExpressionStatement",
|
||||||
|
"start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}},
|
||||||
|
"expression": {
|
||||||
|
"type": "JSXElement",
|
||||||
|
"start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}},
|
||||||
|
"openingElement": {
|
||||||
|
"type": "JSXOpeningElement",
|
||||||
|
"start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}},
|
||||||
|
"name": {
|
||||||
|
"type": "JSXIdentifier",
|
||||||
|
"start":1,"end":4,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":4}},
|
||||||
|
"name": "div"
|
||||||
|
},
|
||||||
|
"attributes": [],
|
||||||
|
"selfClosing": false
|
||||||
|
},
|
||||||
|
"closingElement": {
|
||||||
|
"type": "JSXClosingElement",
|
||||||
|
"start":6,"end":12,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":12}},
|
||||||
|
"name": {
|
||||||
|
"type": "JSXIdentifier",
|
||||||
|
"start":8,"end":11,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":11}},
|
||||||
|
"name": "div"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"type": "JSXText",
|
||||||
|
"start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6}},
|
||||||
|
"extra": {
|
||||||
|
"rawValue": ">",
|
||||||
|
"raw": ">"
|
||||||
|
},
|
||||||
|
"value": ">"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"directives": []
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1 @@
|
|||||||
|
<div>{'>'}</div>
|
||||||
56
packages/babel-parser/test/fixtures/jsx/basic/jsx-text-closing-angle-bracket-wrapped/output.json
vendored
Normal file
56
packages/babel-parser/test/fixtures/jsx/basic/jsx-text-closing-angle-bracket-wrapped/output.json
vendored
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
{
|
||||||
|
"type": "File",
|
||||||
|
"start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}},
|
||||||
|
"program": {
|
||||||
|
"type": "Program",
|
||||||
|
"start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}},
|
||||||
|
"sourceType": "script",
|
||||||
|
"interpreter": null,
|
||||||
|
"body": [
|
||||||
|
{
|
||||||
|
"type": "ExpressionStatement",
|
||||||
|
"start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}},
|
||||||
|
"expression": {
|
||||||
|
"type": "JSXElement",
|
||||||
|
"start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}},
|
||||||
|
"openingElement": {
|
||||||
|
"type": "JSXOpeningElement",
|
||||||
|
"start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}},
|
||||||
|
"name": {
|
||||||
|
"type": "JSXIdentifier",
|
||||||
|
"start":1,"end":4,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":4}},
|
||||||
|
"name": "div"
|
||||||
|
},
|
||||||
|
"attributes": [],
|
||||||
|
"selfClosing": false
|
||||||
|
},
|
||||||
|
"closingElement": {
|
||||||
|
"type": "JSXClosingElement",
|
||||||
|
"start":10,"end":16,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":16}},
|
||||||
|
"name": {
|
||||||
|
"type": "JSXIdentifier",
|
||||||
|
"start":12,"end":15,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":15}},
|
||||||
|
"name": "div"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"type": "JSXExpressionContainer",
|
||||||
|
"start":5,"end":10,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":10}},
|
||||||
|
"expression": {
|
||||||
|
"type": "StringLiteral",
|
||||||
|
"start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9}},
|
||||||
|
"extra": {
|
||||||
|
"rawValue": ">",
|
||||||
|
"raw": "'>'"
|
||||||
|
},
|
||||||
|
"value": ">"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"directives": []
|
||||||
|
}
|
||||||
|
}
|
||||||
1
packages/babel-parser/test/fixtures/jsx/basic/jsx-text-closing-curly-brace-babel-7/input.js
vendored
Normal file
1
packages/babel-parser/test/fixtures/jsx/basic/jsx-text-closing-curly-brace-babel-7/input.js
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
<div>}</div>
|
||||||
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"BABEL_8_BREAKING": false
|
||||||
|
}
|
||||||
52
packages/babel-parser/test/fixtures/jsx/basic/jsx-text-closing-curly-brace-babel-7/output.json
vendored
Normal file
52
packages/babel-parser/test/fixtures/jsx/basic/jsx-text-closing-curly-brace-babel-7/output.json
vendored
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
{
|
||||||
|
"type": "File",
|
||||||
|
"start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}},
|
||||||
|
"program": {
|
||||||
|
"type": "Program",
|
||||||
|
"start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}},
|
||||||
|
"sourceType": "script",
|
||||||
|
"interpreter": null,
|
||||||
|
"body": [
|
||||||
|
{
|
||||||
|
"type": "ExpressionStatement",
|
||||||
|
"start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}},
|
||||||
|
"expression": {
|
||||||
|
"type": "JSXElement",
|
||||||
|
"start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}},
|
||||||
|
"openingElement": {
|
||||||
|
"type": "JSXOpeningElement",
|
||||||
|
"start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}},
|
||||||
|
"name": {
|
||||||
|
"type": "JSXIdentifier",
|
||||||
|
"start":1,"end":4,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":4}},
|
||||||
|
"name": "div"
|
||||||
|
},
|
||||||
|
"attributes": [],
|
||||||
|
"selfClosing": false
|
||||||
|
},
|
||||||
|
"closingElement": {
|
||||||
|
"type": "JSXClosingElement",
|
||||||
|
"start":6,"end":12,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":12}},
|
||||||
|
"name": {
|
||||||
|
"type": "JSXIdentifier",
|
||||||
|
"start":8,"end":11,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":11}},
|
||||||
|
"name": "div"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"type": "JSXText",
|
||||||
|
"start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6}},
|
||||||
|
"extra": {
|
||||||
|
"rawValue": "}",
|
||||||
|
"raw": "}"
|
||||||
|
},
|
||||||
|
"value": "}"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"directives": []
|
||||||
|
}
|
||||||
|
}
|
||||||
1
packages/babel-parser/test/fixtures/jsx/basic/jsx-text-closing-curly-brace-wrapped/input.js
vendored
Normal file
1
packages/babel-parser/test/fixtures/jsx/basic/jsx-text-closing-curly-brace-wrapped/input.js
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
<div>{'}'}</div>
|
||||||
56
packages/babel-parser/test/fixtures/jsx/basic/jsx-text-closing-curly-brace-wrapped/output.json
vendored
Normal file
56
packages/babel-parser/test/fixtures/jsx/basic/jsx-text-closing-curly-brace-wrapped/output.json
vendored
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
{
|
||||||
|
"type": "File",
|
||||||
|
"start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}},
|
||||||
|
"program": {
|
||||||
|
"type": "Program",
|
||||||
|
"start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}},
|
||||||
|
"sourceType": "script",
|
||||||
|
"interpreter": null,
|
||||||
|
"body": [
|
||||||
|
{
|
||||||
|
"type": "ExpressionStatement",
|
||||||
|
"start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}},
|
||||||
|
"expression": {
|
||||||
|
"type": "JSXElement",
|
||||||
|
"start":0,"end":16,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":16}},
|
||||||
|
"openingElement": {
|
||||||
|
"type": "JSXOpeningElement",
|
||||||
|
"start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}},
|
||||||
|
"name": {
|
||||||
|
"type": "JSXIdentifier",
|
||||||
|
"start":1,"end":4,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":4}},
|
||||||
|
"name": "div"
|
||||||
|
},
|
||||||
|
"attributes": [],
|
||||||
|
"selfClosing": false
|
||||||
|
},
|
||||||
|
"closingElement": {
|
||||||
|
"type": "JSXClosingElement",
|
||||||
|
"start":10,"end":16,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":16}},
|
||||||
|
"name": {
|
||||||
|
"type": "JSXIdentifier",
|
||||||
|
"start":12,"end":15,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":15}},
|
||||||
|
"name": "div"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"type": "JSXExpressionContainer",
|
||||||
|
"start":5,"end":10,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":10}},
|
||||||
|
"expression": {
|
||||||
|
"type": "StringLiteral",
|
||||||
|
"start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9}},
|
||||||
|
"extra": {
|
||||||
|
"rawValue": "}",
|
||||||
|
"raw": "'}'"
|
||||||
|
},
|
||||||
|
"value": "}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"directives": []
|
||||||
|
}
|
||||||
|
}
|
||||||
1
packages/babel-parser/test/fixtures/jsx/errors/jsx-text-closing-angle-bracket/input.js
vendored
Normal file
1
packages/babel-parser/test/fixtures/jsx/errors/jsx-text-closing-angle-bracket/input.js
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
<div>></div>
|
||||||
3
packages/babel-parser/test/fixtures/jsx/errors/jsx-text-closing-angle-bracket/options.json
vendored
Normal file
3
packages/babel-parser/test/fixtures/jsx/errors/jsx-text-closing-angle-bracket/options.json
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"BABEL_8_BREAKING": true
|
||||||
|
}
|
||||||
55
packages/babel-parser/test/fixtures/jsx/errors/jsx-text-closing-angle-bracket/output.json
vendored
Normal file
55
packages/babel-parser/test/fixtures/jsx/errors/jsx-text-closing-angle-bracket/output.json
vendored
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
{
|
||||||
|
"type": "File",
|
||||||
|
"start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}},
|
||||||
|
"errors": [
|
||||||
|
"SyntaxError: Unexpected token `>`. Did you mean `>` or `{'>'}`? (1:5)"
|
||||||
|
],
|
||||||
|
"program": {
|
||||||
|
"type": "Program",
|
||||||
|
"start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}},
|
||||||
|
"sourceType": "script",
|
||||||
|
"interpreter": null,
|
||||||
|
"body": [
|
||||||
|
{
|
||||||
|
"type": "ExpressionStatement",
|
||||||
|
"start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}},
|
||||||
|
"expression": {
|
||||||
|
"type": "JSXElement",
|
||||||
|
"start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}},
|
||||||
|
"openingElement": {
|
||||||
|
"type": "JSXOpeningElement",
|
||||||
|
"start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}},
|
||||||
|
"name": {
|
||||||
|
"type": "JSXIdentifier",
|
||||||
|
"start":1,"end":4,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":4}},
|
||||||
|
"name": "div"
|
||||||
|
},
|
||||||
|
"attributes": [],
|
||||||
|
"selfClosing": false
|
||||||
|
},
|
||||||
|
"closingElement": {
|
||||||
|
"type": "JSXClosingElement",
|
||||||
|
"start":6,"end":12,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":12}},
|
||||||
|
"name": {
|
||||||
|
"type": "JSXIdentifier",
|
||||||
|
"start":8,"end":11,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":11}},
|
||||||
|
"name": "div"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"type": "JSXText",
|
||||||
|
"start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6}},
|
||||||
|
"extra": {
|
||||||
|
"rawValue": ">",
|
||||||
|
"raw": ">"
|
||||||
|
},
|
||||||
|
"value": ">"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"directives": []
|
||||||
|
}
|
||||||
|
}
|
||||||
1
packages/babel-parser/test/fixtures/jsx/errors/jsx-text-closing-curly-brace/input.js
vendored
Normal file
1
packages/babel-parser/test/fixtures/jsx/errors/jsx-text-closing-curly-brace/input.js
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
<div>}</div>
|
||||||
3
packages/babel-parser/test/fixtures/jsx/errors/jsx-text-closing-curly-brace/options.json
vendored
Normal file
3
packages/babel-parser/test/fixtures/jsx/errors/jsx-text-closing-curly-brace/options.json
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"BABEL_8_BREAKING": true
|
||||||
|
}
|
||||||
55
packages/babel-parser/test/fixtures/jsx/errors/jsx-text-closing-curly-brace/output.json
vendored
Normal file
55
packages/babel-parser/test/fixtures/jsx/errors/jsx-text-closing-curly-brace/output.json
vendored
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
{
|
||||||
|
"type": "File",
|
||||||
|
"start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}},
|
||||||
|
"errors": [
|
||||||
|
"SyntaxError: Unexpected token `}`. Did you mean `}` or `{'}'}`? (1:5)"
|
||||||
|
],
|
||||||
|
"program": {
|
||||||
|
"type": "Program",
|
||||||
|
"start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}},
|
||||||
|
"sourceType": "script",
|
||||||
|
"interpreter": null,
|
||||||
|
"body": [
|
||||||
|
{
|
||||||
|
"type": "ExpressionStatement",
|
||||||
|
"start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}},
|
||||||
|
"expression": {
|
||||||
|
"type": "JSXElement",
|
||||||
|
"start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}},
|
||||||
|
"openingElement": {
|
||||||
|
"type": "JSXOpeningElement",
|
||||||
|
"start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5}},
|
||||||
|
"name": {
|
||||||
|
"type": "JSXIdentifier",
|
||||||
|
"start":1,"end":4,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":4}},
|
||||||
|
"name": "div"
|
||||||
|
},
|
||||||
|
"attributes": [],
|
||||||
|
"selfClosing": false
|
||||||
|
},
|
||||||
|
"closingElement": {
|
||||||
|
"type": "JSXClosingElement",
|
||||||
|
"start":6,"end":12,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":12}},
|
||||||
|
"name": {
|
||||||
|
"type": "JSXIdentifier",
|
||||||
|
"start":8,"end":11,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":11}},
|
||||||
|
"name": "div"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"type": "JSXText",
|
||||||
|
"start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6}},
|
||||||
|
"extra": {
|
||||||
|
"rawValue": "}",
|
||||||
|
"raw": "}"
|
||||||
|
},
|
||||||
|
"value": "}"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"directives": []
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user