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 for HOF returning only nulls and literals #3305

Merged
merged 1 commit into from
Aug 9, 2022

Conversation

golopot
Copy link
Contributor

@golopot golopot commented Jun 1, 2022

Fixes #3300.

This bug is caused by #3276.

Stop considering the following a component:

const f = (a) => () => {
  if (a) {
    return null;
  }
  return 1;
};

The bug is triggered when a literal like 1 or "a" is returned somewhere.

@codecov
Copy link

codecov bot commented Jun 1, 2022

Codecov Report

Merging #3305 (8e4d17a) into master (6b330b8) will decrease coverage by 0.23%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master    #3305      +/-   ##
==========================================
- Coverage   97.73%   97.49%   -0.24%     
==========================================
  Files         123      123              
  Lines        8862     8861       -1     
  Branches     3239     3238       -1     
==========================================
- Hits         8661     8639      -22     
- Misses        201      222      +21     
Impacted Files Coverage Δ
lib/util/Components.js 96.48% <ø> (-2.49%) ⬇️
lib/rules/no-unstable-nested-components.js 94.76% <0.00%> (-3.49%) ⬇️
lib/util/jsx.js 92.30% <0.00%> (-3.30%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@ljharb
Copy link
Member

ljharb commented Aug 5, 2022

Looks like after a rebase, there's some tests failing.

@ljharb ljharb marked this pull request as draft August 5, 2022 05:39
@golopot
Copy link
Contributor Author

golopot commented Aug 9, 2022

I have rebased the PR and removed some tests from the incoming commits.

@golopot golopot marked this pull request as ready for review August 9, 2022 11:34
@ljharb ljharb merged commit 8e4d17a into jsx-eslint:master Aug 9, 2022
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.

False-positive for react/display-name after 7.29.4 → 7.30.0 upgrade
2 participants