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] display-name: fix false positive when using memo #3304

Merged
merged 1 commit into from Jun 1, 2022

Conversation

golopot
Copy link
Contributor

@golopot golopot commented Jun 1, 2022

Fix #3303.

PR #3276 caused the following to be considered a component, while in v7.29.0 it is not considered a component:

const MemoizedMyComponent = React.memo(
  MyComponent,
  () => 1
)

This PR adds a check that the function being wrapped must return JSX to be considered a component.

The bug is so subtle and I am not sure this is the right way to fix it.

@codecov
Copy link

codecov bot commented Jun 1, 2022

Codecov Report

Merging #3304 (b9aa04b) into master (e7fc22f) will increase coverage by 0.01%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master    #3304      +/-   ##
==========================================
+ Coverage   97.69%   97.70%   +0.01%     
==========================================
  Files         123      123              
  Lines        8746     8746              
  Branches     3168     3168              
==========================================
+ Hits         8544     8545       +1     
+ Misses        202      201       -1     
Impacted Files Coverage Δ
lib/util/Components.js 98.91% <100.00%> (ø)
lib/util/jsx.js 95.60% <0.00%> (+1.09%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e7fc22f...b9aa04b. Read the comment docs.

ljharb
ljharb approved these changes Jun 1, 2022
Copy link
Member

@ljharb ljharb left a comment

Thanks!

@ljharb ljharb merged commit b9aa04b into jsx-eslint:master Jun 1, 2022
243 checks passed
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