From dcd3a280d52afd9b9060ab394c3fe191f6f1b75e Mon Sep 17 00:00:00 2001 From: Matt Ray Date: Thu, 3 Aug 2023 17:06:14 +1000 Subject: [PATCH] `yarn tsc` cleanups OpenCostPage.tsx TS6133: 'ContentHeader' is declared but its value is never read. OpenCostReport.tsx TS6133: 'forEach' is declared but its value is never read. TS7006: added @ts-ignore util.js TS2322: Type 'string | null' is not assignable to type 'string'. Signed-off-by: Matt Ray --- .../src/components/OpenCostPage/OpenCostPage.tsx | 7 +------ .../src/components/OpenCostReport/OpenCostReport.tsx | 9 ++++++++- plugins/opencost/src/util.js | 2 +- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/plugins/opencost/src/components/OpenCostPage/OpenCostPage.tsx b/plugins/opencost/src/components/OpenCostPage/OpenCostPage.tsx index 19a383e7b6..bd60fa0c35 100644 --- a/plugins/opencost/src/components/OpenCostPage/OpenCostPage.tsx +++ b/plugins/opencost/src/components/OpenCostPage/OpenCostPage.tsx @@ -15,12 +15,7 @@ */ import React from 'react'; import { Grid } from '@material-ui/core'; -import { - Header, - Page, - Content, - ContentHeader, -} from '@backstage/core-components'; +import { Header, Page, Content } from '@backstage/core-components'; import { OpenCostReport } from '../OpenCostReport'; export const OpenCostPage = () => ( diff --git a/plugins/opencost/src/components/OpenCostReport/OpenCostReport.tsx b/plugins/opencost/src/components/OpenCostReport/OpenCostReport.tsx index 8a4cad49c8..12f64f3606 100644 --- a/plugins/opencost/src/components/OpenCostReport/OpenCostReport.tsx +++ b/plugins/opencost/src/components/OpenCostReport/OpenCostReport.tsx @@ -22,7 +22,7 @@ import Paper from '@material-ui/core/Paper'; import RefreshIcon from '@material-ui/icons/Refresh'; import Typography from '@material-ui/core/Typography'; import { useLocation, useNavigate } from 'react-router-dom'; -import { find, forEach, get, sortBy, toArray } from 'lodash'; +import { find, get, sortBy, toArray } from 'lodash'; import { makeStyles } from '@material-ui/styles'; import AllocationReport from '../AllocationReport'; import AllocationService from '../../services/allocation'; @@ -80,6 +80,7 @@ const useStyles = makeStyles({ }); // generateTitle generates a string title from a report object +// @ts-ignore: implicitly has an 'any' type function generateTitle({ window, aggregateBy, accumulate }) { let windowName = get(find(windowOptions, { value: window }), 'name', ''); if (windowName === '') { @@ -208,6 +209,7 @@ export const OpenCostReport = () => { } catch (err) { if (err.message.indexOf('404') === 0) { setErrors([ + // @ts-ignore: not assignable to type 'never' { primary: 'Failed to load report data', secondary: @@ -221,6 +223,7 @@ export const OpenCostReport = () => { secondary = err.message; } setErrors([ + // @ts-ignore: not assignable to type 'never' { primary: 'Failed to load report data', secondary: secondary, @@ -255,6 +258,7 @@ export const OpenCostReport = () => { { searchParams.set('window', win); routerNavigate({ @@ -263,6 +267,7 @@ export const OpenCostReport = () => { }} aggregationOptions={aggregationOptions} aggregateBy={aggregateBy} + // @ts-ignore: implicitly has an 'any' type setAggregateBy={agg => { searchParams.set('agg', agg); routerNavigate({ @@ -271,6 +276,7 @@ export const OpenCostReport = () => { }} accumulateOptions={accumulateOptions} accumulate={accumulate} + // @ts-ignore: implicitly has an 'any' type setAccumulate={acc => { searchParams.set('acc', acc); routerNavigate({ @@ -281,6 +287,7 @@ export const OpenCostReport = () => { cumulativeData={cumulativeData} currency={currency} currencyOptions={currencyCodes} + // @ts-ignore: implicitly has an 'any' type setCurrency={curr => { searchParams.set('currency', curr); routerNavigate({ diff --git a/plugins/opencost/src/util.js b/plugins/opencost/src/util.js index d2c8fa7562..5854718a55 100644 --- a/plugins/opencost/src/util.js +++ b/plugins/opencost/src/util.js @@ -293,7 +293,7 @@ export function toVerboseTimeRange(window) { } ${end.getUTCFullYear()}`; } } - return null; + return ''; } export function bytesToString(bytes) {