From 7fc3dd3ed3dbc1b21533ee868b0982a53ebacd92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Nowotka?= <119880369+sfc-gh-mnowotka@users.noreply.github.com> Date: Mon, 13 Mar 2023 22:45:20 +0100 Subject: [PATCH] Activate the no-unused-vars rule in eslint. (#6300) * Initial cleanup of unused vars. * More unused vars removed. * Taking cate of $theme as well. * Remove redundant variable. --- frontend/.eslintrc | 9 +++++-- .../src/components/core/AppContext/index.tsx | 10 ++++---- .../core/Header/styled-components.ts | 2 +- .../core/MainMenu/styled-components.ts | 2 +- frontend/src/components/core/Maybe/Maybe.tsx | 6 +---- .../core/Sidebar/styled-components.ts | 6 ++--- .../core/StatusWidget/StatusWidget.tsx | 3 +-- .../core/StatusWidget/styled-components.ts | 4 ++-- .../core/StreamlitDialog/styled-components.ts | 8 +++---- .../ToolbarActions/ToolbarActions.test.tsx | 3 +-- .../core/ToolbarActions/ToolbarActions.tsx | 5 +--- .../core/ToolbarActions/styled-components.ts | 2 +- .../elements/ImageList/styled-components.ts | 2 +- .../elements/VegaLiteChart/VegaLiteChart.tsx | 2 +- .../shared/ColorPicker/ColorPicker.tsx | 2 +- .../shared/ColorPicker/styled-components.ts | 2 +- .../shared/ErrorBoundary/ErrorBoundary.tsx | 2 +- .../shared/ProgressBar/ProgressBar.tsx | 2 +- .../StreamlitMarkdown/StreamlitMarkdown.tsx | 14 +++++------ .../shared/TooltipIcon/styled-components.ts | 2 +- .../widgets/CameraInput/styled-components.ts | 24 +++++++++---------- .../widgets/Checkbox/styled-components.tsx | 2 +- .../DataFrame/hooks/useDataEditor.test.ts | 2 +- .../widgets/FileUploader/styled-components.ts | 4 ++-- .../widgets/Multiselect/Multiselect.test.tsx | 2 +- .../widgets/TextInput/styled-components.ts | 2 +- .../withHostCommunication.test.tsx | 7 +++--- .../styled-components.ts | 4 ++-- frontend/src/lib/AppNode.ts | 4 ++-- 29 files changed, 65 insertions(+), 74 deletions(-) diff --git a/frontend/.eslintrc b/frontend/.eslintrc index b91c8706dbd2..64868811c6da 100644 --- a/frontend/.eslintrc +++ b/frontend/.eslintrc @@ -58,8 +58,13 @@ "@typescript-eslint/explicit-module-boundary-types": "off", // Don't warn about unused function params "@typescript-eslint/no-unused-vars": [ - "warn", - { "args": "none", "ignoreRestSiblings": true } + "error", + { + "vars": "all", + "args": "after-used", + "ignoreRestSiblings": false, + "argsIgnorePattern": "^_" + } ], // It's safe to use functions before they're defined "@typescript-eslint/no-use-before-define": [ diff --git a/frontend/src/components/core/AppContext/index.tsx b/frontend/src/components/core/AppContext/index.tsx index f0e1b17c0ef2..f8f3c667206e 100644 --- a/frontend/src/components/core/AppContext/index.tsx +++ b/frontend/src/components/core/AppContext/index.tsx @@ -53,13 +53,13 @@ export default React.createContext({ showToolbar: false, showColoredLine: false, isFullScreen: false, - setFullScreen: (value: boolean) => {}, - addScriptFinishedHandler: (func: () => void) => {}, - removeScriptFinishedHandler: (func: () => void) => {}, + setFullScreen: () => {}, + addScriptFinishedHandler: () => {}, + removeScriptFinishedHandler: () => {}, activeTheme: baseTheme, - setTheme: (theme: ThemeConfig) => {}, + setTheme: () => {}, availableThemes: [], - addThemes: (themes: ThemeConfig[]) => {}, + addThemes: () => {}, sidebarChevronDownshift: 0, getBaseUriParts: getWindowBaseUriParts, }) diff --git a/frontend/src/components/core/Header/styled-components.ts b/frontend/src/components/core/Header/styled-components.ts index aec1034b0aed..04dae3125ae0 100644 --- a/frontend/src/components/core/Header/styled-components.ts +++ b/frontend/src/components/core/Header/styled-components.ts @@ -23,7 +23,7 @@ export interface StyledHeaderProps { } export const StyledHeader = styled.header( - ({ isWideMode, showHeader, theme }) => ({ + ({ showHeader, theme }) => ({ position: "fixed", top: theme.spacing.none, left: theme.spacing.none, diff --git a/frontend/src/components/core/MainMenu/styled-components.ts b/frontend/src/components/core/MainMenu/styled-components.ts index bdb50a06f0cd..a718163fbf1d 100644 --- a/frontend/src/components/core/MainMenu/styled-components.ts +++ b/frontend/src/components/core/MainMenu/styled-components.ts @@ -171,7 +171,7 @@ export const StyledMenuItemLabel = styled.span(({ theme }) => ({ fontFamily: theme.fonts.sansSerif, })) -export const StyledUl = styled.ul(({ theme }) => ({ +export const StyledUl = styled.ul(() => ({ borderBottom: "$1px solid rgba(38, 39, 48, 0.2)", borderTop: "$1px solid rgba(38, 39, 48, 0.2)", margin: "-.20rem 0 -.5rem 0", diff --git a/frontend/src/components/core/Maybe/Maybe.tsx b/frontend/src/components/core/Maybe/Maybe.tsx index 4be23c8d19df..c8e482e11611 100644 --- a/frontend/src/components/core/Maybe/Maybe.tsx +++ b/frontend/src/components/core/Maybe/Maybe.tsx @@ -24,11 +24,7 @@ export interface State {} class Maybe extends React.Component { // eslint-disable-next-line class-methods-use-this - public shouldComponentUpdate( - nextProps: Readonly, - nextState: Readonly, - nextContext: any - ): boolean { + public shouldComponentUpdate(nextProps: Readonly): boolean { // We have our component update if either props.enable or nextProps.enable // is true to ensure that we rerender in the case that an Element is // removed by replacing it with an empty one (so goes from enabled->disabled). diff --git a/frontend/src/components/core/Sidebar/styled-components.ts b/frontend/src/components/core/Sidebar/styled-components.ts index 7caafc36508a..8ec89cc0168c 100644 --- a/frontend/src/components/core/Sidebar/styled-components.ts +++ b/frontend/src/components/core/Sidebar/styled-components.ts @@ -63,7 +63,7 @@ export const StyledSidebar = styled.section( } ) -export const StyledSidebarNavContainer = styled.div(({ theme }) => ({ +export const StyledSidebarNavContainer = styled.div(() => ({ position: "relative", })) @@ -164,7 +164,7 @@ export const StyledSidebarNavSeparatorContainer = }) ) -export const StyledSidebarNavLinkContainer = styled.div(({ theme }) => ({ +export const StyledSidebarNavLinkContainer = styled.div(() => ({ display: "flex", flexDirection: "column", })) @@ -286,7 +286,7 @@ export interface StyledSidebarContentProps { } export const StyledSidebarContent = styled.div( - ({ hideScrollbar, theme }) => ({ + ({ hideScrollbar }) => ({ position: "relative", height: "100%", width: "100%", diff --git a/frontend/src/components/core/StatusWidget/StatusWidget.tsx b/frontend/src/components/core/StatusWidget/StatusWidget.tsx index bcd5fe8abd4c..59e39e1434bd 100644 --- a/frontend/src/components/core/StatusWidget/StatusWidget.tsx +++ b/frontend/src/components/core/StatusWidget/StatusWidget.tsx @@ -157,8 +157,7 @@ class StatusWidget extends PureComponent { /** Called by React on prop changes */ public static getDerivedStateFromProps( - props: Readonly, - state: State + props: Readonly ): Partial | null { // Reset transient event-related state when prop changes // render that state irrelevant diff --git a/frontend/src/components/core/StatusWidget/styled-components.ts b/frontend/src/components/core/StatusWidget/styled-components.ts index eab1bfcb7220..a88650fe8866 100644 --- a/frontend/src/components/core/StatusWidget/styled-components.ts +++ b/frontend/src/components/core/StatusWidget/styled-components.ts @@ -132,7 +132,7 @@ export const StyledAppRunningIcon = styled.img( } ) -export const StyledStatusWidget = styled.div(({ theme }) => ({ +export const StyledStatusWidget = styled.div(() => ({ "&.StatusWidget-appear": { opacity: 0, }, @@ -161,7 +161,7 @@ export const StyledStatusWidget = styled.div(({ theme }) => ({ }, })) -export const StyledShortcutLabel = styled.div(({ theme }) => ({ +export const StyledShortcutLabel = styled.div(() => ({ "&::first-letter": { textDecoration: "underline", }, diff --git a/frontend/src/components/core/StreamlitDialog/styled-components.ts b/frontend/src/components/core/StreamlitDialog/styled-components.ts index ad6dc9c6dc92..b3bb9a8fd820 100644 --- a/frontend/src/components/core/StreamlitDialog/styled-components.ts +++ b/frontend/src/components/core/StreamlitDialog/styled-components.ts @@ -29,7 +29,7 @@ export const StyledCommandLine = styled.textarea(({ theme }) => ({ height: "6rem", })) -export const StyledShortcutLabel = styled.span(({ theme }) => ({ +export const StyledShortcutLabel = styled.span(() => ({ "&::first-letter": { textDecoration: "underline", }, @@ -75,7 +75,7 @@ export const StyledHeader = styled.h2(({ theme }) => ({ }, })) -export const StyledLabel = styled.label(({ theme }) => ({ +export const StyledLabel = styled.label(() => ({ paddingBottom: 0, paddingTop: 0, marginBottom: 0, @@ -83,7 +83,7 @@ export const StyledLabel = styled.label(({ theme }) => ({ lineHeight: 1.25, })) -export const StyledSmall = styled(Small)(({ theme }) => ({ +export const StyledSmall = styled(Small)(() => ({ display: "block", paddingBottom: 0, paddingTop: 0, @@ -135,7 +135,7 @@ export const StyledCheckbox = styled.input(({ theme }) => ({ }, })) -export const StyledDeployErrorContent = styled.div(({ theme }) => ({ +export const StyledDeployErrorContent = styled.div(() => ({ "& > ul": { paddingLeft: "1.4rem", }, diff --git a/frontend/src/components/core/ToolbarActions/ToolbarActions.test.tsx b/frontend/src/components/core/ToolbarActions/ToolbarActions.test.tsx index 1ae85d0a01c8..d3916b98705f 100644 --- a/frontend/src/components/core/ToolbarActions/ToolbarActions.test.tsx +++ b/frontend/src/components/core/ToolbarActions/ToolbarActions.test.tsx @@ -29,7 +29,6 @@ describe("ActionButton", () => { const getProps = ( extended?: Partial ): ActionButtonProps => ({ - borderless: false, label: "the label", icon: "star.svg", onClick: jest.fn(), @@ -56,7 +55,7 @@ describe("ActionButton", () => { it("does not render label if not provided", () => { const wrapper = shallow( - + ) expect(wrapper).toMatchSnapshot() diff --git a/frontend/src/components/core/ToolbarActions/ToolbarActions.tsx b/frontend/src/components/core/ToolbarActions/ToolbarActions.tsx index 56865c2fc43f..a5b52b50cbc3 100644 --- a/frontend/src/components/core/ToolbarActions/ToolbarActions.tsx +++ b/frontend/src/components/core/ToolbarActions/ToolbarActions.tsx @@ -27,14 +27,12 @@ import { } from "./styled-components" export interface ActionButtonProps { - borderless?: boolean label?: string icon?: string onClick: () => void } export function ActionButton({ - borderless, label, icon, onClick, @@ -62,12 +60,11 @@ function ToolbarActions({ }: ToolbarActionsProps): ReactElement { return ( <> - {hostToolbarItems.map(({ borderless, key, label, icon }) => ( + {hostToolbarItems.map(({ key, label, icon }) => ( sendMessageToHost({ type: "TOOLBAR_ITEM_CALLBACK", diff --git a/frontend/src/components/core/ToolbarActions/styled-components.ts b/frontend/src/components/core/ToolbarActions/styled-components.ts index a0601e62955b..40c66018001f 100644 --- a/frontend/src/components/core/ToolbarActions/styled-components.ts +++ b/frontend/src/components/core/ToolbarActions/styled-components.ts @@ -29,7 +29,7 @@ export interface StyledActionButtonIconProps { } export const StyledActionButtonIcon = styled.div( - ({ theme, icon }) => ({ + ({ icon }) => ({ background: `url("${icon}") no-repeat center / contain`, // NOTE: We intentionally don't use any of the preset theme iconSizes here diff --git a/frontend/src/components/elements/ImageList/styled-components.ts b/frontend/src/components/elements/ImageList/styled-components.ts index 1d28cf424e7d..a19fa5f6c454 100644 --- a/frontend/src/components/elements/ImageList/styled-components.ts +++ b/frontend/src/components/elements/ImageList/styled-components.ts @@ -24,7 +24,7 @@ export const StyledImageList = styled.div(({ theme }) => ({ rowGap: theme.spacing.lg, })) -export const StyledImageContainer = styled.div(({ theme }) => ({ +export const StyledImageContainer = styled.div(() => ({ display: "flex", flexDirection: "column", alignItems: "stretch", diff --git a/frontend/src/components/elements/VegaLiteChart/VegaLiteChart.tsx b/frontend/src/components/elements/VegaLiteChart/VegaLiteChart.tsx index ca2526abd1eb..be50ea91090c 100644 --- a/frontend/src/components/elements/VegaLiteChart/VegaLiteChart.tsx +++ b/frontend/src/components/elements/VegaLiteChart/VegaLiteChart.tsx @@ -380,7 +380,7 @@ function getDataSets( const datasets: { [dataset: string]: any } = {} - el.get("datasets").forEach((x: any, i: number) => { + el.get("datasets").forEach((x: any) => { if (!x) { return } diff --git a/frontend/src/components/shared/ColorPicker/ColorPicker.tsx b/frontend/src/components/shared/ColorPicker/ColorPicker.tsx index 181841d43cff..5d7f1c9fcd06 100644 --- a/frontend/src/components/shared/ColorPicker/ColorPicker.tsx +++ b/frontend/src/components/shared/ColorPicker/ColorPicker.tsx @@ -80,7 +80,7 @@ class ColorPicker extends React.PureComponent { } // eslint-disable-next-line class-methods-use-this - public componentDidCatch(error: Error, errorInfo: React.ErrorInfo): void { + public componentDidCatch(error: Error): void { if (error?.name === "SecurityError") { // 2021.06.30 - on Streamlit Sharing, ColorPicker throws a cross-origin // error when its popover window is closed. There's an issue open in the diff --git a/frontend/src/components/shared/ColorPicker/styled-components.ts b/frontend/src/components/shared/ColorPicker/styled-components.ts index f6cc74de6b56..5bef7fb05908 100644 --- a/frontend/src/components/shared/ColorPicker/styled-components.ts +++ b/frontend/src/components/shared/ColorPicker/styled-components.ts @@ -59,7 +59,7 @@ export const StyledColorBlock = styled.div(({ theme }) => ({ }, })) -export const StyledColorValue = styled.div(({ theme }) => ({ +export const StyledColorValue = styled.div(() => ({ display: "flex", alignItems: "center", padding: "0 0.8rem", diff --git a/frontend/src/components/shared/ErrorBoundary/ErrorBoundary.tsx b/frontend/src/components/shared/ErrorBoundary/ErrorBoundary.tsx index 836afdbcfe58..611590ae8b43 100644 --- a/frontend/src/components/shared/ErrorBoundary/ErrorBoundary.tsx +++ b/frontend/src/components/shared/ErrorBoundary/ErrorBoundary.tsx @@ -42,7 +42,7 @@ class ErrorBoundary extends React.PureComponent { } } - public componentDidCatch = (error: Error, info: React.ErrorInfo): void => { + public componentDidCatch = (error: Error): void => { logError(`${error.name}: ${error.message}\n${error.stack}`) } diff --git a/frontend/src/components/shared/ProgressBar/ProgressBar.tsx b/frontend/src/components/shared/ProgressBar/ProgressBar.tsx index 44fa29a61467..2c89840cce27 100644 --- a/frontend/src/components/shared/ProgressBar/ProgressBar.tsx +++ b/frontend/src/components/shared/ProgressBar/ProgressBar.tsx @@ -81,7 +81,7 @@ function ProgressBar({ }), }, BarProgress: { - style: ({ $theme }: { $theme: any }) => ({ + style: () => ({ backgroundColor: usingCustomTheme ? theme.colors.primary : theme.colors.blue70, diff --git a/frontend/src/components/shared/StreamlitMarkdown/StreamlitMarkdown.tsx b/frontend/src/components/shared/StreamlitMarkdown/StreamlitMarkdown.tsx index 7adb9e9c71b2..a7e022a024d7 100644 --- a/frontend/src/components/shared/StreamlitMarkdown/StreamlitMarkdown.tsx +++ b/frontend/src/components/shared/StreamlitMarkdown/StreamlitMarkdown.tsx @@ -31,7 +31,7 @@ import { Components, ReactMarkdownProps, } from "react-markdown/lib/ast-to-react" -import { once } from "lodash" +import { once, omit } from "lodash" import remarkDirective from "remark-directive" import remarkMathPlugin from "remark-math" import rehypeRaw from "rehype-raw" @@ -210,7 +210,6 @@ type HeadingProps = JSX.IntrinsicElements["h1"] & export const CustomHeading: FunctionComponent = ({ node, children, - level, ...rest }) => { const anchor = rest["data-anchor"] @@ -254,7 +253,6 @@ export type CustomCodeTagProps = JSX.IntrinsicElements["code"] & * Renders code tag with highlighting based on requested language. */ export const CustomCodeTag: FunctionComponent = ({ - node, inline, className, children, @@ -276,7 +274,7 @@ export const CustomCodeTag: FunctionComponent = ({ ) : ( - + {children} ) @@ -452,18 +450,18 @@ export function LinkWithTargetBlank(props: LinkProps): ReactElement { // if it's a #hash link, don't open in new tab const { href } = props if (href && href.startsWith("#")) { - const { children, node, ...rest } = props - return {children} + const { children, ...rest } = props + return {children} } - const { title, children, node, target, rel, ...rest } = props + const { title, children, target, rel, ...rest } = props return ( {children} diff --git a/frontend/src/components/shared/TooltipIcon/styled-components.ts b/frontend/src/components/shared/TooltipIcon/styled-components.ts index 30e877adc995..0fef154a8f69 100644 --- a/frontend/src/components/shared/TooltipIcon/styled-components.ts +++ b/frontend/src/components/shared/TooltipIcon/styled-components.ts @@ -32,7 +32,7 @@ export const StyledTooltipIconWrapper = }, })) -export const StyledLabelHelpWrapper = styled.div(({ theme }) => ({ +export const StyledLabelHelpWrapper = styled.div(() => ({ display: "flex", visibility: "visible", verticalAlign: "middle", diff --git a/frontend/src/components/widgets/CameraInput/styled-components.ts b/frontend/src/components/widgets/CameraInput/styled-components.ts index 5ecd4649c3ae..25bb809e461a 100644 --- a/frontend/src/components/widgets/CameraInput/styled-components.ts +++ b/frontend/src/components/widgets/CameraInput/styled-components.ts @@ -61,16 +61,14 @@ function getSizeStyle(size: Size, theme: Theme): CSSObject { type RequiredCameraInputButtonProps = Required -export const StyledCameraInput = styled.div( - ({ theme, width }) => ({ - // This is used to position the "Switch facing mode" button - // with respect to the webcam block. - position: "relative", - overflow: "hidden", - width: "100%", - objectFit: "contain", - }) -) +export const StyledCameraInput = styled.div(() => ({ + // This is used to position the "Switch facing mode" button + // with respect to the webcam block. + position: "relative", + overflow: "hidden", + width: "100%", + objectFit: "contain", +})) export interface StyledBoxProps { width: number @@ -108,7 +106,7 @@ export const StyledLink = styled.a(({ theme }) => ({ textDecoration: "none", })) -export const StyledSpan = styled.span(({ theme }) => ({ +export const StyledSpan = styled.span(() => ({ display: "flex", alignItems: "center", })) @@ -123,11 +121,11 @@ export const StyledSwitchFacingModeButton = styled.div(({ theme }) => ({ opacity: 0.6, })) -export const StyledWebcamWrapper = styled.div(({ theme }) => ({ +export const StyledWebcamWrapper = styled.div(() => ({ display: "flex", })) -export const StyledProgressBar = styled.div(({ theme }) => ({ +export const StyledProgressBar = styled.div(() => ({ height: "fit-content", width: "100%", position: "absolute", diff --git a/frontend/src/components/widgets/Checkbox/styled-components.tsx b/frontend/src/components/widgets/Checkbox/styled-components.tsx index 50ec1b67d769..2f4b5e303cf2 100644 --- a/frontend/src/components/widgets/Checkbox/styled-components.tsx +++ b/frontend/src/components/widgets/Checkbox/styled-components.tsx @@ -23,7 +23,7 @@ export interface StyledContentProps { } export const StyledContent = styled.div( - ({ theme, visibility }) => ({ + ({ visibility }) => ({ display: visibility === LabelVisibilityOptions.Collapsed ? "none" : "flex", visibility: visibility === LabelVisibilityOptions.Hidden ? "hidden" : "visible", diff --git a/frontend/src/components/widgets/DataFrame/hooks/useDataEditor.test.ts b/frontend/src/components/widgets/DataFrame/hooks/useDataEditor.test.ts index 615f3d27a4ed..6cff2f509284 100644 --- a/frontend/src/components/widgets/DataFrame/hooks/useDataEditor.test.ts +++ b/frontend/src/components/widgets/DataFrame/hooks/useDataEditor.test.ts @@ -68,7 +68,7 @@ const getOriginalIndexMock = jest.fn().mockImplementation((index: number) => { }) const getCellContentMock = jest .fn() - .mockImplementation(([col, row]: readonly [number, number]) => { + .mockImplementation(([col]: readonly [number]) => { const column = MOCK_COLUMNS[col] if (column.kind === "number") { return column.getCell(123) diff --git a/frontend/src/components/widgets/FileUploader/styled-components.ts b/frontend/src/components/widgets/FileUploader/styled-components.ts index 0d2b1005f062..1f66d0c2bfb9 100644 --- a/frontend/src/components/widgets/FileUploader/styled-components.ts +++ b/frontend/src/components/widgets/FileUploader/styled-components.ts @@ -36,7 +36,7 @@ export const StyledFileDropzoneSection = styled.section( }) ) -export const StyledFileDropzoneInstructions = styled.div(({ theme }) => ({ +export const StyledFileDropzoneInstructions = styled.div(() => ({ marginRight: "auto", alignItems: "center", display: "flex", @@ -69,7 +69,7 @@ export const StyledUploadedFiles = styled.div(({ theme }) => ({ paddingRight: theme.spacing.lg, })) -export const StyledUploadedFilesList = styled.ul(({ theme }) => ({ +export const StyledUploadedFilesList = styled.ul(() => ({ listStyleType: "none", marginBottom: 0, })) diff --git a/frontend/src/components/widgets/Multiselect/Multiselect.test.tsx b/frontend/src/components/widgets/Multiselect/Multiselect.test.tsx index 1166332aa6fa..3600e4cb8efe 100644 --- a/frontend/src/components/widgets/Multiselect/Multiselect.test.tsx +++ b/frontend/src/components/widgets/Multiselect/Multiselect.test.tsx @@ -151,7 +151,7 @@ describe("Multiselect widget", () => { const options = wrapper.find(UISelect).prop("options") || [] const filterOptionsFn = - wrapper.find(UISelect).prop("filterOptions") || ((opts, val) => []) + wrapper.find(UISelect).prop("filterOptions") || (() => []) // @ts-ignore filterOptionsFn expects readonly options expect(filterOptionsFn(options, "1").length).toEqual(0) diff --git a/frontend/src/components/widgets/TextInput/styled-components.ts b/frontend/src/components/widgets/TextInput/styled-components.ts index 16824df6e7ee..510e3ce58821 100644 --- a/frontend/src/components/widgets/TextInput/styled-components.ts +++ b/frontend/src/components/widgets/TextInput/styled-components.ts @@ -21,7 +21,7 @@ export interface StyledTextInputProps { } export const StyledTextInput = styled.div( - ({ theme, width }) => ({ + ({ width }) => ({ position: "relative", width, }) diff --git a/frontend/src/hocs/withHostCommunication/withHostCommunication.test.tsx b/frontend/src/hocs/withHostCommunication/withHostCommunication.test.tsx index 5f8d7037df68..4e3093197d0f 100644 --- a/frontend/src/hocs/withHostCommunication/withHostCommunication.test.tsx +++ b/frontend/src/hocs/withHostCommunication/withHostCommunication.test.tsx @@ -17,11 +17,11 @@ import React, { PureComponent, ReactElement } from "react" import { act } from "react-dom/test-utils" -import { shallow, mount } from "src/lib/test_util" +import { mount, shallow } from "src/lib/test_util" import withHostCommunication, { - HostCommunicationHOC, HOST_COMM_VERSION, + HostCommunicationHOC, } from "./withHostCommunication" interface TestProps { @@ -48,9 +48,8 @@ function mockEventListeners(): (type: string, event: any) => void { listeners[event].push(cb) }) - const dispatchEvent = (type: string, event: Event): void => + return (type: string, event: Event): void => listeners[type].forEach(cb => cb(event)) - return dispatchEvent } describe("withHostCommunication HOC", () => { diff --git a/frontend/src/hocs/withScreencast/components/UnsupportedBrowserDialog/styled-components.ts b/frontend/src/hocs/withScreencast/components/UnsupportedBrowserDialog/styled-components.ts index f7f392dda992..1531891d2554 100644 --- a/frontend/src/hocs/withScreencast/components/UnsupportedBrowserDialog/styled-components.ts +++ b/frontend/src/hocs/withScreencast/components/UnsupportedBrowserDialog/styled-components.ts @@ -16,11 +16,11 @@ import styled from "@emotion/styled" -export const StyledScreenCastWarningDialog = styled.div(({ theme }) => ({ +export const StyledScreenCastWarningDialog = styled.div(() => ({ display: "flex", })) -export const StyledUnsupportedScreenCastIcon = styled.div(({ theme }) => ({ +export const StyledUnsupportedScreenCastIcon = styled.div(() => ({ display: "flex", alignItems: "center", justifyItems: "center", diff --git a/frontend/src/lib/AppNode.ts b/frontend/src/lib/AppNode.ts index 16f6d60b5aad..ad1dd7047d90 100644 --- a/frontend/src/lib/AppNode.ts +++ b/frontend/src/lib/AppNode.ts @@ -215,12 +215,12 @@ export class ElementNode implements AppNode { } // eslint-disable-next-line class-methods-use-this - public getIn(path: number[]): AppNode | undefined { + public getIn(): AppNode | undefined { return undefined } // eslint-disable-next-line class-methods-use-this - public setIn(path: number[], node: AppNode, scriptRunId: string): AppNode { + public setIn(): AppNode { throw new Error("'setIn' cannot be called on an ElementNode") }