mirror of
https://github.com/facebook/react.git
synced 2026-11-18 20:15:56 +00:00
18f7481ebf6db8103889c3ae051c41c2067355d5
This PR adapts the `Diagnostic` type and helpers from Relay Compiler to Forget. The main changes are: * Removing some fields it doesn't seem we'll use for a while, if ever (like machine-readable arbitrary key/value data) * Switching from Relay Compiler's `Location` type to our SourceRange type * Using the severity enum previously established in the `forget_build_hir` crate, with Todo/Unsupported/InvalidSyntax/InvalidReact/Invariant variants * Adding support for translating our `Diagnostic` into a `miette::Diagnostic` so we can use miette's pretty printing With the new Diagnostic type in place i updated the existing build_hir code to use it and confirmed that the errors are now even nicer (when we attach extra data to annotate labels): <img width="860" alt="Screenshot 2023-07-14 at 3 10 00 PM" src="https://github.com/facebook/react-forget/assets/6425824/9d29425a-938b-4872-b999-aa174a3c329a"> This addresses (or brings us closer to addressing) many of your comments on the last diagnostics PR, @poteto!
Languages
JavaScript
48.8%
Rust
26.4%
TypeScript
22.7%
HTML
1%
CSS
0.8%
Other
0.3%