rrdelaney / ReasonablyTyped

:diamond_shape_with_a_dot_inside: Converts Flow and TypeScript definitions to Reason interfaces
https://rrdelaney.github.io/ReasonablyTyped/
MIT License
518 stars 24 forks source link

Better CLI errors #34

Closed rrdelaney closed 7 years ago

rrdelaney commented 7 years ago

Here's what it looks like when the input has a syntax error:

screen shot 2017-08-14 at 10 38 50 pm

and here's what it looks like when the syntax is valid, but we can't produce output for some reason:

screen shot 2017-08-14 at 10 41 40 pm

These errors aren't friendly at all, and need to be cleaned up. A codeframe would be nice for parser errors, and when we can't generate output, a codeframe and a better explanation would be nice, as well as a link to our issue tracker šŸ˜„

Spec

Implementation details

This should happen at the JS level, not the compiler - somewhere in the CLI code. Something like babel-code-frame would do most of what we want for us as far as output goes. There might be some Reason code necessary to extract better errors from the Flow parser, possibly in retyped_node.re or the main JS interface index.js.

As always, I'm available to help in the ReasonML Discord or on here!

rrdelaney commented 7 years ago

Looking good!

screen shot 2017-08-26 at 9 16 46 am