facebook / stylex

StyleX is the styling system for ambitious user interfaces.
https://stylexjs.com
MIT License
8.43k stars 309 forks source link

use code frames for errors for babel plugin #748

Closed EvanBacon closed 1 month ago

EvanBacon commented 1 month ago

What changed / motivation ?

Using code frame errors will show the dev generally where the problem is:

Additional Context

Screenshots, Tests, Anything Else

Screenshot 2024-10-14 at 7 31 59 PM

Pre-flight checklist

nmn commented 1 month ago

Thank you so much @EvanBacon

I was about to start working on this task myself, and your solution is honestly better than what I had in mind.

There is probably further improvements that can be made. Specifically, I'm working to expose the specific part of the code that is the problem for this, but this is already an improvement in the meantime.

EvanBacon commented 1 month ago

@nmn I think you should drive this. I just took a guess at where the errors are but I'm still getting used to stylex so I'm not sure what the DX should feel like. Specifically we point to the general path object when things go wrong, which is already an improvement, but it's possible that we could assert on the precise dynamic variables that are triggering the errors.

Will continue to brush up on stylex and the repo though so I can be more helpful in the future.

nmn commented 1 month ago

@EvanBacon Thank you for putting this up and getting it so far! I'll drive it from here.