-
-
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
[Bug]: checked-requires-onchange-or-readonly options are inverted #3711
Comments
1. It's buggy: jsx-eslint/eslint-plugin-react#3711 2. Its cases are already covered by react-form-fields plugin
lol that seems like such an obvious bug that i'm not sure i even believe it, but indeed the tests seem to indicate this. cc @jaesoekjjang |
hmm, actually - the tests specifically cover it, correctly: {
code: '<input type="checkbox" checked />',
options: [{ ignoreMissingProperties: true }],
},
{
code: '<input type="checkbox" checked={true} />',
options: [{ ignoreMissingProperties: true }],
},
{
code: '<input type="checkbox" onChange={noop} checked defaultChecked />',
options: [{ ignoreExclusiveCheckedAttribute: true }],
},
{
code: '<input type="checkbox" onChange={noop} checked={true} defaultChecked />',
options: [{ ignoreExclusiveCheckedAttribute: true }],
}, also, the defaults are that both are |
Given that the tests seem to contradict your OP, can you provide a repro repo? |
@ljharb Where do you see those tests? I see this: eslint-plugin-react/tests/lib/rules/checked-requires-onchange-or-readonly.js Lines 41 to 56 in da1013c
|
OMG... I named the options in reverse. What a mistake... my bad🥲 |
Renaming them seems more awkward than fixing the logic. |
Yeah.. negative naming will make more confusion. |
Is there an existing issue for this?
Description Overview
"ignoreMissingProperties": true
works likefalse
, and vice-versa"ignoreExclusiveCheckedAttribute": true
works likefalse
, and vice-versaThe rule gives warnings for the above code.
eslint .
Expected Behavior
true
false
false
should be the new default value for the options (to warn by default, as it is now)eslint-plugin-react version
v7.34.0
eslint version
v8.57.0
node version
v20.11.1
The text was updated successfully, but these errors were encountered: