From fc6fab5f7443830f950f71fc49b72498e8a3ec3e Mon Sep 17 00:00:00 2001 From: Alexey Pyltsyn Date: Wed, 26 Oct 2022 19:50:10 +0300 Subject: [PATCH 1/2] fix(ideal-image): do not pass down `img` prop --- .../src/theme/IdealImage/index.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/docusaurus-plugin-ideal-image/src/theme/IdealImage/index.tsx b/packages/docusaurus-plugin-ideal-image/src/theme/IdealImage/index.tsx index fbf2d3278a9b..2e0f8a557b3a 100644 --- a/packages/docusaurus-plugin-ideal-image/src/theme/IdealImage/index.tsx +++ b/packages/docusaurus-plugin-ideal-image/src/theme/IdealImage/index.tsx @@ -81,7 +81,7 @@ function getMessage(icon: IconKey, state: State) { } export default function IdealImage(props: Props): JSX.Element { - const {alt, className, img} = props; + const {alt, className, img, ...propsRest} = props; // In dev env just use regular img with original file if (typeof img === 'string' || 'default' in img) { @@ -90,14 +90,14 @@ export default function IdealImage(props: Props): JSX.Element { src={typeof img === 'string' ? img : img.default} className={className} alt={alt} - {...props} + {...propsRest} /> ); } return ( Date: Wed, 26 Oct 2022 20:06:45 +0300 Subject: [PATCH 2/2] Simplify code --- .../src/theme/IdealImage/index.tsx | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/packages/docusaurus-plugin-ideal-image/src/theme/IdealImage/index.tsx b/packages/docusaurus-plugin-ideal-image/src/theme/IdealImage/index.tsx index 2e0f8a557b3a..8886a6e7992e 100644 --- a/packages/docusaurus-plugin-ideal-image/src/theme/IdealImage/index.tsx +++ b/packages/docusaurus-plugin-ideal-image/src/theme/IdealImage/index.tsx @@ -81,25 +81,19 @@ function getMessage(icon: IconKey, state: State) { } export default function IdealImage(props: Props): JSX.Element { - const {alt, className, img, ...propsRest} = props; + const {img, ...propsRest} = props; // In dev env just use regular img with original file if (typeof img === 'string' || 'default' in img) { return ( - {alt} + // eslint-disable-next-line jsx-a11y/alt-text + ); } return (