Skip to content

Commit fca6a44

Browse files
committed
[Fix] no-unknown-property: ensure not to report unknown-property in onResize
1 parent de82efe commit fca6a44

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
@@ -91,6 +91,7 @@ const ATTRIBUTE_TAGS_MAP = {
9191
onPlaying: ['audio', 'video'],
9292
onProgress: ['audio', 'video'],
9393
onRateChange: ['audio', 'video'],
94+
onResize: ['audio', 'video'],
9495
onSeeked: ['audio', 'video'],
9596
onSeeking: ['audio', 'video'],
9697
onStalled: ['audio', 'video'],
@@ -294,7 +295,7 @@ const DOM_PROPERTY_NAMES_TWO_WORDS = [
294295
'onBeforeInput', 'onChange',
295296
'onInvalid', 'onReset', 'onTouchCancel', 'onTouchEnd', 'onTouchMove', 'onTouchStart', 'suppressContentEditableWarning', 'suppressHydrationWarning',
296297
'onAbort', 'onCanPlay', 'onCanPlayThrough', 'onDurationChange', 'onEmptied', 'onEncrypted', 'onEnded',
297-
'onLoadedData', 'onLoadedMetadata', 'onLoadStart', 'onPause', 'onPlay', 'onPlaying', 'onProgress', 'onRateChange',
298+
'onLoadedData', 'onLoadedMetadata', 'onLoadStart', 'onPause', 'onPlay', 'onPlaying', 'onProgress', 'onRateChange', 'onResize',
298299
'onSeeked', 'onSeeking', 'onStalled', 'onSuspend', 'onTimeUpdate', 'onVolumeChange', 'onWaiting',
299300
'onCopyCapture', 'onCutCapture', 'onPasteCapture', 'onCompositionEndCapture', 'onCompositionStartCapture', 'onCompositionUpdateCapture',
300301
'onFocusCapture', 'onBlurCapture', 'onChangeCapture', 'onBeforeInputCapture', 'onInputCapture', 'onResetCapture', 'onSubmitCapture',

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

+10-1
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ ruleTester.run('no-unknown-property', rule, {
126126
{ code: '<link as="audio">Audio content</link>' },
127127
{ code: '<video controlsList="nodownload" controls={this.controls} loop={true} muted={false} src={this.videoSrc} playsInline={true}></video>' },
128128
{ 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>' },
129+
{ code: '<video onResize={this.onResize} />' },
129130
{ code: '<marker id={markerId} viewBox="0 0 2 2" refX="1" refY="1" markerWidth="1" markerHeight="1" orient="auto" />' },
130131
{ code: '<pattern id="pattern" viewBox="0,0,10,10" width="10%" height="10%" />' },
131132
{ code: '<symbol id="myDot" width="10" height="10" viewBox="0 0 2 2" />' },
@@ -408,7 +409,7 @@ ruleTester.run('no-unknown-property', rule, {
408409
],
409410
},
410411
{
411-
code: '<div onAbort={this.abort} onDurationChange={this.durationChange} onEmptied={this.emptied} onEnded={this.end} onError={this.error} />',
412+
code: '<div onAbort={this.abort} onDurationChange={this.durationChange} onEmptied={this.emptied} onEnded={this.end} onResize={this.resize} onError={this.error} />',
412413
errors: [
413414
{
414415
messageId: 'invalidPropOnTag',
@@ -442,6 +443,14 @@ ruleTester.run('no-unknown-property', rule, {
442443
allowedTags: 'audio, video',
443444
},
444445
},
446+
{
447+
messageId: 'invalidPropOnTag',
448+
data: {
449+
name: 'onResize',
450+
tagName: 'div',
451+
allowedTags: 'audio, video',
452+
},
453+
},
445454
{
446455
messageId: 'invalidPropOnTag',
447456
data: {

0 commit comments

Comments
 (0)