Skip to content

Commit a2ec87d

Browse files
committed
[Fix] no-unknown-property: children is always an acceptable prop; iframes have scrolling; video has playsInline
1 parent 7d4fe18 commit a2ec87d

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ This change log adheres to standards from [Keep a CHANGELOG](https://keepachange
99
* [`no-unknown-property`]: add properties `onToggle`, `fill`, `as`, and pointer events ([#3385][] @sjarva)
1010
* [`no-unknown-property`]: add `defaultChecked` property ([#3385][] @sjarva)
1111
* [`no-unknown-property`]: add touch and media event related properties ([#3385][] @sjarva)
12+
* [`no-unknown-property`]: `children` is always an acceptable prop; iframes have `scrolling`; ; video has `playsInline` ([#3385][] @ljharb)
1213

1314
[#3385]: https://github.com/jsx-eslint/eslint-plugin-react/issues/3385
1415

lib/rules/no-unknown-property.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ const ATTRIBUTE_TAGS_MAP = {
7979
onTimeUpdate: ['audio', 'video'],
8080
onVolumeChange: ['audio', 'video'],
8181
onWaiting: ['audio', 'video'],
82+
scrolling: ['iframe'],
83+
playsInline: ['video'],
8284
};
8385

8486
const SVGDOM_ATTRIBUTE_NAMES = {
@@ -195,7 +197,7 @@ const DOM_PROPERTY_NAMES_ONE_WORD = [
195197
// OpenGraph meta tag attributes
196198
'property',
197199
// React specific attributes
198-
'ref', 'key',
200+
'ref', 'key', 'children',
199201
];
200202

201203
const DOM_PROPERTY_NAMES_TWO_WORDS = [

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

+3
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,15 @@ ruleTester.run('no-unknown-property', rule, {
4848
{ code: '<img src="cat_keyboard.jpeg" alt="A cat sleeping on a keyboard" />' },
4949
{ code: '<input type="password" required />' },
5050
{ code: '<input ref={this.input} type="radio" />' },
51+
{ code: '<div children="anything" />' },
52+
{ code: '<iframe scrolling="?" />' },
5153
{ code: '<input key="bar" type="radio" />' },
5254
{ code: '<button disabled>You cannot click me</button>;' },
5355
{ 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>' },
5456
{ code: '<g fill="#7B82A0" fillRule="evenodd"></g>' },
5557
{ code: '<meta property="og:type" content="website" />' },
5658
{ code: '<input type="checkbox" checked={checked} disabled={disabled} id={id} onChange={onChange} />' },
59+
{ code: '<video playsInline />' },
5760
// React related attributes
5861
{ code: '<div onPointerDown={this.onDown} onPointerUp={this.onUp} />' },
5962
{ code: '<input type="checkbox" defaultChecked={this.state.checkbox} />' },

0 commit comments

Comments
 (0)