-
-
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] add no-object-type-as-default-prop
rule
#2848
[New] add no-object-type-as-default-prop
rule
#2848
Conversation
Co-authored-by: cyan33 <cyan.binary@gmail.com> Co-authored-by: fengkx <liangkx8237@gmail.com> Co-authored-by: Jordan Harband <ljharb@gmail.com>
1adfa98
to
3510760
Compare
cc @ljharb |
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.
LGTM minus the naming/prose concerns, the question about new Symbols, and the test parser comment
This new rule looked useful so I quickly tested it against +150 repositories. It seems to be crashing quite often on export default function() {
return <div />;
} I'm not sure if all crashes were caused by the same issue. You can find all results from here and log containing all crashing cases from here. |
@cyan33 ping :-) there's a few things to address |
3510760
to
e17848e
Compare
Sorry it took me a bit to get back to this 🙂 Updated:
|
e17848e
to
d9e3627
Compare
Ping @ljharb :) |
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, I think this looks good. After this pass, if my only feedback is docs prose, I'll tweak it myself prior to landing.
Is there anything more to be done before this rule can be release? It looks very useful. cc @ljharb |
@ljharb https://github.com/fengkx/eslint-plugin-react/tree/pr-2848-continue I rebased @cyan33 's branch to master branch and make chage according to the review comment. |
d9e3627
to
d66ea00
Compare
no-object-type-as-default-prop
rule
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 rule should use the Components.detect
utility rather than trying to implement its own component detection.
@fengkx thanks! this PR has been freshly rebased, and I updated the test conventions as well. The only missing piece here is to use |
Codecov Report
@@ Coverage Diff @@
## master #2848 +/- ##
=======================================
Coverage 97.54% 97.54%
=======================================
Files 127 128 +1
Lines 9066 9107 +41
Branches 3307 3320 +13
=======================================
+ Hits 8843 8883 +40
- Misses 223 224 +1
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
This branch switched the component detection to use I can't find any doc about the ping @ljharb |
Sure, it couldn't hurt to mention it in CONTRIBUTING.md. Thanks, the added commit looks good; i'll pull it in shortly. |
d66ea00
to
4cfe5d2
Compare
Discussed in
#2847
Test
shows no errors and warnings