Skip to content

Commit

Permalink
Ignore a eslint false positive
Browse files Browse the repository at this point in the history
  • Loading branch information
louischan-oursky committed Dec 19, 2024
1 parent 5e0c699 commit 43a96e2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
11 changes: 3 additions & 8 deletions portal/src/ErrorBoundSuspense.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,16 @@ import React, {
useState,
useEffect,
} from "react";
import { ErrorBoundary, ErrorBoundaryProps } from "@sentry/react";
import { ErrorBoundary, FallbackRender } from "@sentry/react";

export interface ErrorBoundSuspenseProps {
errorBoundaryFallback: NonNullable<ErrorBoundaryProps["fallback"]>;
errorBoundaryFallback: FallbackRender;
suspenseFallback: SuspenseProps["fallback"];
factory: () => Promise<{ default: React.ComponentType<any> }>;
children: (Component: React.ComponentType<any>) => React.ReactNode;
}

export interface ErrorBoundaryFallbackProps {
error: unknown;
componentStack: string;
eventId: string;
resetError(): void;
}
export type ErrorBoundaryFallbackProps = Parameters<FallbackRender>[0];

const extractImportArgRegex = /import\(["']([-_./a-zA-Z0-9]+)["']\)/;

Expand Down
8 changes: 8 additions & 0 deletions portal/src/FlavoredErrorBoundSuspense.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ export interface FlavoredErrorBoundSuspenseProps {
function FallbackComponent(
props: ErrorBoundaryFallbackProps
): React.ReactElement<any, any> {
// The definition of resetError is
// resetError(): void;
// instead of
// resetError: () => void;
// This makes TypeScript think it is method that could access this.
// But I think that is just a mistake in the type definition.
// So it should be safe to ignore.
// eslint-disable-next-line @typescript-eslint/unbound-method
const { resetError } = props;
const onClick = useCallback(
(e: React.MouseEvent<unknown>) => {
Expand Down

0 comments on commit 43a96e2

Please sign in to comment.