Skip to content

Conform dynamic imports import('a') to the new ESTree spec #1950

@bradzacher

Description

@bradzacher

For this code example:

const x = import('module');

We currently emit the following AST (excluding the variable decl):

{
  "type": "CallExpression",
  "callee": {
    "type": "Import",
  },
  "arguments": [
    {
      "type": "Literal",
      "raw": "'a'",
      "value": "a",
    }
  ],
  "optional": false,
}

When we should be emitting this (as per the ESTree spec)

{
  "type": "ImportExpression",
  "source": {
    "type": "Literal",
    "value": "a",
    "raw": "'a'"
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    breaking changeThis change will require a new major version to be releasedenhancementNew feature or requestpackage: typescript-estreeIssues related to @typescript-eslint/typescript-estree

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions