Skip to content

Commit

Permalink
Always enable recordAndTuple (#16264)
Browse files Browse the repository at this point in the history
  • Loading branch information
fisker committed May 11, 2024
1 parent f37cc03 commit 5518166
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
10 changes: 1 addition & 9 deletions src/language-js/parse/babel.js
Expand Up @@ -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";

Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions tests/format/misc/errors/js/__snapshots__/format.test.js.snap
Expand Up @@ -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`] = `
Expand Down

0 comments on commit 5518166

Please sign in to comment.