From 84384e2a95be58ae7b9e72c2c6fd4d8eb5bf28e4 Mon Sep 17 00:00:00 2001 From: Andrew Patton Date: Mon, 9 Dec 2024 18:21:00 -0800 Subject: [PATCH] [Fix] `no-unknown-property`: support `onBeforeToggle`, `popoverTarget`, `popoverTargetAction` attributes --- CHANGELOG.md | 5 +++++ lib/rules/no-unknown-property.js | 6 ++++-- tests/lib/rules/no-unknown-property.js | 9 +++++++++ 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a7b13f285b..904a29a460 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,11 @@ This change log adheres to standards from [Keep a CHANGELOG](https://keepachange ## Unreleased +### Fixed +* [`no-unknown-property`]: support `onBeforeToggle`, `popoverTarget`, `popoverTargetAction` attributes ([#3865][] @acusti) + +[#3865]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3865 + ## [7.37.3] - 2024.12.23 ### Fixed diff --git a/lib/rules/no-unknown-property.js b/lib/rules/no-unknown-property.js index 9a21c96fad..ad3a4e38f3 100644 --- a/lib/rules/no-unknown-property.js +++ b/lib/rules/no-unknown-property.js @@ -259,8 +259,8 @@ const DOM_PROPERTY_NAMES_TWO_WORDS = [ 'onCompositionUpdate', 'onCut', 'onDoubleClick', 'onDrag', 'onDragEnd', 'onDragEnter', 'onDragExit', 'onDragLeave', 'onError', 'onFocus', 'onInput', 'onKeyDown', 'onKeyPress', 'onKeyUp', 'onLoad', 'onWheel', 'onDragOver', 'onDragStart', 'onDrop', 'onMouseDown', 'onMouseEnter', 'onMouseLeave', 'onMouseMove', 'onMouseOut', 'onMouseOver', - 'onMouseUp', 'onPaste', 'onScroll', 'onSelect', 'onSubmit', 'onToggle', 'onTransitionEnd', 'radioGroup', 'readOnly', 'referrerPolicy', - 'rowSpan', 'srcDoc', 'srcLang', 'srcSet', 'useMap', 'fetchPriority', + 'onMouseUp', 'onPaste', 'onScroll', 'onSelect', 'onSubmit', 'onBeforeToggle', 'onToggle', 'onTransitionEnd', 'radioGroup', + 'readOnly', 'referrerPolicy', 'rowSpan', 'srcDoc', 'srcLang', 'srcSet', 'useMap', 'fetchPriority', // SVG attributes // See https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute 'crossOrigin', 'accentHeight', 'alignmentBaseline', 'arabicForm', 'attributeName', @@ -317,6 +317,8 @@ const DOM_PROPERTY_NAMES_TWO_WORDS = [ 'onMouseMoveCapture', 'onMouseOutCapture', 'onMouseOverCapture', 'onMouseUpCapture', // Video specific 'autoPictureInPicture', 'controlsList', 'disablePictureInPicture', 'disableRemotePlayback', + // popovers + 'popoverTarget', 'popoverTargetAction', ]; const DOM_PROPERTIES_IGNORE_CASE = ['charset', 'allowFullScreen', 'webkitAllowFullScreen', 'mozAllowFullScreen', 'webkitDirectory']; diff --git a/tests/lib/rules/no-unknown-property.js b/tests/lib/rules/no-unknown-property.js index 97ae42ea57..e746ef56bc 100644 --- a/tests/lib/rules/no-unknown-property.js +++ b/tests/lib/rules/no-unknown-property.js @@ -188,6 +188,15 @@ ruleTester.run('no-unknown-property', rule, { `, }, + { + code: ` +
+ + +
Greetings, one and all!
+
+ `, + }, ]), invalid: parsers.all([ {