babel-types lists JSXIdentifier as an Expression (#6960)
Currently, Babel is treating JSXIdentifier, JSXMemberExpression, and JSXEmptyExpression as expressions as well, which means Babel will for example incorrectly allow you to place these anywhere an expression is wanted. Closes #6851.
This commit is contained in:
committed by
Brian Ng
parent
398bc43656
commit
f0e46772a6
@@ -1111,7 +1111,7 @@ t.jSXEmptyExpression()
|
||||
|
||||
See also `t.isJSXEmptyExpression(node, opts)` and `t.assertJSXEmptyExpression(node, opts)`.
|
||||
|
||||
Aliases: `JSX`, `Expression`
|
||||
Aliases: `JSX`
|
||||
|
||||
|
||||
---
|
||||
@@ -1151,7 +1151,7 @@ t.jSXIdentifier(name)
|
||||
|
||||
See also `t.isJSXIdentifier(node, opts)` and `t.assertJSXIdentifier(node, opts)`.
|
||||
|
||||
Aliases: `JSX`, `Expression`
|
||||
Aliases: `JSX`
|
||||
|
||||
- `name`: `string` (required)
|
||||
|
||||
@@ -1164,7 +1164,7 @@ t.jSXMemberExpression(object, property)
|
||||
|
||||
See also `t.isJSXMemberExpression(node, opts)` and `t.assertJSXMemberExpression(node, opts)`.
|
||||
|
||||
Aliases: `JSX`, `Expression`
|
||||
Aliases: `JSX`
|
||||
|
||||
- `object`: `JSXMemberExpression | JSXIdentifier` (required)
|
||||
- `property`: `JSXIdentifier` (required)
|
||||
|
||||
@@ -65,7 +65,7 @@ defineType("JSXElement", {
|
||||
});
|
||||
|
||||
defineType("JSXEmptyExpression", {
|
||||
aliases: ["JSX", "Expression"],
|
||||
aliases: ["JSX"],
|
||||
});
|
||||
|
||||
defineType("JSXExpressionContainer", {
|
||||
@@ -90,7 +90,7 @@ defineType("JSXSpreadChild", {
|
||||
|
||||
defineType("JSXIdentifier", {
|
||||
builder: ["name"],
|
||||
aliases: ["JSX", "Expression"],
|
||||
aliases: ["JSX"],
|
||||
fields: {
|
||||
name: {
|
||||
validate: assertValueType("string"),
|
||||
@@ -100,7 +100,7 @@ defineType("JSXIdentifier", {
|
||||
|
||||
defineType("JSXMemberExpression", {
|
||||
visitor: ["object", "property"],
|
||||
aliases: ["JSX", "Expression"],
|
||||
aliases: ["JSX"],
|
||||
fields: {
|
||||
object: {
|
||||
validate: assertNodeType("JSXMemberExpression", "JSXIdentifier"),
|
||||
|
||||
Reference in New Issue
Block a user