Skip to content

[Bug]: checked-requires-onchange-or-readonly options are invertedΒ #3711

Open
@EvgenyOrekhov

Description

Is there an existing issue for this?

  • I have searched the existing issues and my issue is unique
  • My issue appears in the command-line and not only in the text editor

Description Overview

  • "ignoreMissingProperties": true works like false, and vice-versa
  • "ignoreExclusiveCheckedAttribute": true works like false, and vice-versa
{
    "react/checked-requires-onchange-or-readonly": [
      "error",
      {
        "ignoreMissingProperties": true,
        "ignoreExclusiveCheckedAttribute": true
      }
    ],
}
function My() {
  return (
    <>
      <input type="checkbox" checked />
      <input type="checkbox" checked defaultChecked />
      <input type="radio" checked defaultChecked />
    </>
  );
}

The rule gives warnings for the above code.

eslint .

Expected Behavior

  • The rule SHOULD NOT give warnings when options are set to true
  • The rule SHOULD give warnings when options are set to 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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions