@@ -46,29 +46,41 @@ ruleTester.run('no-unknown-property', rule, {
46
46
{ code : '<div onMouseDown={this._onMouseDown}></div>;' } ,
47
47
{ code : '<a href="someLink" download="foo">Read more</a>' } ,
48
48
{ code : '<area download="foo" />' } ,
49
- { code : '<img src="cat_keyboard.jpeg" alt="A cat sleeping on a keyboard" />' } ,
49
+ {
50
+ code : '<img src="cat_keyboard.jpeg" alt="A cat sleeping on a keyboard" />' ,
51
+ } ,
50
52
{ code : '<input type="password" required />' } ,
51
53
{ code : '<input ref={this.input} type="radio" />' } ,
52
54
{ code : '<div children="anything" />' } ,
53
55
{ code : '<iframe scrolling="?" onLoad={a} onError={b} />' } ,
54
56
{ code : '<input key="bar" type="radio" />' } ,
55
57
{ code : '<button disabled>You cannot click me</button>;' } ,
56
- { code : '<svg key="lock" viewBox="box" fill={10} d="d" stroke={1} strokeWidth={2} strokeLinecap={3} strokeLinejoin={4} transform="something" clipRule="else" x1={5} x2="6" y1="7" y2="8"></svg>' } ,
58
+ {
59
+ code : '<svg key="lock" viewBox="box" fill={10} d="d" stroke={1} strokeWidth={2} strokeLinecap={3} strokeLinejoin={4} transform="something" clipRule="else" x1={5} x2="6" y1="7" y2="8"></svg>' ,
60
+ } ,
57
61
{ code : '<g fill="#7B82A0" fillRule="evenodd"></g>' } ,
58
62
{ code : '<mask fill="#7B82A0"></mask>' } ,
59
63
{ code : '<meta property="og:type" content="website" />' } ,
60
- { code : '<input type="checkbox" checked={checked} disabled={disabled} id={id} onChange={onChange} />' } ,
64
+ {
65
+ code : '<input type="checkbox" checked={checked} disabled={disabled} id={id} onChange={onChange} />' ,
66
+ } ,
61
67
{ code : '<video playsInline />' } ,
62
68
{ code : '<img onError={foo} onLoad={bar} />' } ,
63
69
{ code : '<picture onError={foo} onLoad={bar} />' } ,
64
70
{ code : '<iframe onError={foo} onLoad={bar} />' } ,
65
71
{ code : '<script onLoad={bar} onError={foo} />' } ,
66
72
{ code : '<source onError={foo} />' } ,
67
73
{ code : '<link onLoad={bar} onError={foo} />' } ,
68
- { code : '<link rel="preload" as="image" href="someHref" imageSrcSet="someImageSrcSet" imageSizes="someImageSizes" />' } ,
74
+ {
75
+ code : '<link rel="preload" as="image" href="someHref" imageSrcSet="someImageSrcSet" imageSizes="someImageSizes" />' ,
76
+ } ,
69
77
{ code : '<object onLoad={bar} />' } ,
70
- { code : '<div allowFullScreen webkitAllowFullScreen mozAllowFullScreen />' } ,
78
+ {
79
+ code : '<div allowFullScreen webkitAllowFullScreen mozAllowFullScreen />' ,
80
+ } ,
71
81
{ code : '<table border="1" />' } ,
82
+ { code : '<th abbr="abbr" />' } ,
83
+ { code : '<td abbr="abbr" />' } ,
72
84
{
73
85
code : '<div allowTransparency="true" />' ,
74
86
settings : {
@@ -78,7 +90,9 @@ ruleTester.run('no-unknown-property', rule, {
78
90
// React related attributes
79
91
{ code : '<div onPointerDown={this.onDown} onPointerUp={this.onUp} />' } ,
80
92
{ code : '<input type="checkbox" defaultChecked={this.state.checkbox} />' } ,
81
- { code : '<div onTouchStart={this.startAnimation} onTouchEnd={this.stopAnimation} onTouchCancel={this.cancel} onTouchMove={this.move} onMouseMoveCapture={this.capture} onTouchCancelCapture={this.log} />' } ,
93
+ {
94
+ code : '<div onTouchStart={this.startAnimation} onTouchEnd={this.stopAnimation} onTouchCancel={this.cancel} onTouchMove={this.move} onMouseMoveCapture={this.capture} onTouchCancelCapture={this.log} />' ,
95
+ } ,
82
96
// Case ignored attributes, for `charset` discussion see https://github.com/jsx-eslint/eslint-plugin-react/pull/1863
83
97
{ code : '<meta charset="utf-8" />;' } ,
84
98
{ code : '<meta charSet="utf-8" />;' } ,
@@ -115,12 +129,20 @@ ruleTester.run('no-unknown-property', rule, {
115
129
{ code : '<audio crossOrigin />' } ,
116
130
{ code : '<svg focusable><image crossOrigin /></svg>' } ,
117
131
{ code : '<details onToggle={this.onToggle}>Some details</details>' } ,
118
- { code : '<path fill="pink" d="M 10,30 A 20,20 0,0,1 50,30 A 20,20 0,0,1 90,30 Q 90,60 50,90 Q 10,60 10,30 z"></path>' } ,
132
+ {
133
+ code : '<path fill="pink" d="M 10,30 A 20,20 0,0,1 50,30 A 20,20 0,0,1 90,30 Q 90,60 50,90 Q 10,60 10,30 z"></path>' ,
134
+ } ,
119
135
{ code : '<line fill="pink" x1="0" y1="80" x2="100" y2="20"></line>' } ,
120
136
{ code : '<link as="audio">Audio content</link>' } ,
121
- { code : '<video controlsList="nodownload" controls={this.controls} loop={true} muted={false} src={this.videoSrc} playsInline={true}></video>' } ,
122
- { 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>' } ,
123
- { code : '<marker id={markerId} viewBox="0 0 2 2" refX="1" refY="1" markerWidth="1" markerHeight="1" orient="auto" />' } ,
137
+ {
138
+ code : '<video controlsList="nodownload" controls={this.controls} loop={true} muted={false} src={this.videoSrc} playsInline={true}></video>' ,
139
+ } ,
140
+ {
141
+ 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>' ,
142
+ } ,
143
+ {
144
+ code : '<marker id={markerId} viewBox="0 0 2 2" refX="1" refY="1" markerWidth="1" markerHeight="1" orient="auto" />' ,
145
+ } ,
124
146
{
125
147
code : `
126
148
<table>
@@ -431,7 +453,8 @@ ruleTester.run('no-unknown-property', rule, {
431
453
data : {
432
454
name : 'onError' ,
433
455
tagName : 'div' ,
434
- allowedTags : 'audio, video, img, link, source, script, picture, iframe' ,
456
+ allowedTags :
457
+ 'audio, video, img, link, source, script, picture, iframe' ,
435
458
} ,
436
459
} ,
437
460
] ,
@@ -457,7 +480,8 @@ ruleTester.run('no-unknown-property', rule, {
457
480
data : {
458
481
name : 'fill' ,
459
482
tagName : 'div' ,
460
- allowedTags : 'altGlyph, circle, ellipse, g, line, mask, path, polygon, polyline, rect, svg, text, textPath, tref, tspan, use, animate, animateColor, animateMotion, animateTransform, set' ,
483
+ allowedTags :
484
+ 'altGlyph, circle, ellipse, g, line, mask, path, polygon, polyline, rect, svg, text, textPath, tref, tspan, use, animate, animateColor, animateMotion, animateTransform, set' ,
461
485
} ,
462
486
} ,
463
487
] ,
@@ -549,5 +573,18 @@ ruleTester.run('no-unknown-property', rule, {
549
573
} ,
550
574
] ,
551
575
} ,
576
+ {
577
+ code : '<div abbr="abbr" />' ,
578
+ errors : [
579
+ {
580
+ messageId : 'invalidPropOnTag' ,
581
+ data : {
582
+ name : 'abbr' ,
583
+ tagName : 'div' ,
584
+ allowedTags : 'th, td' ,
585
+ } ,
586
+ } ,
587
+ ] ,
588
+ } ,
552
589
] ) ,
553
590
} ) ;
0 commit comments