Skip to content

Commit 8e07874

Browse files
MNBuyskihljharb
authored andcommitted
[Fix] no-unknown-property: add viewBox for pattern, symbol, view
Fixes #3426.
1 parent fd90b0e commit 8e07874

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

CHANGELOG.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,13 @@ This change log adheres to standards from [Keep a CHANGELOG](https://keepachange
1111
* [`no-unknown-property`]: allow `onLoad` on `<object>` ([#3415][] @OleksiiKachan)
1212
* [`no-multi-comp`]: do not detect a function property returning only null as a component ([#3412][] @ljharb)
1313
* [`no-unknown-property`]: allow `abbr` on `<th>` and `<td>` ([#3419][] @OleksiiKachan)
14+
* [`no-unknown-property`]: add `viewBox` for `pattern`, `symbol`, `view` ([#3424][] @MNBuyskih)
1415

1516
### Changed
1617

17-
* [Meta] npmignore markdownlint config ([#3413][] @jorrit)
18+
* [meta] npmignore markdownlint config ([#3413][] @jorrit)
1819

20+
[#3424]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3424
1921
[#3419]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3419
2022
[#3416]: https://github.com/jsx-eslint/eslint-plugin-react/issues/3416
2123
[#3415]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3415

lib/rules/no-unknown-property.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ const ATTRIBUTE_TAGS_MAP = {
6363
imageSizes: ['link'],
6464
imageSrcSet: ['link'],
6565
property: ['meta'],
66-
viewBox: ['svg', 'marker'],
66+
viewBox: ['marker', 'pattern', 'svg', 'symbol', 'view'],
6767
as: ['link'],
6868
valign: ['tr', 'td', 'th', 'thead', 'tbody', 'tfoot', 'colgroup', 'col'], // deprecated, but known
6969
noModule: ['script'],

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

+3
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,9 @@ ruleTester.run('no-unknown-property', rule, {
123123
{ code: '<video controlsList="nodownload" controls={this.controls} loop={true} muted={false} src={this.videoSrc} playsInline={true}></video>' },
124124
{ 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>' },
125125
{ code: '<marker id={markerId} viewBox="0 0 2 2" refX="1" refY="1" markerWidth="1" markerHeight="1" orient="auto" />' },
126+
{ code: '<pattern id="pattern" viewBox="0,0,10,10" width="10%" height="10%" />' },
127+
{ code: '<symbol id="myDot" width="10" height="10" viewBox="0 0 2 2" />' },
128+
{ code: '<view id="one" viewBox="0 0 100 100" />' },
126129
{
127130
code: `
128131
<table>

0 commit comments

Comments
 (0)