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

[Fix] sort-prop-types: Check for undefined before accessing node.typeAnnotation.typeAnnotation #3779

Merged
merged 1 commit into from
Jul 12, 2024

Conversation

tylerlaprade
Copy link
Contributor

Fixes the bug reported in this comment

Copy link
Member

@ljharb ljharb left a comment

Choose a reason for hiding this comment

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

We'll need a regression test before this fix can land.

@ljharb ljharb marked this pull request as draft July 8, 2024 22:15
@ljharb
Copy link
Member

ljharb commented Jul 12, 2024

@tylerlaprade can you share the code that errored in your linked comment?

@tylerlaprade
Copy link
Contributor Author

@ljharb, in a file with a .tsx extension, the following repros:

function Foo() {
  return <></>;
}

@ljharb ljharb force-pushed the undefined_node_param branch from 3e02d91 to 99d6a36 Compare July 12, 2024 18:04
@ljharb ljharb changed the title Check for undefined before accessing node.typeAnnotation [Fix] sort-prop-types: Check for undefined before accessing node.typeAnnotation.typeAnnotation Jul 12, 2024
@ljharb ljharb marked this pull request as ready for review July 12, 2024 18:05
Copy link

codecov bot commented Jul 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.49%. Comparing base (cef8123) to head (99d6a36).
Report is 6 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3779      +/-   ##
==========================================
- Coverage   97.62%   97.49%   -0.14%     
==========================================
  Files         134      134              
  Lines        9617     9634      +17     
  Branches     3488     3496       +8     
==========================================
+ Hits         9389     9393       +4     
- Misses        228      241      +13     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@tylerlaprade
Copy link
Contributor Author

Thanks for adding the test case! It looks like some snapshots need to be updated, but when I npm test locally, I don't see any failures.

@ljharb ljharb force-pushed the undefined_node_param branch from 99d6a36 to 67d73aa Compare July 12, 2024 18:33
@ljharb
Copy link
Member

ljharb commented Jul 12, 2024

we don't use snapshots :-) it's just that some of the test jobs don't support fragments. i switched it to a div instead.

@ljharb ljharb merged commit 67d73aa into jsx-eslint:master Jul 12, 2024
328 checks passed
@tylerlaprade tylerlaprade deleted the undefined_node_param branch July 12, 2024 23:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants