diff --git a/CHANGELOG.md b/CHANGELOG.md index ff40414408..a7f3fcca62 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ This change log adheres to standards from [Keep a CHANGELOG](https://keepachange * [`no-unknown-property`]: add requireDataLowercase option ([#3645][] @HermanBilous) * [`no-unknown-property`]: add `displaystyle` on `` ([#3652][] @lounsbrough) * [`prefer-read-only-props`], [`prop-types`], component detection: allow components to be async functions ([#3654][] @pnodet) +* [`no-unknown-property`]: support `onResize` on audio/video tags ([#3662][] @caesar1030) ### Fixed * [`jsx-no-leaked-render`]: preserve RHS parens for multiline jsx elements while fixing ([#3623][] @akulsr0) @@ -24,6 +25,7 @@ This change log adheres to standards from [Keep a CHANGELOG](https://keepachange * [Refactor] [`jsx-props-no-multi-spaces`]: extract type parameters to var ([#3634][] @HenryBrown0) * [Docs] [`jsx-key`]: fix correct example ([#3656][] @developer-bandi) +[#3662]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3662 [#3656]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3656 [#3654]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3654 [#3652]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3652 diff --git a/lib/rules/no-unknown-property.js b/lib/rules/no-unknown-property.js index 2fc127b15f..51ec84572f 100644 --- a/lib/rules/no-unknown-property.js +++ b/lib/rules/no-unknown-property.js @@ -93,6 +93,7 @@ const ATTRIBUTE_TAGS_MAP = { onPlaying: ['audio', 'video'], onProgress: ['audio', 'video'], onRateChange: ['audio', 'video'], + onResize: ['audio', 'video'], onSeeked: ['audio', 'video'], onSeeking: ['audio', 'video'], onStalled: ['audio', 'video'], @@ -296,7 +297,7 @@ const DOM_PROPERTY_NAMES_TWO_WORDS = [ 'onBeforeInput', 'onChange', 'onInvalid', 'onReset', 'onTouchCancel', 'onTouchEnd', 'onTouchMove', 'onTouchStart', 'suppressContentEditableWarning', 'suppressHydrationWarning', 'onAbort', 'onCanPlay', 'onCanPlayThrough', 'onDurationChange', 'onEmptied', 'onEncrypted', 'onEnded', - 'onLoadedData', 'onLoadedMetadata', 'onLoadStart', 'onPause', 'onPlay', 'onPlaying', 'onProgress', 'onRateChange', + 'onLoadedData', 'onLoadedMetadata', 'onLoadStart', 'onPause', 'onPlay', 'onPlaying', 'onProgress', 'onRateChange', 'onResize', 'onSeeked', 'onSeeking', 'onStalled', 'onSuspend', 'onTimeUpdate', 'onVolumeChange', 'onWaiting', 'onCopyCapture', 'onCutCapture', 'onPasteCapture', 'onCompositionEndCapture', 'onCompositionStartCapture', 'onCompositionUpdateCapture', 'onFocusCapture', 'onBlurCapture', 'onChangeCapture', 'onBeforeInputCapture', 'onInputCapture', 'onResetCapture', 'onSubmitCapture', diff --git a/tests/lib/rules/no-unknown-property.js b/tests/lib/rules/no-unknown-property.js index 54c23785dd..0f4fbbebc1 100644 --- a/tests/lib/rules/no-unknown-property.js +++ b/tests/lib/rules/no-unknown-property.js @@ -128,8 +128,8 @@ ruleTester.run('no-unknown-property', rule, { { code: '' }, { code: '' }, { code: 'Audio content' }, - { code: '' }, - { code: '' }, + { code: '' }, + { code: '' }, { code: '' }, { code: '' }, { code: '' }, @@ -413,7 +413,7 @@ ruleTester.run('no-unknown-property', rule, { ], }, { - code: '
', + code: '
', errors: [ { messageId: 'invalidPropOnTag', @@ -447,6 +447,14 @@ ruleTester.run('no-unknown-property', rule, { allowedTags: 'audio, video', }, }, + { + messageId: 'invalidPropOnTag', + data: { + name: 'onResize', + tagName: 'div', + allowedTags: 'audio, video', + }, + }, { messageId: 'invalidPropOnTag', data: {