Parser: improve error message when await is used in non-async functions or instead of async
Open
enhancement
- Dominant language
- JavaScript
- Stars
- 11.3k
- Forks
- 859
- Avg merge
- 1h 30m
- Merged PRs (30d)
- 3
Description
From https://x.com/jamonholmgren/status/1741906729477226534?s=20
- Better error message when the programmer accidentally wrote `await () =>` instead of `async() =>`
- Better error message for `await` when the programmer forgot to declare the surrounding function as async. These two errors compound in a funny way.
Contributor guide
Research direction
Start by locating Hermes parser diagnostics for `await` and `async` function declarations, then reproduce the two cases described: `await () =>` and `await` inside a non-async function. Done means each case produces a clearer, specific error message and the relevant parser tests cover both patterns.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100