Skip to content

[typescript-estree]: await in non-async function parses without error #987

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

Closed
kaicataldo opened this issue Sep 18, 2019 · 1 comment · Fixed by #988
Closed

[typescript-estree]: await in non-async function parses without error #987

kaicataldo opened this issue Sep 18, 2019 · 1 comment · Fixed by #988
Labels
bug Something isn't working package: typescript-estree Issues related to @typescript-eslint/typescript-estree

Comments

@kaicataldo
Copy link
Member

What code were you trying to parse?

function foo() {
  const bar = await baz();
}

AST Explorer link

What did you expect to happen?
Both espree and babel-eslint throw a parsing error when using await inside a non-async function. Should typescript-estree also throw an error here? It looks like an error is highlighted in the TypeScript Playground.

What actually happened?
Parses without error.

Versions

"@typescript-eslint/eslint-plugin": "^2.3.0",
"@typescript-eslint/parser": "^2.3.0",
"eslint": "^6.4.0",
"typescript": "^3.6.3"
package version
@typescript-eslint/typescript-estree 2.3.0
TypeScript 3.6.3
node 10.16.3
npm 6.11.3
@kaicataldo kaicataldo added package: typescript-estree Issues related to @typescript-eslint/typescript-estree triage Waiting for team members to take a look labels Sep 18, 2019
@kaicataldo
Copy link
Member Author

kaicataldo commented Sep 18, 2019

I'm seeing this with another error, so I'm now wondering if this is intentional (and is intended to be to caught by the TS compiler instead).

const foo = 1;
const foo = 2;

AST Explorer Link

espree reports the following parser error: Identifier 'foo' has already been declared

@typescript-eslint/typescript-estree doesn't throw a parse error.

@bradzacher bradzacher added bug Something isn't working and removed triage Waiting for team members to take a look labels Sep 18, 2019
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 21, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working package: typescript-estree Issues related to @typescript-eslint/typescript-estree
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants