Skip to content

[Fix] no-unknown-property viewBox for pattern, symbol, view #3424

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ This change log adheres to standards from [Keep a CHANGELOG](https://keepachange
* [`no-unknown-property`]: allow `onLoad` on `<object>` ([#3415][] @OleksiiKachan)
* [`no-multi-comp`]: do not detect a function property returning only null as a component ([#3412][] @ljharb)
* [`no-unknown-property`]: allow `abbr` on `<th>` and `<td>` ([#3419][] @OleksiiKachan)
* [`no-unknown-property`]: add `viewBox` for `pattern`, `symbol`, `view` ([#3424][] @MNBuyskih)

### Changed

* [Meta] npmignore markdownlint config ([#3413][] @jorrit)
* [meta] npmignore markdownlint config ([#3413][] @jorrit)

[#3424]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3424
[#3419]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3419
[#3416]: https://github.com/jsx-eslint/eslint-plugin-react/issues/3416
[#3415]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3415
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/no-unknown-property.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const ATTRIBUTE_TAGS_MAP = {
imageSizes: ['link'],
imageSrcSet: ['link'],
property: ['meta'],
viewBox: ['svg', 'marker'],
viewBox: ['marker', 'pattern', 'svg', 'symbol', 'view'],
as: ['link'],
valign: ['tr', 'td', 'th', 'thead', 'tbody', 'tfoot', 'colgroup', 'col'], // deprecated, but known
noModule: ['script'],
Expand Down
3 changes: 3 additions & 0 deletions tests/lib/rules/no-unknown-property.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@ ruleTester.run('no-unknown-property', rule, {
{ code: '<video controlsList="nodownload" controls={this.controls} loop={true} muted={false} src={this.videoSrc} playsInline={true}></video>' },
{ 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>' },
{ code: '<marker id={markerId} viewBox="0 0 2 2" refX="1" refY="1" markerWidth="1" markerHeight="1" orient="auto" />' },
{ code: '<pattern id="pattern" viewBox="0,0,10,10" width="10%" height="10%" />' },
{ code: '<symbol id="myDot" width="10" height="10" viewBox="0 0 2 2" />' },
{ code: '<view id="one" viewBox="0 0 100 100" />' },
{
code: `
<table>
Expand Down