Skip to content

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

Description

@ryan-roemer

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}`);

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions