From a2ec87d3591270e6a51fa9754a48e84b06b6cf15 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Sat, 3 Sep 2022 21:28:52 -0700 Subject: [PATCH] [Fix] `no-unknown-property`: `children` is always an acceptable prop; iframes have `scrolling`; video has `playsInline` --- CHANGELOG.md | 1 + lib/rules/no-unknown-property.js | 4 +++- tests/lib/rules/no-unknown-property.js | 3 +++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e804b5915..cfddf0d60f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ This change log adheres to standards from [Keep a CHANGELOG](https://keepachange * [`no-unknown-property`]: add properties `onToggle`, `fill`, `as`, and pointer events ([#3385][] @sjarva) * [`no-unknown-property`]: add `defaultChecked` property ([#3385][] @sjarva) * [`no-unknown-property`]: add touch and media event related properties ([#3385][] @sjarva) +* [`no-unknown-property`]: `children` is always an acceptable prop; iframes have `scrolling`; ; video has `playsInline` ([#3385][] @ljharb) [#3385]: https://github.com/jsx-eslint/eslint-plugin-react/issues/3385 diff --git a/lib/rules/no-unknown-property.js b/lib/rules/no-unknown-property.js index af7dc1e2ed..a7bd0291ec 100644 --- a/lib/rules/no-unknown-property.js +++ b/lib/rules/no-unknown-property.js @@ -79,6 +79,8 @@ const ATTRIBUTE_TAGS_MAP = { onTimeUpdate: ['audio', 'video'], onVolumeChange: ['audio', 'video'], onWaiting: ['audio', 'video'], + scrolling: ['iframe'], + playsInline: ['video'], }; const SVGDOM_ATTRIBUTE_NAMES = { @@ -195,7 +197,7 @@ const DOM_PROPERTY_NAMES_ONE_WORD = [ // OpenGraph meta tag attributes 'property', // React specific attributes - 'ref', 'key', + 'ref', 'key', 'children', ]; const DOM_PROPERTY_NAMES_TWO_WORDS = [ diff --git a/tests/lib/rules/no-unknown-property.js b/tests/lib/rules/no-unknown-property.js index 0e8901a3c8..1396534600 100644 --- a/tests/lib/rules/no-unknown-property.js +++ b/tests/lib/rules/no-unknown-property.js @@ -48,12 +48,15 @@ ruleTester.run('no-unknown-property', rule, { { code: 'A cat sleeping on a keyboard' }, { code: '' }, { code: '' }, + { code: '
' }, + { code: '