-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
[New] checkContextObjects
option in display-name
#3529
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3529 +/- ##
==========================================
+ Coverage 97.58% 97.59% +0.01%
==========================================
Files 131 132 +1
Lines 9236 9289 +53
Branches 3358 3394 +36
==========================================
+ Hits 9013 9066 +53
Misses 223 223
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall, this seems reasonable. Should this maybe be an option on the display-name
rule?
I think that makes sense, the intention is the same. Main difference is that |
while that's a fair point, since the rule is "display name" and not "component display name" i think it's worth figuring out the complexity inside the rule, rather than adding complexity for users. |
Alright makes sense, I turned it into a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a few lines missing test coverage; otherwise it looks pretty great!
Thanks! I noticed I forgot to enable the new flag for the new I'm a little confused how to increase the test coverage. What would need to be done to meet the threshold? Test the |
checkContextObjects
option in display-name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good overall
Hey, is there anything I can do to move this PR forward? |
@JulesBlm sorry for the delayed reply; i replied to your comment above and will review today. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great - I'll land this later tonight.
Awesome thanks for your review @ljharb! |
@ljharb Would you be able to push out a release with this feature? |
v7.33.0 is released. |
@ljharb https://www.npmjs.com/package/eslint-plugin-react still shows |
huh, maybe so, let me check |
ah thanks, published it manualy |
@ljharb that worked, thank you! |
I'm proposing adding a new rule that checks if the
displayName
property is set for context objects, seeContext.displayName
in the React docs.With multiple Context providers in an app, consistently setting a
displayName
makes it easy to see which is which in the React dev tools.Some things to consider
display-name
rule instead of a separate rule?