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

trace-deps: Add ecmaVersion to all parse calls. #2

Closed
ryan-roemer opened this issue Aug 11, 2022 · 0 comments · Fixed by #10 or #11
Closed

trace-deps: Add ecmaVersion to all parse calls. #2

ryan-roemer opened this issue Aug 11, 2022 · 0 comments · Fixed by #10 or #11
Labels
bug Something isn't working

Comments

@ryan-roemer
Copy link
Member

We're getting this warning in tests:

Since Acorn 8.0.0, options.ecmaVersion is required.
Defaulting to 2020, but this will stop working in the future.

Need:

diff --git a/packages/trace-deps/lib/trace.js b/packages/trace-deps/lib/trace.js
index bce66bd..5a96095 100644
--- a/packages/trace-deps/lib/trace.js
+++ b/packages/trace-deps/lib/trace.js
@@ -543,7 +543,7 @@ const traceFile = async ({
   } catch (modErr) {
     // Then as script.
     try {
-      ast = parse(src, { sourceType: "script", locations: true, onComment });
+      ast = parse(src, { sourceType: "script", ecmaVersion: "latest", locations: true, onComment });
     } catch (scriptErr) {
       // Use original module error, with some helper errors.
       throw new Error(`Encountered parse error in ${srcPath}: ${modErr}`);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
1 participant