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

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

Closed
bradzacher opened this issue Apr 28, 2020 · 0 comments · Fixed by #1389
Closed

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

bradzacher opened this issue Apr 28, 2020 · 0 comments · Fixed by #1389
Labels
breaking change This change will require a new major version to be released enhancement New feature or request package: typescript-estree Issues related to @typescript-eslint/typescript-estree
Milestone

Comments

@bradzacher
Copy link
Member

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'"
  }
}
@bradzacher bradzacher added bug Something isn't working package: typescript-estree Issues related to @typescript-eslint/typescript-estree breaking change This change will require a new major version to be released labels Apr 28, 2020
@bradzacher bradzacher added this to the 3.0.0 milestone Apr 28, 2020
@bradzacher bradzacher linked a pull request May 10, 2020 that will close this issue
4 tasks
@bradzacher bradzacher changed the title Correct handling of dynamic imports import('a') Conform dynamic imports import('a') to the new ESTree spec May 10, 2020
@bradzacher bradzacher added enhancement New feature or request and removed bug Something isn't working labels May 10, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
breaking change This change will require a new major version to be released enhancement New feature or request package: typescript-estree Issues related to @typescript-eslint/typescript-estree
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant