From 305eca0c0fb6f6f66b44d4d569ba05d22ce51dc6 Mon Sep 17 00:00:00 2001 From: catosaurusrex2003 Date: Wed, 13 Nov 2024 22:38:00 +0530 Subject: [PATCH] linting --- .../ApplicationErrorHandler/ErrorBoundary.tsx | 28 ++++++------------- library/src/containers/Error/Error.tsx | 2 +- 2 files changed, 10 insertions(+), 20 deletions(-) diff --git a/library/src/containers/ApplicationErrorHandler/ErrorBoundary.tsx b/library/src/containers/ApplicationErrorHandler/ErrorBoundary.tsx index 7919971b2..f1a802687 100644 --- a/library/src/containers/ApplicationErrorHandler/ErrorBoundary.tsx +++ b/library/src/containers/ApplicationErrorHandler/ErrorBoundary.tsx @@ -1,6 +1,6 @@ import React from 'react'; import { ReactNode } from 'react'; -import { ErrorBoundary } from 'react-error-boundary'; +import { ErrorBoundary, FallbackProps } from 'react-error-boundary'; import { ErrorObject } from '../../types'; import { Error } from '../Error/Error'; @@ -8,33 +8,23 @@ interface Props { children: ReactNode; } -interface FallbackProps { - error: any; - resetErrorBoundary?: (...args: any[]) => void; -} - -function fallbackRender({ error, resetErrorBoundary }: FallbackProps) { +function fallbackRender({ error }: FallbackProps) { const ErrorObject: ErrorObject = { - title: "Something went wrong", + title: 'Something went wrong', type: 'application-error', - validationErrors:[ + validationErrors: [ { - title:error.message, - } - ] + // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access + title: error?.message, + }, + ], }; return ; } const AsyncApiErrorBoundary = ({ children }: Props) => { - const onReset = (details: any) => { - // TODO: maybe some magic to recover the previous document ( the one without the error ) automatically - }; - return ( - - {children} - + {children} ); }; diff --git a/library/src/containers/Error/Error.tsx b/library/src/containers/Error/Error.tsx index de258ca38..e22618ea3 100644 --- a/library/src/containers/Error/Error.tsx +++ b/library/src/containers/Error/Error.tsx @@ -15,7 +15,7 @@ const renderErrors = (errors: ValidationError[]): React.ReactNode => { } return (
- {(singleError?.location?.startLine || + {(singleError?.location?.startLine ?? singleError?.location?.startOffset) && ( {`line ${singleError?.location?.startLine + singleError?.location?.startOffset}:`} )}