From f85a0feac616d63a026fd50bada1106a1a5b7072 Mon Sep 17 00:00:00 2001 From: Ken McGrady Date: Fri, 22 Apr 2022 11:59:57 -0700 Subject: [PATCH] Fix build issues due to linting errors (#4637) --- component-lib/src/StreamlitReact.tsx | 4 +-- .../src/components/core/Sidebar/Sidebar.tsx | 4 +-- .../core/StreamlitDialog/SettingsDialog.tsx | 2 +- .../elements/CodeBlock/CopyButton.tsx | 28 ++++++++++--------- .../shared/ColorPicker/ColorPicker.tsx | 2 +- .../components/shared/Dropdown/Selectbox.tsx | 2 +- .../src/components/shared/Radio/Radio.tsx | 2 +- .../StreamlitMarkdown/StreamlitMarkdown.tsx | 2 +- .../widgets/CameraInput/CameraInput.tsx | 2 +- .../components/widgets/Checkbox/Checkbox.tsx | 2 +- .../widgets/ColorPicker/ColorPicker.tsx | 2 +- .../CustomComponent/ComponentInstance.tsx | 2 +- .../widgets/DateInput/DateInput.tsx | 2 +- .../widgets/FileUploader/FileUploader.tsx | 2 +- .../widgets/NumberInput/NumberInput.tsx | 2 +- .../src/components/widgets/Radio/Radio.tsx | 2 +- .../widgets/Selectbox/Selectbox.tsx | 2 +- .../src/components/widgets/Slider/Slider.tsx | 2 +- .../components/widgets/TextArea/TextArea.tsx | 2 +- .../widgets/TextInput/TextInput.tsx | 2 +- .../widgets/TimeInput/TimeInput.tsx | 2 +- .../hocs/withMapboxToken/withMapboxToken.tsx | 4 +-- .../ScreencastDialog/ScreencastDialog.tsx | 2 +- .../UnsupportedBrowserDialog.tsx | 2 +- .../hocs/withScreencast/withScreencast.tsx | 2 +- 25 files changed, 42 insertions(+), 40 deletions(-) diff --git a/component-lib/src/StreamlitReact.tsx b/component-lib/src/StreamlitReact.tsx index bd381df4d5ed..9a23ce5d882f 100644 --- a/component-lib/src/StreamlitReact.tsx +++ b/component-lib/src/StreamlitReact.tsx @@ -140,7 +140,7 @@ export function withStreamlitConnection( this.setState({ renderData: renderEvent.detail }); }; - public render = (): ReactNode => { + public render(): ReactNode { // If our wrapped component threw an error, display it. if (this.state.componentError != null) { return ( @@ -164,7 +164,7 @@ export function withStreamlitConnection( theme={this.state.renderData.theme} /> ); - }; + } } return hoistNonReactStatics(ComponentWrapper, WrappedComponent); diff --git a/frontend/src/components/core/Sidebar/Sidebar.tsx b/frontend/src/components/core/Sidebar/Sidebar.tsx index e3e89645c3a3..50d6dd8a0fd0 100644 --- a/frontend/src/components/core/Sidebar/Sidebar.tsx +++ b/frontend/src/components/core/Sidebar/Sidebar.tsx @@ -15,7 +15,7 @@ * limitations under the License. */ -import React, { PureComponent, ReactElement } from "react" +import React, { PureComponent, ReactElement, ReactNode } from "react" import { ChevronRight, X } from "@emotion-icons/open-iconic" import { withTheme } from "@emotion/react" @@ -146,7 +146,7 @@ class Sidebar extends PureComponent { this.setState({ collapsedSidebar: !collapsedSidebar }) } - public render = (): ReactElement => { + public render(): ReactNode { const { collapsedSidebar } = this.state const { chevronDownshift, children } = this.props diff --git a/frontend/src/components/core/StreamlitDialog/SettingsDialog.tsx b/frontend/src/components/core/StreamlitDialog/SettingsDialog.tsx index 780c7a58b719..4660ba02b30f 100644 --- a/frontend/src/components/core/StreamlitDialog/SettingsDialog.tsx +++ b/frontend/src/components/core/StreamlitDialog/SettingsDialog.tsx @@ -78,7 +78,7 @@ export class SettingsDialog extends PureComponent { ) - public render = (): ReactNode => { + public render(): ReactNode { const themeIndex = this.context.availableThemes.findIndex( (theme: ThemeConfig) => theme.name === this.context.activeTheme.name ) diff --git a/frontend/src/components/elements/CodeBlock/CopyButton.tsx b/frontend/src/components/elements/CodeBlock/CopyButton.tsx index f8387b790ec6..58595eeba47c 100644 --- a/frontend/src/components/elements/CodeBlock/CopyButton.tsx +++ b/frontend/src/components/elements/CodeBlock/CopyButton.tsx @@ -43,19 +43,21 @@ class CopyButton extends PureComponent { } } - public render = (): ReactNode => ( - - - - ) + public render(): ReactNode { + return ( + + + + ) + } } export default CopyButton diff --git a/frontend/src/components/shared/ColorPicker/ColorPicker.tsx b/frontend/src/components/shared/ColorPicker/ColorPicker.tsx index 650665c4f94a..675f77244093 100644 --- a/frontend/src/components/shared/ColorPicker/ColorPicker.tsx +++ b/frontend/src/components/shared/ColorPicker/ColorPicker.tsx @@ -96,7 +96,7 @@ class ColorPicker extends React.PureComponent { } } - public render = (): React.ReactNode => { + public render(): React.ReactNode { const { width, showValue, label, help, disabled } = this.props const { value } = this.state const cursor = disabled ? "not-allowed" : "default" diff --git a/frontend/src/components/shared/Dropdown/Selectbox.tsx b/frontend/src/components/shared/Dropdown/Selectbox.tsx index 557f7e657d54..471e3cafcae6 100644 --- a/frontend/src/components/shared/Dropdown/Selectbox.tsx +++ b/frontend/src/components/shared/Dropdown/Selectbox.tsx @@ -129,7 +129,7 @@ class Selectbox extends React.PureComponent { ): readonly Option[] => fuzzyFilterSelectOptions(options as SelectOption[], filterValue) - public render = (): React.ReactNode => { + public render(): React.ReactNode { const style = { width: this.props.width } const { label, help } = this.props let { disabled, options } = this.props diff --git a/frontend/src/components/shared/Radio/Radio.tsx b/frontend/src/components/shared/Radio/Radio.tsx index 68e5ab065abc..b2721aaea68b 100644 --- a/frontend/src/components/shared/Radio/Radio.tsx +++ b/frontend/src/components/shared/Radio/Radio.tsx @@ -67,7 +67,7 @@ class Radio extends React.PureComponent { ) } - public render = (): React.ReactNode => { + public render(): React.ReactNode { const { theme, width, help, label } = this.props let { disabled } = this.props const { colors, radii } = theme diff --git a/frontend/src/components/shared/StreamlitMarkdown/StreamlitMarkdown.tsx b/frontend/src/components/shared/StreamlitMarkdown/StreamlitMarkdown.tsx index d9a59351b52e..f11a17366c44 100644 --- a/frontend/src/components/shared/StreamlitMarkdown/StreamlitMarkdown.tsx +++ b/frontend/src/components/shared/StreamlitMarkdown/StreamlitMarkdown.tsx @@ -192,7 +192,7 @@ class StreamlitMarkdown extends PureComponent { }) } - public render = (): ReactNode => { + public render(): ReactNode { const { source, allowHTML, style, isCaption } = this.props const isInSidebar = this.context diff --git a/frontend/src/components/widgets/CameraInput/CameraInput.tsx b/frontend/src/components/widgets/CameraInput/CameraInput.tsx index 6c97a12b27fb..a7048895c559 100644 --- a/frontend/src/components/widgets/CameraInput/CameraInput.tsx +++ b/frontend/src/components/widgets/CameraInput/CameraInput.tsx @@ -347,7 +347,7 @@ class CameraInput extends React.PureComponent { }) } - public render = (): React.ReactNode => { + public render(): React.ReactNode { const { element, widgetMgr, disabled, width } = this.props // Manage our form-clear event handler. diff --git a/frontend/src/components/widgets/Checkbox/Checkbox.tsx b/frontend/src/components/widgets/Checkbox/Checkbox.tsx index 1ab4f04868c8..d0a1331cf11f 100644 --- a/frontend/src/components/widgets/Checkbox/Checkbox.tsx +++ b/frontend/src/components/widgets/Checkbox/Checkbox.tsx @@ -119,7 +119,7 @@ class Checkbox extends React.PureComponent { this.setState({ value }, () => this.commitWidgetValue({ fromUi: true })) } - public render = (): React.ReactNode => { + public render(): React.ReactNode { const { theme, width, element, disabled, widgetMgr } = this.props const { colors, spacing, radii } = theme const style = { width } diff --git a/frontend/src/components/widgets/ColorPicker/ColorPicker.tsx b/frontend/src/components/widgets/ColorPicker/ColorPicker.tsx index 9070e25604cc..9e9efaa071cd 100644 --- a/frontend/src/components/widgets/ColorPicker/ColorPicker.tsx +++ b/frontend/src/components/widgets/ColorPicker/ColorPicker.tsx @@ -106,7 +106,7 @@ class ColorPicker extends React.PureComponent { ) } - public render = (): React.ReactNode => { + public render(): React.ReactNode { const { element, width, disabled, widgetMgr } = this.props const { value } = this.state diff --git a/frontend/src/components/widgets/CustomComponent/ComponentInstance.tsx b/frontend/src/components/widgets/CustomComponent/ComponentInstance.tsx index 3a4a7d660060..d369ffb0353c 100644 --- a/frontend/src/components/widgets/CustomComponent/ComponentInstance.tsx +++ b/frontend/src/components/widgets/CustomComponent/ComponentInstance.tsx @@ -335,7 +335,7 @@ export class ComponentInstance extends React.PureComponent { ) } - public render = (): ReactNode => { + public render(): ReactNode { // If we have an error, display it and bail. if (this.state.componentError != null) { return this.renderError(this.state.componentError) diff --git a/frontend/src/components/widgets/DateInput/DateInput.tsx b/frontend/src/components/widgets/DateInput/DateInput.tsx index 4bb556f9679e..840e52bcdf8c 100644 --- a/frontend/src/components/widgets/DateInput/DateInput.tsx +++ b/frontend/src/components/widgets/DateInput/DateInput.tsx @@ -174,7 +174,7 @@ class DateInput extends React.PureComponent { : undefined } - public render = (): React.ReactNode => { + public render(): React.ReactNode { const { width, element, disabled, theme, widgetMgr } = this.props const { values, isRange } = this.state const { colors, fontSizes } = theme diff --git a/frontend/src/components/widgets/FileUploader/FileUploader.tsx b/frontend/src/components/widgets/FileUploader/FileUploader.tsx index 4f34a3119b74..240a02523d51 100644 --- a/frontend/src/components/widgets/FileUploader/FileUploader.tsx +++ b/frontend/src/components/widgets/FileUploader/FileUploader.tsx @@ -483,7 +483,7 @@ class FileUploader extends React.PureComponent { }) } - public render = (): React.ReactNode => { + public render(): React.ReactNode { const { files } = this.state const { element, disabled, widgetMgr } = this.props const acceptedExtensions = element.type diff --git a/frontend/src/components/widgets/NumberInput/NumberInput.tsx b/frontend/src/components/widgets/NumberInput/NumberInput.tsx index 1103f399f26f..dced6c3df251 100644 --- a/frontend/src/components/widgets/NumberInput/NumberInput.tsx +++ b/frontend/src/components/widgets/NumberInput/NumberInput.tsx @@ -295,7 +295,7 @@ class NumberInput extends React.PureComponent { } } - public render = (): React.ReactNode => { + public render(): React.ReactNode { const { element, width, disabled, widgetMgr } = this.props const { formattedValue, dirty } = this.state diff --git a/frontend/src/components/widgets/Radio/Radio.tsx b/frontend/src/components/widgets/Radio/Radio.tsx index 14484318ed92..0f6488bef38d 100644 --- a/frontend/src/components/widgets/Radio/Radio.tsx +++ b/frontend/src/components/widgets/Radio/Radio.tsx @@ -106,7 +106,7 @@ class Radio extends React.PureComponent { ) } - public render = (): React.ReactNode => { + public render(): React.ReactNode { const { disabled, element, width, widgetMgr } = this.props const { options, label, help } = element diff --git a/frontend/src/components/widgets/Selectbox/Selectbox.tsx b/frontend/src/components/widgets/Selectbox/Selectbox.tsx index 478b76f18afb..b204017917b1 100644 --- a/frontend/src/components/widgets/Selectbox/Selectbox.tsx +++ b/frontend/src/components/widgets/Selectbox/Selectbox.tsx @@ -104,7 +104,7 @@ class Selectbox extends React.PureComponent { this.setState({ value }, () => this.commitWidgetValue({ fromUi: true })) } - public render = (): React.ReactNode => { + public render(): React.ReactNode { const { options, help, label, formId } = this.props.element const { disabled, widgetMgr } = this.props diff --git a/frontend/src/components/widgets/Slider/Slider.tsx b/frontend/src/components/widgets/Slider/Slider.tsx index 7fca335c7af2..a23a0755dcdd 100644 --- a/frontend/src/components/widgets/Slider/Slider.tsx +++ b/frontend/src/components/widgets/Slider/Slider.tsx @@ -274,7 +274,7 @@ class Slider extends React.PureComponent { ) } - public render = (): React.ReactNode => { + public render(): React.ReactNode { const { disabled, element, theme, width, widgetMgr } = this.props const { colors, fonts, fontSizes, spacing } = theme const style = { width } diff --git a/frontend/src/components/widgets/TextArea/TextArea.tsx b/frontend/src/components/widgets/TextArea/TextArea.tsx index 6c9e9b5c3493..007eabff924d 100644 --- a/frontend/src/components/widgets/TextArea/TextArea.tsx +++ b/frontend/src/components/widgets/TextArea/TextArea.tsx @@ -170,7 +170,7 @@ class TextArea extends React.PureComponent { } } - public render = (): React.ReactNode => { + public render(): React.ReactNode { const { element, disabled, width, widgetMgr } = this.props const { value, dirty } = this.state const style = { width } diff --git a/frontend/src/components/widgets/TextInput/TextInput.tsx b/frontend/src/components/widgets/TextInput/TextInput.tsx index 10a1fa181f8a..aab66147e9fc 100644 --- a/frontend/src/components/widgets/TextInput/TextInput.tsx +++ b/frontend/src/components/widgets/TextInput/TextInput.tsx @@ -161,7 +161,7 @@ class TextInput extends React.PureComponent { : "text" } - public render = (): React.ReactNode => { + public render(): React.ReactNode { const { dirty, value } = this.state const { element, width, disabled, widgetMgr } = this.props const { placeholder } = element diff --git a/frontend/src/components/widgets/TimeInput/TimeInput.tsx b/frontend/src/components/widgets/TimeInput/TimeInput.tsx index 2599a8339cda..c501c45a4fdb 100644 --- a/frontend/src/components/widgets/TimeInput/TimeInput.tsx +++ b/frontend/src/components/widgets/TimeInput/TimeInput.tsx @@ -134,7 +134,7 @@ class TimeInput extends PureComponent { return `${hours}:${minutes}` } - public render = (): ReactNode => { + public render(): ReactNode { const { disabled, width, element, widgetMgr } = this.props const style = { width } diff --git a/frontend/src/hocs/withMapboxToken/withMapboxToken.tsx b/frontend/src/hocs/withMapboxToken/withMapboxToken.tsx index cbe7948b6855..bc482a5ddd2e 100644 --- a/frontend/src/hocs/withMapboxToken/withMapboxToken.tsx +++ b/frontend/src/hocs/withMapboxToken/withMapboxToken.tsx @@ -20,7 +20,7 @@ import { Kind } from "src/components/shared/AlertContainer" import { MapboxToken } from "src/hocs/withMapboxToken/MapboxToken" import { ensureError } from "src/lib/ErrorHandling" import hoistNonReactStatics from "hoist-non-react-statics" -import React, { ComponentType, PureComponent } from "react" +import React, { ComponentType, PureComponent, ReactNode } from "react" import MapboxTokenError from "./MapboxTokenError" interface Props { @@ -81,7 +81,7 @@ const withMapboxToken = (deltaType: string) => ( } } - public render = (): JSX.Element => { + public render(): ReactNode { const { mapboxToken, mapboxTokenError, isFetching } = this.state const { width } = this.props diff --git a/frontend/src/hocs/withScreencast/components/ScreencastDialog/ScreencastDialog.tsx b/frontend/src/hocs/withScreencast/components/ScreencastDialog/ScreencastDialog.tsx index fed1398f5a04..4d8026e8f040 100644 --- a/frontend/src/hocs/withScreencast/components/ScreencastDialog/ScreencastDialog.tsx +++ b/frontend/src/hocs/withScreencast/components/ScreencastDialog/ScreencastDialog.tsx @@ -65,7 +65,7 @@ class ScreencastDialog extends PureComponent { onClose() } - public render = (): ReactNode => { + public render(): ReactNode { const { recordAudio } = this.state const { onClose } = this.props diff --git a/frontend/src/hocs/withScreencast/components/UnsupportedBrowserDialog/UnsupportedBrowserDialog.tsx b/frontend/src/hocs/withScreencast/components/UnsupportedBrowserDialog/UnsupportedBrowserDialog.tsx index d86db86c450d..8e6075bc1399 100644 --- a/frontend/src/hocs/withScreencast/components/UnsupportedBrowserDialog/UnsupportedBrowserDialog.tsx +++ b/frontend/src/hocs/withScreencast/components/UnsupportedBrowserDialog/UnsupportedBrowserDialog.tsx @@ -29,7 +29,7 @@ export interface Props { } class UnsupportedBrowserDialog extends PureComponent { - public render = (): ReactNode => { + public render(): ReactNode { const { onClose } = this.props return ( diff --git a/frontend/src/hocs/withScreencast/withScreencast.tsx b/frontend/src/hocs/withScreencast/withScreencast.tsx index 9a8872be8a1b..918fe2dae485 100644 --- a/frontend/src/hocs/withScreencast/withScreencast.tsx +++ b/frontend/src/hocs/withScreencast/withScreencast.tsx @@ -175,7 +175,7 @@ function withScreencast( }) } - public render = (): ReactNode => { + public render(): ReactNode { const { outputBlob, fileName,