Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable nullish coalescing by default in @babel/parser #10819

Merged
merged 2 commits into from Jan 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 10 additions & 10 deletions packages/babel-core/src/parser/util/missing-plugin-helper.js
Expand Up @@ -113,16 +113,6 @@ const pluginNameMap = {
url: "https://git.io/vAlRe",
},
},
nullishCoalescingOperator: {
syntax: {
name: "@babel/plugin-syntax-nullish-coalescing-operator",
url: "https://git.io/vb4yx",
},
transform: {
name: "@babel/plugin-proposal-nullish-coalescing-operator",
url: "https://git.io/vb4Se",
},
},
numericSeparator: {
syntax: {
name: "@babel/plugin-syntax-numeric-separator",
Expand Down Expand Up @@ -188,6 +178,16 @@ const pluginNameMap = {
url: "https://git.io/vb4yp",
},
},
nullishCoalescingOperator: {
syntax: {
name: "@babel/plugin-syntax-nullish-coalescing-operator",
url: "https://git.io/vb4yx",
},
transform: {
name: "@babel/plugin-proposal-nullish-coalescing-operator",
url: "https://git.io/vb4Se",
},
},
objectRestSpread: {
syntax: {
name: "@babel/plugin-syntax-object-rest-spread",
Expand Down

This file was deleted.

3 changes: 0 additions & 3 deletions packages/babel-parser/src/parser/expression.js
Expand Up @@ -196,7 +196,6 @@ export default class ExpressionParser extends LValParser {
node.operator = operator;

if (operator === "??=") {
this.expectPlugin("nullishCoalescingOperator");
this.expectPlugin("logicalAssignment");
}
if (operator === "||=" || operator === "&&=") {
Expand Down Expand Up @@ -333,8 +332,6 @@ export default class ExpressionParser extends LValParser {
this.expectPlugin("pipelineOperator");
this.state.inPipeline = true;
this.checkPipelineAtInfixOperator(left, leftStartPos);
} else if (op === tt.nullishCoalescing) {
this.expectPlugin("nullishCoalescingOperator");
}

this.next();
Expand Down
@@ -1,4 +1,4 @@
{
"plugins": ["nullishCoalescingOperator", "estree"],
"plugins": ["estree"],
"throws": "Nullish coalescing operator(??) requires parens when mixing with logical operators (1:0)"
}
@@ -1,4 +1,3 @@
{
"plugins": ["nullishCoalescingOperator"],
"throws": "Nullish coalescing operator(??) requires parens when mixing with logical operators (1:5)"
}
@@ -1,4 +1,3 @@
{
"plugins": ["nullishCoalescingOperator"],
"throws": "Nullish coalescing operator(??) requires parens when mixing with logical operators (1:10)"
}
@@ -1,4 +1,4 @@
{
"plugins": ["nullishCoalescingOperator", "estree"],
"plugins": ["estree"],
"throws": "Nullish coalescing operator(??) requires parens when mixing with logical operators (1:0)"
}
@@ -1,6 +1,5 @@
{
"plugins": [
"nullishCoalescingOperator",
["pipelineOperator", { "proposal": "minimal" }]
]
}

This file was deleted.

This file was deleted.

@@ -1,4 +1,3 @@
{
"plugins": ["nullishCoalescingOperator"],
"throws": "This experimental syntax requires enabling the parser plugin: 'logicalAssignment' (1:2)"
}
@@ -1,3 +1,3 @@
{
"plugins": ["logicalAssignment", "nullishCoalescingOperator"]
"plugins": ["logicalAssignment"]
}

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.