all the lints

This commit is contained in:
Olivier Gagnon
2021-05-01 03:17:31 -04:00
parent abe0330dc3
commit d745150c45
231 changed files with 1458 additions and 1439 deletions
+19 -17
View File
@@ -37,45 +37,40 @@ export class ErrorBoundary extends React.Component<IProps, IState> {
}
}
static getDerivedStateFromError(error: Error) {
return {
errorInfo: error.message,
hasError: true,
};
}
componentDidCatch(error: Error, info: IErrorInfo) {
componentDidCatch(error: Error, info: IErrorInfo): void {
console.error(`Caught error in React ErrorBoundary. Component stack:`);
console.error(info.componentStack);
}
componentDidMount() {
const cb = () => {
componentDidMount(): void {
const cb = (): void => {
this.setState({
hasError: false,
});
}
if (this.hasEventEmitter()) {
this.props.eventEmitterForReset!.addSubscriber({
(this.props.eventEmitterForReset as EventEmitter).addSubscriber({
cb: cb,
id: this.props.id!,
id: (this.props.id as string),
});
}
}
componentWillUnmount() {
componentWillUnmount(): void {
if (this.hasEventEmitter()) {
this.props.eventEmitterForReset!.removeSubscriber(this.props.id!);
(this.props.eventEmitterForReset as EventEmitter).removeSubscriber((this.props.id as string));
}
}
hasEventEmitter(): boolean {
return this.props.eventEmitterForReset instanceof EventEmitter
&& typeof this.props.id === "string";
return this.props.eventEmitterForReset != null &&
this.props.eventEmitterForReset instanceof EventEmitter &&
this.props.id != null &&
typeof this.props.id === "string";
}
render() {
render(): React.ReactNode {
if (this.state.hasError) {
return (
<div style={styleMarkup}>
@@ -100,4 +95,11 @@ export class ErrorBoundary extends React.Component<IProps, IState> {
return this.props.children;
}
static getDerivedStateFromError(error: Error): IState {
return {
errorInfo: error.message,
hasError: true,
};
}
}