Skip to content

Commit 981d5d7

Browse files
committed
[Fix] no-unknown-property: allowed on element
1 parent 7ba7ec4 commit 981d5d7

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

lib/rules/no-unknown-property.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ const ATTRIBUTE_TAGS_MAP = {
6868
onEmptied: ['audio', 'video'],
6969
onEncrypted: ['audio', 'video'],
7070
onEnded: ['audio', 'video'],
71-
onError: ['audio', 'video', 'img', 'link', 'source', 'script'],
72-
onLoad: ['script', 'img', 'link'],
71+
onError: ['audio', 'video', 'img', 'link', 'source', 'script', 'picture'],
72+
onLoad: ['script', 'img', 'link', 'picture'],
7373
onLoadedData: ['audio', 'video'],
7474
onLoadedMetadata: ['audio', 'video'],
7575
onLoadStart: ['audio', 'video'],

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ ruleTester.run('no-unknown-property', rule, {
6060
{ code: '<input type="checkbox" checked={checked} disabled={disabled} id={id} onChange={onChange} />' },
6161
{ code: '<video playsInline />' },
6262
{ code: '<img onError={foo} onLoad={bar} />' },
63+
{ code: '<picture onError={foo} onLoad={bar} />' },
6364
{ code: '<script onLoad={bar} onError={foo} />' },
6465
{ code: '<source onError={foo} />' },
6566
{ code: '<link onLoad={bar} onError={foo} />' },
@@ -400,7 +401,7 @@ ruleTester.run('no-unknown-property', rule, {
400401
data: {
401402
name: 'onError',
402403
tagName: 'div',
403-
allowedTags: 'audio, video, img, link, source, script',
404+
allowedTags: 'audio, video, img, link, source, script, picture',
404405
},
405406
},
406407
],
@@ -413,7 +414,7 @@ ruleTester.run('no-unknown-property', rule, {
413414
data: {
414415
name: 'onLoad',
415416
tagName: 'div',
416-
allowedTags: 'script, img, link',
417+
allowedTags: 'script, img, link, picture',
417418
},
418419
},
419420
],

0 commit comments

Comments
 (0)