From 2145e293eafae2164f0b5dfbcb8278c22f043ab8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paul=20O=E2=80=99Shannessy?= Date: Sun, 20 Mar 2022 17:45:31 -0700 Subject: [PATCH] [New] `no-unknown-property`: Allow crossOrigin on image tag (SVG) Fixes #3250 --- CHANGELOG.md | 2 ++ lib/rules/no-unknown-property.js | 3 ++- tests/lib/rules/no-unknown-property.js | 3 ++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 59623060b8..5bdec8dd6a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,11 +7,13 @@ This change log adheres to standards from [Keep a CHANGELOG](https://keepachange ### Added * [`destructuring-assignment`]: add option `destructureInSignature` ([#3235][] @golopot) +* [`no-unknown-property`]: Allow crossOrigin on image tag (SVG) ([#3251][] @zpao) ### Fixed * [`hook-use-state`]: Allow UPPERCASE setState setter prefixes ([#3244][] @duncanbeevers) * `propTypes`: add `VFC` to react generic type param map ([#3230][] @dlech) +[#3251]: https://github.com/yannickcr/eslint-plugin-react/pull/3251 [#3244]: https://github.com/yannickcr/eslint-plugin-react/pull/3244 [#3235]: https://github.com/yannickcr/eslint-plugin-react/pull/3235 [#3230]: https://github.com/yannickcr/eslint-plugin-react/issues/3230 diff --git a/lib/rules/no-unknown-property.js b/lib/rules/no-unknown-property.js index a1a155216c..7e5099347f 100644 --- a/lib/rules/no-unknown-property.js +++ b/lib/rules/no-unknown-property.js @@ -27,7 +27,8 @@ const DOM_ATTRIBUTE_NAMES = { }; const ATTRIBUTE_TAGS_MAP = { - crossOrigin: ['script', 'img', 'video', 'audio', 'link'], + // image is required for SVG support, all other tags are HTML. + crossOrigin: ['script', 'img', 'video', 'audio', 'link', 'image'], }; const SVGDOM_ATTRIBUTE_NAMES = { diff --git a/tests/lib/rules/no-unknown-property.js b/tests/lib/rules/no-unknown-property.js index c273ac7b2e..5191401f34 100644 --- a/tests/lib/rules/no-unknown-property.js +++ b/tests/lib/rules/no-unknown-property.js @@ -53,6 +53,7 @@ ruleTester.run('no-unknown-property', rule, { { code: '