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

7$: Improve error message for 'await () => {}' #278

Closed
strager opened this issue May 10, 2021 · 2 comments · May be fixed by #498
Closed

7$: Improve error message for 'await () => {}' #278

strager opened this issue May 10, 2021 · 2 comments · May be fixed by #498
Assignees
Labels
for hire Get paid for working on this task: https://quick-lint-js.com/hiring.html

Comments

@strager
Copy link
Collaborator

strager commented May 10, 2021

Often, I accidentally type 'await' instead of 'async' for my async arrow functions:

function g() {
  f(await () => {
    await x;
  });
}

quick-lint-js reports errors for both await( and await x:

hello.js:3:5: error: 'await' is only allowed in async functions [E162]
hello.js:2:5: error: missing operator between expression and arrow function [E063]
hello.js:2:5: warning: use of undeclared variable: await [E057]

quick-lint-js should infer that async was intended, and provide a better error message (see below) and better error recovery (by assuming that the arrow function is async):

hello.js:2:5: error: 'await' does not create an async arrow function; use 'async' instead [E???]
@strager strager added the for hire Get paid for working on this task: https://quick-lint-js.com/hiring.html label May 10, 2021
@Coldtrain
Copy link

I claim this for-hire task. I expect payment after I complete this task. I will email the quick-lint-js team if I am assigned this task.

@strager
Copy link
Collaborator Author

strager commented Jul 26, 2022

This seems to be implemented already as E0178.

@strager strager closed this as completed Jul 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
for hire Get paid for working on this task: https://quick-lint-js.com/hiring.html
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants