Skip to content

Rename assertions/attributes in ImportExpression #305

@nicolo-ribaudo

Description

@nicolo-ribaudo

In import(src, { assert: { type: "json" }, somethingElse: true }), only { type: "json" } is the assertions bag. However, ESTree AST for the above code calls { assert: { type: "json" }, somethingElse: true } "assertions". The same happens with import attributes, where only the object stored in the with property is the attributes part.

It's probably too late to change the ESTree shape for import assertions, but maybe we could change it for import attributes by renaming assertions to a more generic options?

extend interface ImportExpression {
    options: Expression | null;
}

cc @xtuc since you maintain the only existing ESTree-compatible parser for import attributes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions