From 1bb69dfd135eab3a83e5d5ed52bfd019f9917f35 Mon Sep 17 00:00:00 2001 From: fisker Cheung Date: Fri, 27 Sep 2024 17:57:44 +0800 Subject: [PATCH] Cleanup for meriyah parser (#16677) --- scripts/build/esbuild-plugins/throw-warnings.js | 4 +--- src/language-js/parse/postprocess/index.js | 16 ---------------- tests/config/run-format-test.js | 16 ---------------- 3 files changed, 1 insertion(+), 35 deletions(-) diff --git a/scripts/build/esbuild-plugins/throw-warnings.js b/scripts/build/esbuild-plugins/throw-warnings.js index cd6b064a7..6bd392943 100644 --- a/scripts/build/esbuild-plugins/throw-warnings.js +++ b/scripts/build/esbuild-plugins/throw-warnings.js @@ -119,15 +119,13 @@ export default function esbuildPluginThrowWarnings({ warning.location.file.startsWith("node_modules/") && (warning.text === 'The condition "default" here will never be used as it comes after both "import" and "require"' || - // meriyah + // `lines-and-columns` warning.text === 'The condition "types" here will never be used as it comes after both "import" and "require"') ) { continue; } - console.log(warning); - console.log(warning); throw new Error(warning.text); } diff --git a/src/language-js/parse/postprocess/index.js b/src/language-js/parse/postprocess/index.js index f148bc8b3..1af180438 100644 --- a/src/language-js/parse/postprocess/index.js +++ b/src/language-js/parse/postprocess/index.js @@ -97,22 +97,6 @@ function postprocess(ast, options) { ast.extra = { ...ast.extra, __isUsingHackPipeline: true }; break; - case "ExportAllDeclaration": - // TODO: Remove this when https://github.com/meriyah/meriyah/issues/200 get fixed - if (parser === "meriyah" && node.exported?.type === "Identifier") { - const { exported } = node; - const raw = text.slice(locStart(exported), locEnd(exported)); - if (raw.startsWith('"') || raw.startsWith("'")) { - node.exported = { - ...node.exported, - type: "Literal", - value: node.exported.name, - raw, - }; - } - } - break; - // In Flow parser, it doesn't generate union/intersection types for single type case "TSUnionType": case "TSIntersectionType": diff --git a/tests/config/run-format-test.js b/tests/config/run-format-test.js index f3b20c1b8..3a4865477 100644 --- a/tests/config/run-format-test.js +++ b/tests/config/run-format-test.js @@ -69,22 +69,6 @@ const acornDisabledTests = espreeDisabledTests; const meriyahDisabledTests = new Set([ ...espreeDisabledTests, ...[ - // Meriyah does not support decorator auto accessors syntax. - // But meriyah can parse it as an ordinary class property. - // So meriyah does not throw parsing error for it. - ...[ - "basic.js", - "computed.js", - "private.js", - "static-computed.js", - "static-private.js", - "static.js", - "with-semicolon-1.js", - "with-semicolon-2.js", - "comments.js", - ].map((filename) => `js/decorator-auto-accessors/${filename}`), - // https://github.com/meriyah/meriyah/issues/233 - "js/babel-plugins/decorator-auto-accessors.js", // Parsing to different ASTs "js/decorators/member-expression.js", // Meriyah parse RegExp relay on runtime behavior