Skip to content

Commit 5aac678

Browse files
committed
[Fix] no-unknown-property: ensure not to report unknown-property in onResize
1 parent 48318fa commit 5aac678

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

lib/rules/no-unknown-property.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ const ATTRIBUTE_TAGS_MAP = {
9393
onPlaying: ['audio', 'video'],
9494
onProgress: ['audio', 'video'],
9595
onRateChange: ['audio', 'video'],
96+
onResize: ['audio', 'video'],
9697
onSeeked: ['audio', 'video'],
9798
onSeeking: ['audio', 'video'],
9899
onStalled: ['audio', 'video'],
@@ -296,7 +297,7 @@ const DOM_PROPERTY_NAMES_TWO_WORDS = [
296297
'onBeforeInput', 'onChange',
297298
'onInvalid', 'onReset', 'onTouchCancel', 'onTouchEnd', 'onTouchMove', 'onTouchStart', 'suppressContentEditableWarning', 'suppressHydrationWarning',
298299
'onAbort', 'onCanPlay', 'onCanPlayThrough', 'onDurationChange', 'onEmptied', 'onEncrypted', 'onEnded',
299-
'onLoadedData', 'onLoadedMetadata', 'onLoadStart', 'onPause', 'onPlay', 'onPlaying', 'onProgress', 'onRateChange',
300+
'onLoadedData', 'onLoadedMetadata', 'onLoadStart', 'onPause', 'onPlay', 'onPlaying', 'onProgress', 'onRateChange', 'onResize',
300301
'onSeeked', 'onSeeking', 'onStalled', 'onSuspend', 'onTimeUpdate', 'onVolumeChange', 'onWaiting',
301302
'onCopyCapture', 'onCutCapture', 'onPasteCapture', 'onCompositionEndCapture', 'onCompositionStartCapture', 'onCompositionUpdateCapture',
302303
'onFocusCapture', 'onBlurCapture', 'onChangeCapture', 'onBeforeInputCapture', 'onInputCapture', 'onResetCapture', 'onSubmitCapture',

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

+10-1
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ ruleTester.run('no-unknown-property', rule, {
130130
{ code: '<link as="audio">Audio content</link>' },
131131
{ code: '<video controlsList="nodownload" controls={this.controls} loop={true} muted={false} src={this.videoSrc} playsInline={true}></video>' },
132132
{ code: '<audio controlsList="nodownload" controls={this.controls} crossOrigin="anonymous" disableRemotePlayback loop muted preload="none" src="something" onAbort={this.abort} onDurationChange={this.durationChange} onEmptied={this.emptied} onEnded={this.end} onError={this.error}></audio>' },
133+
{ code: '<video onResize={this.onResize} />' },
133134
{ code: '<marker id={markerId} viewBox="0 0 2 2" refX="1" refY="1" markerWidth="1" markerHeight="1" orient="auto" />' },
134135
{ code: '<pattern id="pattern" viewBox="0,0,10,10" width="10%" height="10%" />' },
135136
{ code: '<symbol id="myDot" width="10" height="10" viewBox="0 0 2 2" />' },
@@ -413,7 +414,7 @@ ruleTester.run('no-unknown-property', rule, {
413414
],
414415
},
415416
{
416-
code: '<div onAbort={this.abort} onDurationChange={this.durationChange} onEmptied={this.emptied} onEnded={this.end} onError={this.error} />',
417+
code: '<div onAbort={this.abort} onDurationChange={this.durationChange} onEmptied={this.emptied} onEnded={this.end} onResize={this.resize} onError={this.error} />',
417418
errors: [
418419
{
419420
messageId: 'invalidPropOnTag',
@@ -447,6 +448,14 @@ ruleTester.run('no-unknown-property', rule, {
447448
allowedTags: 'audio, video',
448449
},
449450
},
451+
{
452+
messageId: 'invalidPropOnTag',
453+
data: {
454+
name: 'onResize',
455+
tagName: 'div',
456+
allowedTags: 'audio, video',
457+
},
458+
},
450459
{
451460
messageId: 'invalidPropOnTag',
452461
data: {

0 commit comments

Comments
 (0)