Skip to content

Commit 0370974

Browse files
committed
fixed lint issue
Signed-off-by: Yi Cai <[email protected]>
1 parent 90f2664 commit 0370974

File tree

2 files changed

+26
-20
lines changed

2 files changed

+26
-20
lines changed

packages/app/src/components/Root/ApplicationListener.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,37 +20,37 @@ class ErrorBoundary extends Component<
2020
}
2121

2222
componentDidCatch(error: Error, errorInfo: ErrorInfo) {
23-
const { Component } = this.props;
24-
const name = Component.displayName ?? Component.name ?? 'Component';
23+
const { Component: Comp } = this.props;
24+
const name = Comp.displayName ?? Comp.name ?? 'Component';
2525
// eslint-disable-next-line no-console
2626
console.error(`Error in application/listener ${name}: ${error.message}`, {
2727
error,
2828
errorInfo,
29-
Component,
29+
Component: Comp,
3030
});
3131
}
3232

3333
render() {
34-
const { Component } = this.props;
34+
const { Component: Comp } = this.props;
3535
const { error } = this.state;
3636
if (error) {
37-
const name = Component.displayName ?? Component.name ?? 'Component';
37+
const name = Comp.displayName ?? Comp.name ?? 'Component';
3838
const title = `Error in application/listener ${name}: ${error.message}`;
3939
return <ErrorPanel title={title} error={error} />;
4040
}
41-
return <Component />;
41+
return <Comp />;
4242
}
4343
}
4444

4545
export const ApplicationListener = () => {
4646
const { mountPoints } = useContext(DynamicRootContext);
4747
const listeners = mountPoints['application/listener'] ?? [];
48-
return listeners.map(({ Component }, index) => {
48+
return listeners.map(({ Component: Comp }, index) => {
4949
return (
5050
<ErrorBoundary
5151
// eslint-disable-next-line react/no-array-index-key
5252
key={index}
53-
Component={Component}
53+
Component={Comp}
5454
/>
5555
);
5656
});

packages/app/src/components/Root/ApplicationProvider.tsx

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
1-
import { Component, ComponentType, ErrorInfo, PropsWithChildren, ReactNode, useContext, useMemo } from 'react';
1+
import {
2+
Component,
3+
ComponentType,
4+
ErrorInfo,
5+
PropsWithChildren,
6+
ReactNode,
7+
useContext,
8+
useMemo,
9+
} from 'react';
210

311
import { ErrorPanel } from '@backstage/core-components';
412

@@ -21,21 +29,21 @@ class ErrorBoundary extends Component<
2129
}
2230

2331
componentDidCatch(error: Error, errorInfo: ErrorInfo) {
24-
const { Component } = this.props;
25-
const name = Component.displayName ?? Component.name ?? 'Component';
32+
const { Component: Comp } = this.props;
33+
const name = Comp.displayName ?? Comp.name ?? 'Component';
2634
// eslint-disable-next-line no-console
2735
console.error(`Error in application/provider ${name}: ${error.message}`, {
2836
error,
2937
errorInfo,
30-
Component,
38+
Component: Comp,
3139
});
3240
}
3341

3442
render() {
35-
const { Component, children } = this.props;
43+
const { Component: Comp, children } = this.props;
3644
const { error } = this.state;
3745
if (error) {
38-
const name = Component.displayName ?? Component.name ?? 'Component';
46+
const name = Comp.displayName ?? Comp.name ?? 'Component';
3947
const title = `Error in application/provider ${name}: ${error.message}`;
4048
return (
4149
<>
@@ -44,13 +52,11 @@ class ErrorBoundary extends Component<
4452
</>
4553
);
4654
}
47-
return <Component>{children}</Component>;
55+
return <Comp>{children}</Comp>;
4856
}
4957
}
5058

51-
export const ApplicationProvider = ({
52-
children,
53-
}: PropsWithChildren<{}>) => {
59+
export const ApplicationProvider = ({ children }: PropsWithChildren<{}>) => {
5460
const { mountPoints } = useContext(DynamicRootContext);
5561
const providers = useMemo(
5662
() => mountPoints['application/provider'] ?? [],
@@ -59,12 +65,12 @@ export const ApplicationProvider = ({
5965
if (providers.length === 0) {
6066
return children;
6167
}
62-
return providers.reduceRight((acc, { Component }, index) => {
68+
return providers.reduceRight((acc, { Component: Comp }, index) => {
6369
return (
6470
<ErrorBoundary
6571
// eslint-disable-next-line react/no-array-index-key
6672
key={index}
67-
Component={Component}
73+
Component={Comp}
6874
>
6975
{acc}
7076
</ErrorBoundary>

0 commit comments

Comments
 (0)