diff --git a/packages/babel-core/src/parser/util/missing-plugin-helper.js b/packages/babel-core/src/parser/util/missing-plugin-helper.js old mode 100644 new mode 100755 index b0642c50c3cf..2560f3ea94bc --- a/packages/babel-core/src/parser/util/missing-plugin-helper.js +++ b/packages/babel-core/src/parser/util/missing-plugin-helper.js @@ -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", @@ -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", diff --git a/packages/babel-generator/test/fixtures/types/LogicalExpression/options.json b/packages/babel-generator/test/fixtures/types/LogicalExpression/options.json deleted file mode 100644 index 1bb4736991a4..000000000000 --- a/packages/babel-generator/test/fixtures/types/LogicalExpression/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "plugins": ["nullishCoalescingOperator"] -} diff --git a/packages/babel-parser/src/parser/expression.js b/packages/babel-parser/src/parser/expression.js old mode 100644 new mode 100755 index b0669d9f46ec..69bfbbec0aab --- a/packages/babel-parser/src/parser/expression.js +++ b/packages/babel-parser/src/parser/expression.js @@ -196,7 +196,6 @@ export default class ExpressionParser extends LValParser { node.operator = operator; if (operator === "??=") { - this.expectPlugin("nullishCoalescingOperator"); this.expectPlugin("logicalAssignment"); } if (operator === "||=" || operator === "&&=") { @@ -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(); diff --git a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/and-nullish/input.js b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/and-nullish/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/and-nullish/input.js rename to packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/and-nullish/input.js diff --git a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/and-nullish/output.json b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/and-nullish/output.json similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/and-nullish/output.json rename to packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/and-nullish/output.json diff --git a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/associativity/input.js b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/associativity/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/associativity/input.js rename to packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/associativity/input.js diff --git a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/associativity/output.json b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/associativity/output.json similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/associativity/output.json rename to packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/associativity/output.json diff --git a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/expression/input.js b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/expression/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/expression/input.js rename to packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/expression/input.js diff --git a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/expression/output.json b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/expression/output.json similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/expression/output.json rename to packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/expression/output.json diff --git a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/multiline/input.js b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/multiline/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/multiline/input.js rename to packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/multiline/input.js diff --git a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/multiline/output.json b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/multiline/output.json similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/multiline/output.json rename to packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/multiline/output.json diff --git a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/no-paren-and-nullish/input.js b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/no-paren-and-nullish/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/no-paren-and-nullish/input.js rename to packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/no-paren-and-nullish/input.js diff --git a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/no-paren-and-nullish/options.json b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/no-paren-and-nullish/options.json old mode 100644 new mode 100755 similarity index 66% rename from packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/no-paren-and-nullish/options.json rename to packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/no-paren-and-nullish/options.json index 7fe297276880..8adc3b6ed3e7 --- a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/no-paren-and-nullish/options.json +++ b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/no-paren-and-nullish/options.json @@ -1,4 +1,4 @@ { - "plugins": ["nullishCoalescingOperator", "estree"], + "plugins": ["estree"], "throws": "Nullish coalescing operator(??) requires parens when mixing with logical operators (1:0)" } diff --git a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/no-paren-nullish-and/input.js b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/no-paren-nullish-and/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/no-paren-nullish-and/input.js rename to packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/no-paren-nullish-and/input.js diff --git a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/no-paren-nullish-and/options.json b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/no-paren-nullish-and/options.json old mode 100644 new mode 100755 similarity index 70% rename from packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/no-paren-nullish-and/options.json rename to packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/no-paren-nullish-and/options.json index f66091fd9574..b4d06207ab24 --- a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/no-paren-nullish-and/options.json +++ b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/no-paren-nullish-and/options.json @@ -1,4 +1,3 @@ { - "plugins": ["nullishCoalescingOperator"], "throws": "Nullish coalescing operator(??) requires parens when mixing with logical operators (1:5)" } diff --git a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/no-paren-nullish-or/input.js b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/no-paren-nullish-or/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/no-paren-nullish-or/input.js rename to packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/no-paren-nullish-or/input.js diff --git a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/no-paren-nullish-or/options.json b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/no-paren-nullish-or/options.json old mode 100644 new mode 100755 similarity index 71% rename from packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/no-paren-nullish-or/options.json rename to packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/no-paren-nullish-or/options.json index d386ce1edb21..7905b902574e --- a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/no-paren-nullish-or/options.json +++ b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/no-paren-nullish-or/options.json @@ -1,4 +1,3 @@ { - "plugins": ["nullishCoalescingOperator"], "throws": "Nullish coalescing operator(??) requires parens when mixing with logical operators (1:10)" } diff --git a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/no-paren-or-nullish/input.js b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/no-paren-or-nullish/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/no-paren-or-nullish/input.js rename to packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/no-paren-or-nullish/input.js diff --git a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/no-paren-or-nullish/options.json b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/no-paren-or-nullish/options.json old mode 100644 new mode 100755 similarity index 66% rename from packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/no-paren-or-nullish/options.json rename to packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/no-paren-or-nullish/options.json index 7fe297276880..8adc3b6ed3e7 --- a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/no-paren-or-nullish/options.json +++ b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/no-paren-or-nullish/options.json @@ -1,4 +1,4 @@ { - "plugins": ["nullishCoalescingOperator", "estree"], + "plugins": ["estree"], "throws": "Nullish coalescing operator(??) requires parens when mixing with logical operators (1:0)" } diff --git a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/nullish-and/input.js b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/nullish-and/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/nullish-and/input.js rename to packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/nullish-and/input.js diff --git a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/nullish-and/output.json b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/nullish-and/output.json similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/nullish-and/output.json rename to packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/nullish-and/output.json diff --git a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/nullish-or/input.js b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/nullish-or/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/nullish-or/input.js rename to packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/nullish-or/input.js diff --git a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/nullish-or/output.json b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/nullish-or/output.json similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/nullish-or/output.json rename to packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/nullish-or/output.json diff --git a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/or-nullish/input.js b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/or-nullish/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/or-nullish/input.js rename to packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/or-nullish/input.js diff --git a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/or-nullish/output.json b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/or-nullish/output.json similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/or-nullish/output.json rename to packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/or-nullish/output.json diff --git a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/with-pipeline/input.js b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/with-pipeline/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/with-pipeline/input.js rename to packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/with-pipeline/input.js diff --git a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/with-pipeline/options.json b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/with-pipeline/options.json old mode 100644 new mode 100755 similarity index 69% rename from packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/with-pipeline/options.json rename to packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/with-pipeline/options.json index 790c3f234b5c..f96a57c74821 --- a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/with-pipeline/options.json +++ b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/with-pipeline/options.json @@ -1,6 +1,5 @@ { "plugins": [ - "nullishCoalescingOperator", ["pipelineOperator", { "proposal": "minimal" }] ] } diff --git a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/with-pipeline/output.json b/packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/with-pipeline/output.json similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/with-pipeline/output.json rename to packages/babel-parser/test/fixtures/es2020/nullish-coalescing-operator/with-pipeline/output.json diff --git a/packages/babel-parser/test/fixtures/experimental/logical-assignment-operator/qq-equals-no-null-coalesce-plugin/input.js b/packages/babel-parser/test/fixtures/experimental/logical-assignment-operator/qq-equals-no-null-coalesce-plugin/input.js deleted file mode 100644 index dcf876b17411..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/logical-assignment-operator/qq-equals-no-null-coalesce-plugin/input.js +++ /dev/null @@ -1,2 +0,0 @@ -a ??= b; -obj.a ??= b; diff --git a/packages/babel-parser/test/fixtures/experimental/logical-assignment-operator/qq-equals-no-null-coalesce-plugin/options.json b/packages/babel-parser/test/fixtures/experimental/logical-assignment-operator/qq-equals-no-null-coalesce-plugin/options.json deleted file mode 100644 index 3cb238ee4af0..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/logical-assignment-operator/qq-equals-no-null-coalesce-plugin/options.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "plugins": ["logicalAssignment"], - "throws": "This experimental syntax requires enabling the parser plugin: 'nullishCoalescingOperator' (1:2)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/logical-assignment-operator/qq-equals-no-plugin/options.json b/packages/babel-parser/test/fixtures/experimental/logical-assignment-operator/qq-equals-no-plugin/options.json old mode 100644 new mode 100755 index f5e977775daf..64389a45889e --- a/packages/babel-parser/test/fixtures/experimental/logical-assignment-operator/qq-equals-no-plugin/options.json +++ b/packages/babel-parser/test/fixtures/experimental/logical-assignment-operator/qq-equals-no-plugin/options.json @@ -1,4 +1,3 @@ { - "plugins": ["nullishCoalescingOperator"], "throws": "This experimental syntax requires enabling the parser plugin: 'logicalAssignment' (1:2)" } diff --git a/packages/babel-parser/test/fixtures/experimental/logical-assignment-operator/qq-equals/options.json b/packages/babel-parser/test/fixtures/experimental/logical-assignment-operator/qq-equals/options.json old mode 100644 new mode 100755 index 6b07062568e2..5041dbb19f81 --- a/packages/babel-parser/test/fixtures/experimental/logical-assignment-operator/qq-equals/options.json +++ b/packages/babel-parser/test/fixtures/experimental/logical-assignment-operator/qq-equals/options.json @@ -1,3 +1,3 @@ { - "plugins": ["logicalAssignment", "nullishCoalescingOperator"] + "plugins": ["logicalAssignment"] } diff --git a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/and-nullish/options.json b/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/and-nullish/options.json deleted file mode 100644 index 1bb4736991a4..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/and-nullish/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "plugins": ["nullishCoalescingOperator"] -} diff --git a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/associativity/options.json b/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/associativity/options.json deleted file mode 100644 index 1bb4736991a4..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/associativity/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "plugins": ["nullishCoalescingOperator"] -} diff --git a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/expression/options.json b/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/expression/options.json deleted file mode 100644 index 1bb4736991a4..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/expression/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "plugins": ["nullishCoalescingOperator"] -} diff --git a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/multiline/options.json b/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/multiline/options.json deleted file mode 100644 index 1bb4736991a4..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/multiline/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "plugins": ["nullishCoalescingOperator"] -} diff --git a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/no-plugin-error/input.js b/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/no-plugin-error/input.js deleted file mode 100644 index ea99cb192c79..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/no-plugin-error/input.js +++ /dev/null @@ -1 +0,0 @@ -foo ?? 1; diff --git a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/no-plugin-error/options.json b/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/no-plugin-error/options.json deleted file mode 100644 index 9ae9a3d8a5d1..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/no-plugin-error/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "This experimental syntax requires enabling the parser plugin: 'nullishCoalescingOperator' (1:4)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/nullish-and/options.json b/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/nullish-and/options.json deleted file mode 100644 index 1bb4736991a4..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/nullish-and/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "plugins": ["nullishCoalescingOperator"] -} diff --git a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/nullish-or/options.json b/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/nullish-or/options.json deleted file mode 100644 index 1bb4736991a4..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/nullish-or/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "plugins": ["nullishCoalescingOperator"] -} diff --git a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/or-nullish/options.json b/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/or-nullish/options.json deleted file mode 100644 index 1bb4736991a4..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/nullish-coalescing-operator/or-nullish/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "plugins": ["nullishCoalescingOperator"] -}