From a1a261ce6060b1fed0e30d652b8aa7fb82e69d15 Mon Sep 17 00:00:00 2001 From: alansemenov Date: Mon, 23 Sep 2024 17:14:15 +0200 Subject: [PATCH] Fix linting issues #35 --- src/RichText/ErrorBoundary/ErrorBoundaryClient.tsx | 2 +- src/RichText/ErrorComponent.tsx | 3 --- src/RichText/Link.tsx | 1 - src/RichText/Macro.tsx | 3 --- src/RichText/cssToReactStyle.ts | 4 +++- src/RichText/replaceImage.tsx | 1 - src/RichText/replaceLink.tsx | 1 - src/RichText/replaceMacro.tsx | 1 - 8 files changed, 4 insertions(+), 12 deletions(-) diff --git a/src/RichText/ErrorBoundary/ErrorBoundaryClient.tsx b/src/RichText/ErrorBoundary/ErrorBoundaryClient.tsx index c188bad..963ce5f 100644 --- a/src/RichText/ErrorBoundary/ErrorBoundaryClient.tsx +++ b/src/RichText/ErrorBoundary/ErrorBoundaryClient.tsx @@ -25,7 +25,7 @@ class ErrorBoundary extends Component { return {hasError: true}; } - componentDidCatch(error, errorInfo) { + componentDidCatch(error, _errorInfo) { // Log the error to an error reporting service console this.setState({error}); } diff --git a/src/RichText/ErrorComponent.tsx b/src/RichText/ErrorComponent.tsx index adfc78f..2bcf399 100644 --- a/src/RichText/ErrorComponent.tsx +++ b/src/RichText/ErrorComponent.tsx @@ -1,9 +1,6 @@ import type {ReactNode} from 'react'; -import React from 'react'; - - export function ErrorComponent({ children, }: { diff --git a/src/RichText/Link.tsx b/src/RichText/Link.tsx index aba8fa9..3f7480f 100644 --- a/src/RichText/Link.tsx +++ b/src/RichText/Link.tsx @@ -1,7 +1,6 @@ import type {LinkComponentParams} from '../types'; -// import React from 'react'; // import {parse} from 'uri-js'; diff --git a/src/RichText/Macro.tsx b/src/RichText/Macro.tsx index 119a907..cf008cd 100644 --- a/src/RichText/Macro.tsx +++ b/src/RichText/Macro.tsx @@ -1,6 +1,3 @@ -// import React from 'react'; - - import type {MacroComponentParams} from '../types'; export function Macro({ diff --git a/src/RichText/cssToReactStyle.ts b/src/RichText/cssToReactStyle.ts index 536e06a..4df54af 100644 --- a/src/RichText/cssToReactStyle.ts +++ b/src/RichText/cssToReactStyle.ts @@ -1,10 +1,12 @@ +import React from 'react'; + export function cssToReactStyle(cssString?: string): React.CSSProperties { if (!cssString) { return {}; } - const styleObject: React.CSSProperties = {}; + const styleObject: Record = {}; const rules = cssString.split(';'); rules.forEach((rule) => { diff --git a/src/RichText/replaceImage.tsx b/src/RichText/replaceImage.tsx index 0ed888a..2f8c6c1 100644 --- a/src/RichText/replaceImage.tsx +++ b/src/RichText/replaceImage.tsx @@ -2,7 +2,6 @@ import type {Element} from 'domhandler'; import type {ImageComponent, ImageData, ImageComponentParams} from '../types'; -import React from 'react'; import {IMG_ATTR} from '../constants'; import {cssToReactStyle} from './cssToReactStyle'; import {ErrorComponent} from './ErrorComponent'; diff --git a/src/RichText/replaceLink.tsx b/src/RichText/replaceLink.tsx index bb2358e..f108b43 100644 --- a/src/RichText/replaceLink.tsx +++ b/src/RichText/replaceLink.tsx @@ -3,7 +3,6 @@ import type {DOMNode} from 'html-react-parser'; import {domToReact} from 'html-react-parser'; import type {LinkComponent, ImageComponent, MacroComponent, Replacer, RichTextData, LinkComponentParams} from '../types'; import type {createReplacer as CreateReplacer} from './createReplacer'; -import React from 'react'; import {LINK_ATTR} from '../constants'; import {ErrorComponent} from './ErrorComponent'; import {ErrorBoundaryWrapper} from './ErrorBoundary/ErrorBoundaryWrapper'; diff --git a/src/RichText/replaceMacro.tsx b/src/RichText/replaceMacro.tsx index 857b70b..8ba8f0f 100644 --- a/src/RichText/replaceMacro.tsx +++ b/src/RichText/replaceMacro.tsx @@ -2,7 +2,6 @@ import type {Element} from 'domhandler'; import type {MacroComponent, MacroComponentParams, RichTextData, ImageComponent, LinkComponent, Replacer} from '../types'; -import React from 'react'; import {MACRO_ATTR} from '../constants'; import {ErrorComponent} from './ErrorComponent'; import {domToReact, type DOMNode} from 'html-react-parser';