Navigation Menu

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: Get rid of false position on component detection #2759

Merged
merged 1 commit into from Sep 20, 2021

Conversation

iiison
Copy link
Contributor

@iiison iiison commented Aug 15, 2020

Fixes #2751. Closes #2758.

Copy link
Contributor

@jzabala jzabala left a comment

Choose a reason for hiding this comment

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

Thanks for opening this PR @iiison 🎉

title: "URL",
dataIndex: "url",
key: "url",
render: url => (
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think that under any conditions this function should be considered a component. Maybe if the name were uppercase, since that is a pattern I have seen in some libraries, something like:

<MyComponent.Button />

But not this way. What do you think @ljharb ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought of the same thing after your last comment on the issue :D

I am a little new to this codebase. could you please point me to the file/logic where we're classifying the code as a component?

Copy link
Contributor

Choose a reason for hiding this comment

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

Sure, the main logic to detect components it at lib/util/Components.js.

I have the feeling this bug is in the function getStatelessComponent. You can start there. Hope it helps 🙂

https://github.com/yannickcr/eslint-plugin-react/blob/2588c4da026110a1c4f60bd8cd7bd0196446e8a1/lib/util/Components.js#L685

Copy link
Member

Choose a reason for hiding this comment

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

Yes, I agree. This shouldn't be a component.

@ljharb
Copy link
Member

ljharb commented Aug 30, 2020

Please unmark this as a draft when it's updated.

@ljharb ljharb marked this pull request as draft August 30, 2020 06:53
@ljharb ljharb changed the title Fix 2751 [Fix] display-name: Get rid of false position on component detection Oct 15, 2020
@k-yle
Copy link
Contributor

k-yle commented Nov 28, 2020

This also fixes #2758

@koengsen
Copy link

Hey Guys, any news on this one?

@ljharb ljharb marked this pull request as ready for review September 20, 2021 05:14
@codecov-commenter
Copy link

codecov-commenter commented Sep 20, 2021

Codecov Report

Merging #2759 (9799131) into master (53a0d84) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #2759   +/-   ##
=======================================
  Coverage   97.43%   97.43%           
=======================================
  Files         114      114           
  Lines        7536     7536           
  Branches     2750     2750           
=======================================
  Hits         7343     7343           
  Misses        193      193           
Impacted Files Coverage Δ
lib/rules/display-name.js 98.11% <100.00%> (ø)

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 53a0d84...9799131. Read the comment docs.

@ljharb ljharb merged commit 9799131 into jsx-eslint:master Sep 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
6 participants