Skip to content

Commit 6128f9a

Browse files
committed
[Fix] no-unknown-property: support checked on inputs
Fixes #3383
1 parent b4d14ce commit 6128f9a

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ This change log adheres to standards from [Keep a CHANGELOG](https://keepachange
55

66
## Unreleased
77

8+
### Fixed
9+
* [`no-unknown-property`]: support `checked` on inputs ([#3383][] @ljharb)
10+
11+
[#3383]: https://github.com/jsx-eslint/eslint-plugin-react/issues/3383
12+
813
## [7.31.3] - 2022.09.03
914

1015
### Fixed

lib/rules/no-unknown-property.js

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ const DOM_ATTRIBUTE_NAMES = {
2727
};
2828

2929
const ATTRIBUTE_TAGS_MAP = {
30+
checked: ['input'],
3031
// image is required for SVG support, all other tags are HTML.
3132
crossOrigin: ['script', 'img', 'video', 'audio', 'link', 'image'],
3233
fill: ['svg'],

tests/lib/rules/no-unknown-property.js

+1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ ruleTester.run('no-unknown-property', rule, {
5252
{ code: '<button disabled>You cannot click me</button>;' },
5353
{ 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>' },
5454
{ code: '<meta property="og:type" content="website" />' },
55+
{ code: '<input type="checkbox" checked={checked} disabled={disabled} id={id} onChange={onChange} />' },
5556
// Case ignored attributes, for `charset` discussion see https://github.com/jsx-eslint/eslint-plugin-react/pull/1863
5657
{ code: '<meta charset="utf-8" />;' },
5758
{ code: '<meta charSet="utf-8" />;' },

0 commit comments

Comments
 (0)