Display flow-parser errors like other parsers
- Dominant language
- JavaScript
- Stars
- 6.5k
- Forks
- 772
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
Right now the flow-parser appears to accept anything and spit out a bogus AST for bogus input.
But what's really happening is the `Program` node it generates also has an `errors` property containing the parse errors.
At some point I'll try to make a PR to fix this.
**To Reproduce**
Steps to reproduce the behavior:
1. Select `flow` parser
2. Enter code `type switch = number`
3. See output screenshot
**Expected behavior**
Something like babel does, "Unexpected token, expected ";" (1:5)" and line 1 highlighted in red
We should probably just make the flow parser wrapper check the `errors` property and throw something if there are errors. @fkling does AST explorer have infrastructure for displaying multiple error messages at once? If not we could just throw the first error.
And, is it possible to highlight errors in red but also still display the questionable AST output on the right?
**Screenshots**

**Browser (please complete the following information):**
irrelevant, happens on any browser
**astexplorer settings:**
- Selected parser: [e.g. flow]
- code: `type switch = number`
**Additional context**
This had been confusing me for awhile, I mistakenly thought that `flow-parser` was stupidly permissive until I noticed the `errors` property on the output AST
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.