-
-
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 checked-requires-onchange-or-readonly
rule
#3680
[New] add checked-requires-onchange-or-readonly
rule
#3680
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #3680 +/- ##
=======================================
Coverage 97.74% 97.75%
=======================================
Files 132 133 +1
Lines 9420 9458 +38
Branches 3456 3464 +8
=======================================
+ Hits 9208 9246 +38
Misses 212 212 ☔ View full report in Codecov by Sentry. |
Can you elaborate on why? |
Sorry I'm no good at English. Are you asking about why this rule is necessary? If it is, the answer is that there have been some times, using <tr onClick={toggleChecked}>
<td>
<input type='checkbox' checked={checked}/>
</td>
</tr> Since there were no warns in the editor, I found bunch of red messages in the console later. |
Yes - but why would a checkbox always need to have an onChange or readOnly? If that's not a valid use case, why doesn't React warn on it? What's wrong with a checkbox that doesn't have any behavior - perhaps it's part of a larger form that gets submitted normally. |
Checkbox doesn't need to have one of them always. The rule is checking I'm confusing, didnt' you labled |
So... do you think is it good to go or no? I can close the pr if it's not |
Thanks for the reminder, that was 3 years ago :-) Let me give it a rereview. |
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.
The only comment that's a blocker is the coverage one, i can clean up the rest if you don't feel like it :-)
Sure, appreciate it 😊 |
3dfaaeb
to
381c7c1
Compare
381c7c1
to
b70a926
Compare
checked-requires-onchange-or-readonly
checked-requires-onchange-or-readonly
rule
b70a926
to
b9292b4
Compare
Resolved #3143
Hi, I added a new rule to enforce using
onChange
,readOnly
props withchecked
.How is it? And, any better naming for this rule?