facebook / stylex

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

Errors displaying an error line and part of code #560

Open prc5 opened 2 months ago

prc5 commented 2 months ago

Describe the feature request

After using StyleX for some time, I think it would be great to have some more accurate error messages displaying details like error line and optionally part of the invalid code if that's possible?

Let's take this example:

// some-file.stylex.ts 

// dynamic/incorrect value for stylex
let displayValue = "flex";

const styles = stylex.create({
  base: {
    display: displayValue
  }
})

Current formatting:

Errror: Users/...path.../some-file.stylex.ts Only static values are allowed inside of a stylex.create() call.

New formatting:

Errror: Only static values are allowed inside of a stylex.create() call. Evaluating display: displayValue at Users/...path.../some-file.stylex.ts:43

With the new formatting:

In my opinion it would make the debugging experience a bit easier and intuitive. 🙏🏻

The current appearance of errors makes me a bit concerned about the "lack of control" over the state of the codebase when I am not receiving enough details. 😅