Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSX component error message improvements #7038

Merged
merged 11 commits into from
Sep 15, 2024

Conversation

zth
Copy link
Collaborator

@zth zth commented Sep 15, 2024

This tries to improve the error messages around JSX components by specializing them, instead of having them be the generic record error messages. It's a pre-cursor to improving the interface file mismatch error messages for components.

Some examples:
image
image
image

Part of #6975

@zth zth requested review from cknitt and cristianoc September 15, 2024 13:41
Copy link
Member

@cknitt cknitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is awesome! A big improvement!

@cristianoc
Copy link
Collaborator

Super valuable indeed!
Can you highlight prop1 in the second screenshot?

@cknitt
Copy link
Member

cknitt commented Sep 15, 2024

Something else regarding props highlighting: Currently, as seen in the third screenshot, for a non-existing prop, the prop value is highlighted, even though it is actually the prop name that is incorrect.

This behavior has already confused me quite a few times. Would it be possible to highlight the prop name instead?

@cknitt
Copy link
Member

cknitt commented Sep 15, 2024

Actually same in the first screenshot - the problem is not really the value, but the duplicate prop name.

@zth
Copy link
Collaborator Author

zth commented Sep 15, 2024

I've tried adjusting the loc used but it seems like something else is making that behavior not work right now. Maybe something in how we parse JSX. Anyway, I'll merge this now with the current behavior and we can do a follow up later on trying to adjust the locs/track down why it doesn't work.

@zth zth enabled auto-merge (squash) September 15, 2024 16:08
@zth zth merged commit fba122f into master Sep 15, 2024
19 checks passed
@zth zth deleted the jsx-component-error-message-improvements branch September 15, 2024 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants