diff --git a/src/language-js/parse/babel.js b/src/language-js/parse/babel.js index 3422ed293ef2..1b9e1d4f940b 100644 --- a/src/language-js/parse/babel.js +++ b/src/language-js/parse/babel.js @@ -50,14 +50,12 @@ const parseOptions = { "sourcePhaseImports", "deferredImportEvaluation", ["optionalChainingAssign", { version: "2023-07" }], + "recordAndTuple", ], tokens: true, ranges: true, }; -/** @type {ParserPlugin} */ -const recordAndTuplePlugin = ["recordAndTuple", { syntaxType: "hash" }]; - /** @type {ParserPlugin} */ const v8intrinsicPlugin = "v8intrinsic"; @@ -126,12 +124,6 @@ function createParse({ isExpression = false, optionsCombinations }) { })); } - if (/#[[{]/.test(text)) { - combinations = combinations.map((options) => - appendPlugins([recordAndTuplePlugin], options), - ); - } - const shouldEnableV8intrinsicPlugin = /%[A-Z]/.test(text); if (text.includes("|>")) { const conflictsPlugins = shouldEnableV8intrinsicPlugin diff --git a/tests/format/misc/errors/js/__snapshots__/format.test.js.snap b/tests/format/misc/errors/js/__snapshots__/format.test.js.snap index e96fd2edbef0..f6e769761fd7 100644 --- a/tests/format/misc/errors/js/__snapshots__/format.test.js.snap +++ b/tests/format/misc/errors/js/__snapshots__/format.test.js.snap @@ -159,10 +159,10 @@ Cause: Unexpected token (1:6)" `; exports[`snippet: #9 [babel] format 1`] = ` -"Unexpected token (1:2) +"Tuple expressions starting with '[|' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'. (1:1) > 1 | [| 1 |] - | ^ -Cause: Unexpected token (1:1)" + | ^ +Cause: Tuple expressions starting with '[|' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'. (1:0)" `; exports[`snippet: #10 [babel] format 1`] = `