Skip to content

Commit

Permalink
[Fix] no-unknown-property: support checked on inputs
Browse files Browse the repository at this point in the history
Fixes #3383
  • Loading branch information
ljharb committed Sep 3, 2022
1 parent b4d14ce commit 6128f9a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Expand Up @@ -5,6 +5,11 @@ This change log adheres to standards from [Keep a CHANGELOG](https://keepachange

## Unreleased

### Fixed
* [`no-unknown-property`]: support `checked` on inputs ([#3383][] @ljharb)

[#3383]: https://github.com/jsx-eslint/eslint-plugin-react/issues/3383

## [7.31.3] - 2022.09.03

### Fixed
Expand Down
1 change: 1 addition & 0 deletions lib/rules/no-unknown-property.js
Expand Up @@ -27,6 +27,7 @@ const DOM_ATTRIBUTE_NAMES = {
};

const ATTRIBUTE_TAGS_MAP = {
checked: ['input'],
// image is required for SVG support, all other tags are HTML.
crossOrigin: ['script', 'img', 'video', 'audio', 'link', 'image'],
fill: ['svg'],
Expand Down
1 change: 1 addition & 0 deletions tests/lib/rules/no-unknown-property.js
Expand Up @@ -52,6 +52,7 @@ ruleTester.run('no-unknown-property', rule, {
{ code: '<button disabled>You cannot click me</button>;' },
{ code: '<svg key="lock" viewBox="box" fill={10} d="d" stroke={1} strokeWidth={2} strokeLinecap={3} strokeLinejoin={4} transform="something" clipRule="else" x1={5} x2="6" y1="7" y2="8"></svg>' },
{ code: '<meta property="og:type" content="website" />' },
{ code: '<input type="checkbox" checked={checked} disabled={disabled} id={id} onChange={onChange} />' },
// Case ignored attributes, for `charset` discussion see https://github.com/jsx-eslint/eslint-plugin-react/pull/1863
{ code: '<meta charset="utf-8" />;' },
{ code: '<meta charSet="utf-8" />;' },
Expand Down

0 comments on commit 6128f9a

Please sign in to comment.