From 02a3787392cdae0aab7f4d024c4e579d8766f3c8 Mon Sep 17 00:00:00 2001 From: nreese Date: Fri, 27 Jan 2023 16:05:56 -0700 Subject: [PATCH] tslint and eslint --- .../component/grid/dashboard_grid.test.tsx | 38 +++++++++++-------- .../component/grid/dashboard_grid_item.tsx | 2 +- 2 files changed, 23 insertions(+), 17 deletions(-) diff --git a/src/plugins/dashboard/public/dashboard_container/component/grid/dashboard_grid.test.tsx b/src/plugins/dashboard/public/dashboard_container/component/grid/dashboard_grid.test.tsx index 41d86a5d370f0..afc346f55e4c3 100644 --- a/src/plugins/dashboard/public/dashboard_container/component/grid/dashboard_grid.test.tsx +++ b/src/plugins/dashboard/public/dashboard_container/component/grid/dashboard_grid.test.tsx @@ -17,22 +17,28 @@ import { pluginServices } from '../../../services/plugin_services'; import { DashboardGrid } from './dashboard_grid'; import { DashboardContainer } from '../../embeddable/dashboard_container'; import { getSampleDashboardInput } from '../../../mocks'; - -jest.mock('./dashboard_grid_item', () => ({ - DashboardGridItem: require('react').forwardRef((props, ref) => { - const className = - props.expandedPanelId === undefined - ? 'regularPanel' - : props.expandedPanelId === props.id - ? 'expandedPanel' - : 'hiddenPanel'; - return ( -
- mockDashboardGridItem -
- ); - }), -})); +import type { Props as DashboardGridItemProps } from './dashboard_grid_item'; + +jest.mock('./dashboard_grid_item', () => { + return { + // eslint-disable-next-line @typescript-eslint/no-var-requires + DashboardGridItem: require('react').forwardRef( + (props: DashboardGridItemProps, ref: HTMLDivElement) => { + const className = + props.expandedPanelId === undefined + ? 'regularPanel' + : props.expandedPanelId === props.id + ? 'expandedPanel' + : 'hiddenPanel'; + return ( +
+ mockDashboardGridItem +
+ ); + } + ), + }; +}); const DashboardServicesProvider = pluginServices.getContextProvider(); diff --git a/src/plugins/dashboard/public/dashboard_container/component/grid/dashboard_grid_item.tsx b/src/plugins/dashboard/public/dashboard_container/component/grid/dashboard_grid_item.tsx index 6e09254fed0d0..1c8b3d992187d 100644 --- a/src/plugins/dashboard/public/dashboard_container/component/grid/dashboard_grid_item.tsx +++ b/src/plugins/dashboard/public/dashboard_container/component/grid/dashboard_grid_item.tsx @@ -22,7 +22,7 @@ import { useDashboardContainerContext } from '../../dashboard_container_renderer type DivProps = Pick, 'className' | 'style' | 'children'>; -interface Props extends DivProps { +export interface Props extends DivProps { id: DashboardPanelState['explicitInput']['id']; index?: number; type: DashboardPanelState['type'];