From e8ca3c04091995edad424dc269633162a7c09b57 Mon Sep 17 00:00:00 2001 From: Ashley Harrison Date: Mon, 22 May 2023 11:53:58 +0100 Subject: [PATCH] =?UTF-8?q?Chore:=20More=20typescript=20improvements=20?= =?UTF-8?q?=F0=9F=92=AA=20=20(#68699)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix some anys * some canvas/geomap improvements * some more panel type fixes * just omit the type in TagOption --- .betterer.results | 266 +++++------------- .../components/Forms/Legacy/Select/Select.tsx | 1 + .../grafana-ui/src/components/Select/types.ts | 2 +- .../app/core/components/Login/LoginCtrl.tsx | 8 +- public/app/core/components/Login/types.ts | 4 + .../core/components/OptionsUI/registry.tsx | 6 +- .../PanelTypeFilter/PanelTypeFilter.tsx | 6 +- .../core/components/TagFilter/TagOption.tsx | 2 +- .../TimelineChart/TimelineChart.tsx | 2 +- .../components/modals/AngularModalProxy.tsx | 2 +- .../app/core/navigation/GrafanaRoute.test.tsx | 7 +- .../core/navigation/__mocks__/routeProps.ts | 10 +- public/app/core/navigation/types.ts | 2 +- public/app/core/services/ResponseQueue.ts | 4 +- public/app/core/services/context_srv.ts | 2 - public/app/core/utils/acl.ts | 2 +- public/app/core/utils/explore.ts | 6 +- public/app/core/utils/flatten.ts | 7 +- public/app/core/utils/kbn.ts | 5 +- .../features/canvas/elements/droneFront.tsx | 2 +- .../features/canvas/elements/droneSide.tsx | 2 +- .../app/features/canvas/elements/droneTop.tsx | 2 +- .../features/canvas/elements/windTurbine.tsx | 2 +- .../components/HelpWizard/randomizer.ts | 3 +- .../SaveDashboard/SaveDashboardErrorProxy.tsx | 2 +- .../components/SaveDashboard/types.ts | 2 +- .../SaveDashboard/useDashboardSave.tsx | 2 +- .../__mocks__/dashboardHistoryMocks.ts | 6 +- .../dashboard/dashgrid/LazyLoader.tsx | 3 +- .../dashboard/services/DashboardLoaderSrv.ts | 8 +- .../dashboard/services/DashboardSrv.ts | 3 +- .../features/dashboard/services/TimeSrv.ts | 9 +- .../app/plugins/panel/canvas/CanvasPanel.tsx | 8 +- .../app/plugins/panel/canvas/InlineEdit.tsx | 4 +- .../plugins/panel/canvas/InlineEditBody.tsx | 4 +- .../plugins/panel/canvas/editor/APIEditor.tsx | 8 +- public/app/plugins/panel/canvas/utils.ts | 7 +- .../panel/geomap/components/MarkersLegend.tsx | 8 +- .../panel/geomap/layers/basemaps/carto.ts | 2 +- public/app/plugins/panel/geomap/migrations.ts | 6 +- .../plugins/panel/geomap/utils/tootltip.ts | 4 +- .../panel/heatmap/HeatmapHoverView.tsx | 4 +- public/app/plugins/panel/heatmap/utils.ts | 3 +- public/app/plugins/panel/live/LivePanel.tsx | 4 +- .../app/plugins/panel/nodeGraph/usePanning.ts | 10 +- .../panel/timeseries/SpanNullsEditor.tsx | 8 +- .../plugins/panel/timeseries/suggestions.ts | 11 +- public/app/plugins/panel/trend/suggestions.ts | 4 +- 48 files changed, 187 insertions(+), 298 deletions(-) create mode 100644 public/app/core/components/Login/types.ts diff --git a/.betterer.results b/.betterer.results index 48eb2717000..4dd303c6e48 100644 --- a/.betterer.results +++ b/.betterer.results @@ -1458,9 +1458,6 @@ exports[`better eslint`] = { "public/app/core/components/ForgottenPassword/ChangePassword.tsx:5381": [ [0, 0, 0, "Use data-testid for E2E selectors instead of aria-label", "0"] ], - "public/app/core/components/Login/LoginCtrl.tsx:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"] - ], "public/app/core/components/Login/LoginForm.tsx:5381": [ [0, 0, 0, "Use data-testid for E2E selectors instead of aria-label", "0"], [0, 0, 0, "Use data-testid for E2E selectors instead of aria-label", "1"] @@ -1474,89 +1471,82 @@ exports[`better eslint`] = { [0, 0, 0, "Unexpected any. Specify a different type.", "5"], [0, 0, 0, "Do not use any type assertions.", "6"], [0, 0, 0, "Unexpected any. Specify a different type.", "7"], - [0, 0, 0, "Unexpected any. Specify a different type.", "8"], - [0, 0, 0, "Do not use any type assertions.", "9"], - [0, 0, 0, "Unexpected any. Specify a different type.", "10"], + [0, 0, 0, "Do not use any type assertions.", "8"], + [0, 0, 0, "Unexpected any. Specify a different type.", "9"], + [0, 0, 0, "Do not use any type assertions.", "10"], [0, 0, 0, "Unexpected any. Specify a different type.", "11"], [0, 0, 0, "Do not use any type assertions.", "12"], [0, 0, 0, "Unexpected any. Specify a different type.", "13"], - [0, 0, 0, "Unexpected any. Specify a different type.", "14"], - [0, 0, 0, "Do not use any type assertions.", "15"], - [0, 0, 0, "Unexpected any. Specify a different type.", "16"], - [0, 0, 0, "Do not use any type assertions.", "17"], - [0, 0, 0, "Unexpected any. Specify a different type.", "18"], - [0, 0, 0, "Do not use any type assertions.", "19"], - [0, 0, 0, "Unexpected any. Specify a different type.", "20"], - [0, 0, 0, "Do not use any type assertions.", "21"], - [0, 0, 0, "Unexpected any. Specify a different type.", "22"], - [0, 0, 0, "Do not use any type assertions.", "23"], - [0, 0, 0, "Unexpected any. Specify a different type.", "24"], - [0, 0, 0, "Do not use any type assertions.", "25"], - [0, 0, 0, "Unexpected any. Specify a different type.", "26"], - [0, 0, 0, "Do not use any type assertions.", "27"], - [0, 0, 0, "Unexpected any. Specify a different type.", "28"], - [0, 0, 0, "Do not use any type assertions.", "29"], + [0, 0, 0, "Do not use any type assertions.", "14"], + [0, 0, 0, "Unexpected any. Specify a different type.", "15"], + [0, 0, 0, "Do not use any type assertions.", "16"], + [0, 0, 0, "Unexpected any. Specify a different type.", "17"], + [0, 0, 0, "Do not use any type assertions.", "18"], + [0, 0, 0, "Unexpected any. Specify a different type.", "19"], + [0, 0, 0, "Do not use any type assertions.", "20"], + [0, 0, 0, "Unexpected any. Specify a different type.", "21"], + [0, 0, 0, "Do not use any type assertions.", "22"], + [0, 0, 0, "Unexpected any. Specify a different type.", "23"], + [0, 0, 0, "Do not use any type assertions.", "24"], + [0, 0, 0, "Unexpected any. Specify a different type.", "25"], + [0, 0, 0, "Do not use any type assertions.", "26"], + [0, 0, 0, "Unexpected any. Specify a different type.", "27"], + [0, 0, 0, "Do not use any type assertions.", "28"], + [0, 0, 0, "Unexpected any. Specify a different type.", "29"], [0, 0, 0, "Unexpected any. Specify a different type.", "30"], [0, 0, 0, "Do not use any type assertions.", "31"], [0, 0, 0, "Unexpected any. Specify a different type.", "32"], - [0, 0, 0, "Unexpected any. Specify a different type.", "33"], - [0, 0, 0, "Do not use any type assertions.", "34"], + [0, 0, 0, "Do not use any type assertions.", "33"], + [0, 0, 0, "Unexpected any. Specify a different type.", "34"], [0, 0, 0, "Unexpected any. Specify a different type.", "35"], [0, 0, 0, "Do not use any type assertions.", "36"], [0, 0, 0, "Unexpected any. Specify a different type.", "37"], - [0, 0, 0, "Unexpected any. Specify a different type.", "38"], - [0, 0, 0, "Do not use any type assertions.", "39"], + [0, 0, 0, "Do not use any type assertions.", "38"], + [0, 0, 0, "Unexpected any. Specify a different type.", "39"], [0, 0, 0, "Unexpected any. Specify a different type.", "40"], [0, 0, 0, "Do not use any type assertions.", "41"], [0, 0, 0, "Unexpected any. Specify a different type.", "42"], - [0, 0, 0, "Unexpected any. Specify a different type.", "43"], - [0, 0, 0, "Do not use any type assertions.", "44"], + [0, 0, 0, "Do not use any type assertions.", "43"], + [0, 0, 0, "Unexpected any. Specify a different type.", "44"], [0, 0, 0, "Unexpected any. Specify a different type.", "45"], [0, 0, 0, "Do not use any type assertions.", "46"], [0, 0, 0, "Unexpected any. Specify a different type.", "47"], - [0, 0, 0, "Unexpected any. Specify a different type.", "48"], - [0, 0, 0, "Do not use any type assertions.", "49"], + [0, 0, 0, "Do not use any type assertions.", "48"], + [0, 0, 0, "Unexpected any. Specify a different type.", "49"], [0, 0, 0, "Unexpected any. Specify a different type.", "50"], [0, 0, 0, "Do not use any type assertions.", "51"], [0, 0, 0, "Unexpected any. Specify a different type.", "52"], - [0, 0, 0, "Unexpected any. Specify a different type.", "53"], - [0, 0, 0, "Do not use any type assertions.", "54"], + [0, 0, 0, "Do not use any type assertions.", "53"], + [0, 0, 0, "Unexpected any. Specify a different type.", "54"], [0, 0, 0, "Unexpected any. Specify a different type.", "55"], [0, 0, 0, "Do not use any type assertions.", "56"], [0, 0, 0, "Unexpected any. Specify a different type.", "57"], - [0, 0, 0, "Unexpected any. Specify a different type.", "58"], - [0, 0, 0, "Do not use any type assertions.", "59"], + [0, 0, 0, "Do not use any type assertions.", "58"], + [0, 0, 0, "Unexpected any. Specify a different type.", "59"], [0, 0, 0, "Unexpected any. Specify a different type.", "60"], [0, 0, 0, "Do not use any type assertions.", "61"], [0, 0, 0, "Unexpected any. Specify a different type.", "62"], - [0, 0, 0, "Unexpected any. Specify a different type.", "63"], - [0, 0, 0, "Do not use any type assertions.", "64"], + [0, 0, 0, "Do not use any type assertions.", "63"], + [0, 0, 0, "Unexpected any. Specify a different type.", "64"], [0, 0, 0, "Unexpected any. Specify a different type.", "65"], [0, 0, 0, "Do not use any type assertions.", "66"], [0, 0, 0, "Unexpected any. Specify a different type.", "67"], - [0, 0, 0, "Unexpected any. Specify a different type.", "68"], - [0, 0, 0, "Do not use any type assertions.", "69"], + [0, 0, 0, "Do not use any type assertions.", "68"], + [0, 0, 0, "Unexpected any. Specify a different type.", "69"], [0, 0, 0, "Unexpected any. Specify a different type.", "70"], [0, 0, 0, "Do not use any type assertions.", "71"], [0, 0, 0, "Unexpected any. Specify a different type.", "72"], - [0, 0, 0, "Unexpected any. Specify a different type.", "73"], - [0, 0, 0, "Do not use any type assertions.", "74"], + [0, 0, 0, "Do not use any type assertions.", "73"], + [0, 0, 0, "Unexpected any. Specify a different type.", "74"], [0, 0, 0, "Unexpected any. Specify a different type.", "75"], [0, 0, 0, "Do not use any type assertions.", "76"], [0, 0, 0, "Unexpected any. Specify a different type.", "77"], - [0, 0, 0, "Unexpected any. Specify a different type.", "78"], - [0, 0, 0, "Do not use any type assertions.", "79"], - [0, 0, 0, "Unexpected any. Specify a different type.", "80"], - [0, 0, 0, "Do not use any type assertions.", "81"], - [0, 0, 0, "Unexpected any. Specify a different type.", "82"], - [0, 0, 0, "Do not use any type assertions.", "83"], - [0, 0, 0, "Unexpected any. Specify a different type.", "84"], - [0, 0, 0, "Do not use any type assertions.", "85"], - [0, 0, 0, "Unexpected any. Specify a different type.", "86"] - ], - "public/app/core/components/PanelTypeFilter/PanelTypeFilter.tsx:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"], - [0, 0, 0, "Unexpected any. Specify a different type.", "1"] + [0, 0, 0, "Do not use any type assertions.", "78"], + [0, 0, 0, "Unexpected any. Specify a different type.", "79"], + [0, 0, 0, "Do not use any type assertions.", "80"], + [0, 0, 0, "Unexpected any. Specify a different type.", "81"], + [0, 0, 0, "Do not use any type assertions.", "82"], + [0, 0, 0, "Unexpected any. Specify a different type.", "83"] ], "public/app/core/components/PasswordField/PasswordField.tsx:5381": [ [0, 0, 0, "Use data-testid for E2E selectors instead of aria-label", "0"] @@ -1577,40 +1567,25 @@ exports[`better eslint`] = { [0, 0, 0, "Unexpected any. Specify a different type.", "6"] ], "public/app/core/components/TagFilter/TagOption.tsx:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"], - [0, 0, 0, "Unexpected any. Specify a different type.", "1"] - ], - "public/app/core/components/TimelineChart/TimelineChart.tsx:5381": [ - [0, 0, 0, "Do not use any type assertions.", "0"] + [0, 0, 0, "Unexpected any. Specify a different type.", "0"] ], "public/app/core/components/connectWithCleanUp.tsx:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"], [0, 0, 0, "Do not use any type assertions.", "1"] ], - "public/app/core/components/modals/AngularModalProxy.tsx:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"] - ], - "public/app/core/navigation/GrafanaRoute.test.tsx:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"], - [0, 0, 0, "Unexpected any. Specify a different type.", "1"] - ], "public/app/core/navigation/__mocks__/routeProps.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"], - [0, 0, 0, "Unexpected any. Specify a different type.", "1"], - [0, 0, 0, "Unexpected any. Specify a different type.", "2"], - [0, 0, 0, "Unexpected any. Specify a different type.", "3"] + [0, 0, 0, "Unexpected any. Specify a different type.", "1"] ], "public/app/core/navigation/types.ts:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"], - [0, 0, 0, "Unexpected any. Specify a different type.", "1"] + [0, 0, 0, "Unexpected any. Specify a different type.", "0"] ], "public/app/core/reducers/root.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"], [0, 0, 0, "Unexpected any. Specify a different type.", "1"] ], "public/app/core/services/ResponseQueue.ts:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"], - [0, 0, 0, "Unexpected any. Specify a different type.", "1"] + [0, 0, 0, "Unexpected any. Specify a different type.", "0"] ], "public/app/core/services/backend_srv.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"], @@ -1633,10 +1608,8 @@ exports[`better eslint`] = { [0, 0, 0, "Unexpected any. Specify a different type.", "17"] ], "public/app/core/services/context_srv.ts:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"], - [0, 0, 0, "Unexpected any. Specify a different type.", "1"], - [0, 0, 0, "Do not use any type assertions.", "2"], - [0, 0, 0, "Unexpected any. Specify a different type.", "3"] + [0, 0, 0, "Do not use any type assertions.", "0"], + [0, 0, 0, "Unexpected any. Specify a different type.", "1"] ], "public/app/core/services/echo/backends/analytics/ApplicationInsightsBackend.ts:5381": [ [0, 0, 0, "Do not use any type assertions.", "0"], @@ -1681,9 +1654,6 @@ exports[`better eslint`] = { [0, 0, 0, "Unexpected any. Specify a different type.", "0"], [0, 0, 0, "Unexpected any. Specify a different type.", "1"] ], - "public/app/core/utils/acl.ts:5381": [ - [0, 0, 0, "Do not use any type assertions.", "0"] - ], "public/app/core/utils/connectWithReduxStore.tsx:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"], [0, 0, 0, "Unexpected any. Specify a different type.", "1"], @@ -1706,13 +1676,8 @@ exports[`better eslint`] = { [0, 0, 0, "Unexpected any. Specify a different type.", "3"], [0, 0, 0, "Unexpected any. Specify a different type.", "4"], [0, 0, 0, "Unexpected any. Specify a different type.", "5"], - [0, 0, 0, "Do not use any type assertions.", "6"], - [0, 0, 0, "Unexpected any. Specify a different type.", "7"], - [0, 0, 0, "Do not use any type assertions.", "8"], - [0, 0, 0, "Unexpected any. Specify a different type.", "9"], - [0, 0, 0, "Unexpected any. Specify a different type.", "10"], - [0, 0, 0, "Unexpected any. Specify a different type.", "11"], - [0, 0, 0, "Unexpected any. Specify a different type.", "12"] + [0, 0, 0, "Unexpected any. Specify a different type.", "6"], + [0, 0, 0, "Unexpected any. Specify a different type.", "7"] ], "public/app/core/utils/fetch.ts:5381": [ [0, 0, 0, "Do not use any type assertions.", "0"], @@ -1728,16 +1693,7 @@ exports[`better eslint`] = { [0, 0, 0, "Unexpected any. Specify a different type.", "10"] ], "public/app/core/utils/flatten.ts:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"], - [0, 0, 0, "Unexpected any. Specify a different type.", "1"], - [0, 0, 0, "Unexpected any. Specify a different type.", "2"], - [0, 0, 0, "Unexpected any. Specify a different type.", "3"], - [0, 0, 0, "Unexpected any. Specify a different type.", "4"], - [0, 0, 0, "Unexpected any. Specify a different type.", "5"] - ], - "public/app/core/utils/kbn.ts:5381": [ - [0, 0, 0, "Do not use any type assertions.", "0"], - [0, 0, 0, "Do not use any type assertions.", "1"] + [0, 0, 0, "Unexpected any. Specify a different type.", "0"] ], "public/app/core/utils/object.ts:5381": [ [0, 0, 0, "Do not use any type assertions.", "0"], @@ -2078,25 +2034,9 @@ exports[`better eslint`] = { [0, 0, 0, "Unexpected any. Specify a different type.", "3"], [0, 0, 0, "Unexpected any. Specify a different type.", "4"] ], - "public/app/features/canvas/elements/droneFront.tsx:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"], - [0, 0, 0, "Unexpected any. Specify a different type.", "1"] - ], - "public/app/features/canvas/elements/droneSide.tsx:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"], - [0, 0, 0, "Unexpected any. Specify a different type.", "1"] - ], - "public/app/features/canvas/elements/droneTop.tsx:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"], - [0, 0, 0, "Unexpected any. Specify a different type.", "1"] - ], "public/app/features/canvas/elements/notFound.tsx:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"] ], - "public/app/features/canvas/elements/windTurbine.tsx:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"], - [0, 0, 0, "Unexpected any. Specify a different type.", "1"] - ], "public/app/features/canvas/runtime/element.tsx:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"], [0, 0, 0, "Do not use any type assertions.", "1"], @@ -2192,9 +2132,6 @@ exports[`better eslint`] = { "public/app/features/dashboard/components/DashboardRow/DashboardRow.test.tsx:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"] ], - "public/app/features/dashboard/components/HelpWizard/randomizer.ts:5381": [ - [0, 0, 0, "Do not use any type assertions.", "0"] - ], "public/app/features/dashboard/components/Inspector/PanelInspector.tsx:5381": [ [0, 0, 0, "Do not use any type assertions.", "0"] ], @@ -2246,9 +2183,6 @@ exports[`better eslint`] = { [0, 0, 0, "Use data-testid for E2E selectors instead of aria-label", "0"], [0, 0, 0, "Use data-testid for E2E selectors instead of aria-label", "1"] ], - "public/app/features/dashboard/components/SaveDashboard/SaveDashboardErrorProxy.tsx:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"] - ], "public/app/features/dashboard/components/SaveDashboard/forms/SaveDashboardAsForm.test.tsx:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"] ], @@ -2259,12 +2193,10 @@ exports[`better eslint`] = { [0, 0, 0, "Use data-testid for E2E selectors instead of aria-label", "3"] ], "public/app/features/dashboard/components/SaveDashboard/types.ts:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"], - [0, 0, 0, "Unexpected any. Specify a different type.", "1"] + [0, 0, 0, "Unexpected any. Specify a different type.", "0"] ], "public/app/features/dashboard/components/SaveDashboard/useDashboardSave.tsx:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"], - [0, 0, 0, "Unexpected any. Specify a different type.", "1"] + [0, 0, 0, "Unexpected any. Specify a different type.", "0"] ], "public/app/features/dashboard/components/ShareModal/ShareExport.tsx:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"] @@ -2284,12 +2216,6 @@ exports[`better eslint`] = { [0, 0, 0, "Unexpected any. Specify a different type.", "3"], [0, 0, 0, "Use data-testid for E2E selectors instead of aria-label", "4"] ], - "public/app/features/dashboard/components/VersionHistory/__mocks__/dashboardHistoryMocks.ts:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"], - [0, 0, 0, "Unexpected any. Specify a different type.", "1"], - [0, 0, 0, "Unexpected any. Specify a different type.", "2"], - [0, 0, 0, "Unexpected any. Specify a different type.", "3"] - ], "public/app/features/dashboard/components/VersionHistory/useDashboardRestore.tsx:5381": [ [0, 0, 0, "Do not use any type assertions.", "0"], [0, 0, 0, "Unexpected any. Specify a different type.", "1"] @@ -2314,9 +2240,6 @@ exports[`better eslint`] = { "public/app/features/dashboard/dashgrid/DashboardPanel.tsx:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"] ], - "public/app/features/dashboard/dashgrid/LazyLoader.tsx:5381": [ - [0, 0, 0, "Do not use any type assertions.", "0"] - ], "public/app/features/dashboard/dashgrid/PanelChromeAngular.tsx:5381": [ [0, 0, 0, "Use data-testid for E2E selectors instead of aria-label", "0"] ], @@ -2337,24 +2260,14 @@ exports[`better eslint`] = { [0, 0, 0, "Unexpected any. Specify a different type.", "1"], [0, 0, 0, "Unexpected any. Specify a different type.", "2"], [0, 0, 0, "Unexpected any. Specify a different type.", "3"], - [0, 0, 0, "Unexpected any. Specify a different type.", "4"], - [0, 0, 0, "Unexpected any. Specify a different type.", "5"], - [0, 0, 0, "Unexpected any. Specify a different type.", "6"], - [0, 0, 0, "Unexpected any. Specify a different type.", "7"], - [0, 0, 0, "Unexpected any. Specify a different type.", "8"] - ], - "public/app/features/dashboard/services/DashboardSrv.ts:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"] + [0, 0, 0, "Unexpected any. Specify a different type.", "4"] ], "public/app/features/dashboard/services/PublicDashboardDataSource.ts:5381": [ [0, 0, 0, "Do not use any type assertions.", "0"] ], "public/app/features/dashboard/services/TimeSrv.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"], - [0, 0, 0, "Unexpected any. Specify a different type.", "1"], - [0, 0, 0, "Unexpected any. Specify a different type.", "2"], - [0, 0, 0, "Unexpected any. Specify a different type.", "3"], - [0, 0, 0, "Unexpected any. Specify a different type.", "4"] + [0, 0, 0, "Unexpected any. Specify a different type.", "1"] ], "public/app/features/dashboard/state/DashboardMigrator.test.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"], @@ -5072,28 +4985,15 @@ exports[`better eslint`] = { [0, 0, 0, "Do not use any type assertions.", "10"], [0, 0, 0, "Do not use any type assertions.", "11"] ], - "public/app/plugins/panel/canvas/CanvasPanel.tsx:5381": [ - [0, 0, 0, "Do not use any type assertions.", "0"], - [0, 0, 0, "Do not use any type assertions.", "1"] - ], - "public/app/plugins/panel/canvas/InlineEdit.tsx:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"], - [0, 0, 0, "Unexpected any. Specify a different type.", "1"] - ], "public/app/plugins/panel/canvas/InlineEditBody.tsx:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"], [0, 0, 0, "Unexpected any. Specify a different type.", "1"], [0, 0, 0, "Unexpected any. Specify a different type.", "2"], - [0, 0, 0, "Unexpected any. Specify a different type.", "3"], - [0, 0, 0, "Do not use any type assertions.", "4"], - [0, 0, 0, "Unexpected any. Specify a different type.", "5"] + [0, 0, 0, "Do not use any type assertions.", "3"], + [0, 0, 0, "Unexpected any. Specify a different type.", "4"] ], "public/app/plugins/panel/canvas/editor/APIEditor.tsx:5381": [ - [0, 0, 0, "Do not use any type assertions.", "0"], - [0, 0, 0, "Unexpected any. Specify a different type.", "1"], - [0, 0, 0, "Unexpected any. Specify a different type.", "2"], - [0, 0, 0, "Unexpected any. Specify a different type.", "3"], - [0, 0, 0, "Unexpected any. Specify a different type.", "4"] + [0, 0, 0, "Do not use any type assertions.", "0"] ], "public/app/plugins/panel/canvas/editor/PlacementEditor.tsx:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"] @@ -5117,9 +5017,6 @@ exports[`better eslint`] = { [0, 0, 0, "Do not use any type assertions.", "4"], [0, 0, 0, "Unexpected any. Specify a different type.", "5"] ], - "public/app/plugins/panel/canvas/utils.ts:5381": [ - [0, 0, 0, "Do not use any type assertions.", "0"] - ], "public/app/plugins/panel/dashlist/module.tsx:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"] ], @@ -5141,9 +5038,7 @@ exports[`better eslint`] = { "public/app/plugins/panel/geomap/components/MarkersLegend.tsx:5381": [ [0, 0, 0, "Do not use any type assertions.", "0"], [0, 0, 0, "Do not use any type assertions.", "1"], - [0, 0, 0, "Unexpected any. Specify a different type.", "2"], - [0, 0, 0, "Do not use any type assertions.", "3"], - [0, 0, 0, "Do not use any type assertions.", "4"] + [0, 0, 0, "Unexpected any. Specify a different type.", "2"] ], "public/app/plugins/panel/geomap/components/MeasureVectorLayer.ts:5381": [ [0, 0, 0, "Do not use any type assertions.", "0"], @@ -5172,9 +5067,6 @@ exports[`better eslint`] = { [0, 0, 0, "Unexpected any. Specify a different type.", "0"], [0, 0, 0, "Do not use any type assertions.", "1"] ], - "public/app/plugins/panel/geomap/layers/basemaps/carto.ts:5381": [ - [0, 0, 0, "Do not use any type assertions.", "0"] - ], "public/app/plugins/panel/geomap/layers/basemaps/esri.ts:5381": [ [0, 0, 0, "Do not use any type assertions.", "0"] ], @@ -5187,10 +5079,7 @@ exports[`better eslint`] = { ], "public/app/plugins/panel/geomap/migrations.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"], - [0, 0, 0, "Unexpected any. Specify a different type.", "1"], - [0, 0, 0, "Do not use any type assertions.", "2"], - [0, 0, 0, "Unexpected any. Specify a different type.", "3"], - [0, 0, 0, "Unexpected any. Specify a different type.", "4"] + [0, 0, 0, "Unexpected any. Specify a different type.", "1"] ], "public/app/plugins/panel/geomap/utils/layers.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"], @@ -5200,8 +5089,7 @@ exports[`better eslint`] = { [0, 0, 0, "Unexpected any. Specify a different type.", "0"] ], "public/app/plugins/panel/geomap/utils/tootltip.ts:5381": [ - [0, 0, 0, "Do not use any type assertions.", "0"], - [0, 0, 0, "Do not use any type assertions.", "1"] + [0, 0, 0, "Do not use any type assertions.", "0"] ], "public/app/plugins/panel/graph/GraphContextMenuCtrl.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"], @@ -5546,11 +5434,6 @@ exports[`better eslint`] = { [0, 0, 0, "Unexpected any. Specify a different type.", "2"], [0, 0, 0, "Unexpected any. Specify a different type.", "3"] ], - "public/app/plugins/panel/heatmap/HeatmapHoverView.tsx:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"], - [0, 0, 0, "Unexpected any. Specify a different type.", "1"], - [0, 0, 0, "Unexpected any. Specify a different type.", "2"] - ], "public/app/plugins/panel/heatmap/HeatmapPanel.tsx:5381": [ [0, 0, 0, "Do not use any type assertions.", "0"], [0, 0, 0, "Do not use any type assertions.", "1"], @@ -5595,8 +5478,7 @@ exports[`better eslint`] = { [0, 0, 0, "Do not use any type assertions.", "15"], [0, 0, 0, "Do not use any type assertions.", "16"], [0, 0, 0, "Do not use any type assertions.", "17"], - [0, 0, 0, "Do not use any type assertions.", "18"], - [0, 0, 0, "Do not use any type assertions.", "19"] + [0, 0, 0, "Do not use any type assertions.", "18"] ], "public/app/plugins/panel/histogram/Histogram.tsx:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"], @@ -5621,9 +5503,7 @@ exports[`better eslint`] = { "public/app/plugins/panel/live/LivePanel.tsx:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"], [0, 0, 0, "Unexpected any. Specify a different type.", "1"], - [0, 0, 0, "Do not use any type assertions.", "2"], - [0, 0, 0, "Do not use any type assertions.", "3"], - [0, 0, 0, "Unexpected any. Specify a different type.", "4"] + [0, 0, 0, "Do not use any type assertions.", "2"] ], "public/app/plugins/panel/live/types.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"] @@ -5653,12 +5533,6 @@ exports[`better eslint`] = { [0, 0, 0, "Do not use any type assertions.", "0"], [0, 0, 0, "Do not use any type assertions.", "1"] ], - "public/app/plugins/panel/nodeGraph/usePanning.ts:5381": [ - [0, 0, 0, "Do not use any type assertions.", "0"], - [0, 0, 0, "Unexpected any. Specify a different type.", "1"], - [0, 0, 0, "Do not use any type assertions.", "2"], - [0, 0, 0, "Do not use any type assertions.", "3"] - ], "public/app/plugins/panel/nodeGraph/utils.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"], [0, 0, 0, "Unexpected any. Specify a different type.", "1"], @@ -5839,12 +5713,6 @@ exports[`better eslint`] = { [0, 0, 0, "Unexpected any. Specify a different type.", "2"], [0, 0, 0, "Do not use any type assertions.", "3"] ], - "public/app/plugins/panel/timeseries/SpanNullsEditor.tsx:5381": [ - [0, 0, 0, "Do not use any type assertions.", "0"], - [0, 0, 0, "Do not use any type assertions.", "1"], - [0, 0, 0, "Do not use any type assertions.", "2"], - [0, 0, 0, "Unexpected any. Specify a different type.", "3"] - ], "public/app/plugins/panel/timeseries/migrations.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"], [0, 0, 0, "Do not use any type assertions.", "1"], @@ -5874,12 +5742,10 @@ exports[`better eslint`] = { [0, 0, 0, "Do not use any type assertions.", "0"] ], "public/app/plugins/panel/timeseries/suggestions.ts:5381": [ - [0, 0, 0, "Do not use any type assertions.", "0"], - [0, 0, 0, "Unexpected any. Specify a different type.", "1"] + [0, 0, 0, "Do not use any type assertions.", "0"] ], "public/app/plugins/panel/trend/suggestions.ts:5381": [ - [0, 0, 0, "Do not use any type assertions.", "0"], - [0, 0, 0, "Unexpected any. Specify a different type.", "1"] + [0, 0, 0, "Do not use any type assertions.", "0"] ], "public/app/plugins/panel/xychart/AutoEditor.tsx:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"] diff --git a/packages/grafana-ui/src/components/Forms/Legacy/Select/Select.tsx b/packages/grafana-ui/src/components/Forms/Legacy/Select/Select.tsx index 50c0438084c..9258232c331 100644 --- a/packages/grafana-ui/src/components/Forms/Legacy/Select/Select.tsx +++ b/packages/grafana-ui/src/components/Forms/Legacy/Select/Select.tsx @@ -240,6 +240,7 @@ export class AsyncSelect extends PureComponent> { value={value} //@ts-expect-error getOptionLabel={getOptionLabel} + //@ts-expect-error getOptionValue={getOptionValue} menuShouldScrollIntoView={false} onChange={onChange} diff --git a/packages/grafana-ui/src/components/Select/types.ts b/packages/grafana-ui/src/components/Select/types.ts index 3994d86c78a..b71874b1744 100644 --- a/packages/grafana-ui/src/components/Select/types.ts +++ b/packages/grafana-ui/src/components/Select/types.ts @@ -37,7 +37,7 @@ export interface SelectCommonProps { /** Function for formatting the text that is displayed when creating a new value*/ formatCreateLabel?: (input: string) => string; getOptionLabel?: (item: SelectableValue) => React.ReactNode; - getOptionValue?: (item: SelectableValue) => string; + getOptionValue?: (item: SelectableValue) => T | undefined; hideSelectedOptions?: boolean; inputValue?: string; invalid?: boolean; diff --git a/public/app/core/components/Login/LoginCtrl.tsx b/public/app/core/components/Login/LoginCtrl.tsx index 9ae577ad3ed..72a9d1aa8be 100644 --- a/public/app/core/components/Login/LoginCtrl.tsx +++ b/public/app/core/components/Login/LoginCtrl.tsx @@ -5,6 +5,8 @@ import { getBackendSrv } from '@grafana/runtime'; import appEvents from 'app/core/app_events'; import config from 'app/core/config'; +import { LoginDTO } from './types'; + const isOauthEnabled = () => { return !!config.oauth && Object.keys(config.oauth).length > 0; }; @@ -38,7 +40,7 @@ interface State { } export class LoginCtrl extends PureComponent { - result: any = {}; + result: LoginDTO | undefined; constructor(props: Props) { super(props); @@ -87,7 +89,7 @@ export class LoginCtrl extends PureComponent { }); getBackendSrv() - .post('/login', formModel) + .post('/login', formModel) .then((result) => { this.result = result; if (formModel.password !== 'admin' || config.ldapEnabled || config.authProxyEnabled) { @@ -112,7 +114,7 @@ export class LoginCtrl extends PureComponent { toGrafana = () => { // Use window.location.href to force page reload - if (this.result.redirectUrl) { + if (this.result?.redirectUrl) { if (config.appSubUrl !== '' && !this.result.redirectUrl.startsWith(config.appSubUrl)) { window.location.assign(config.appSubUrl + this.result.redirectUrl); } else { diff --git a/public/app/core/components/Login/types.ts b/public/app/core/components/Login/types.ts new file mode 100644 index 00000000000..4ca72bb46ae --- /dev/null +++ b/public/app/core/components/Login/types.ts @@ -0,0 +1,4 @@ +export interface LoginDTO { + message: string; + redirectUrl: string; +} diff --git a/public/app/core/components/OptionsUI/registry.tsx b/public/app/core/components/OptionsUI/registry.tsx index 3f6fea77291..7f5681609dd 100644 --- a/public/app/core/components/OptionsUI/registry.tsx +++ b/public/app/core/components/OptionsUI/registry.tsx @@ -87,21 +87,21 @@ export const getAllOptionEditors = () => { }, }; - const select: StandardEditorsRegistryItem = { + const select: StandardEditorsRegistryItem = { id: 'select', name: 'Select', description: 'Allows option selection', editor: SelectValueEditor as any, }; - const multiSelect: StandardEditorsRegistryItem = { + const multiSelect: StandardEditorsRegistryItem = { id: 'multi-select', name: 'Multi select', description: 'Allows for multiple option selection', editor: MultiSelectValueEditor as any, }; - const radio: StandardEditorsRegistryItem = { + const radio: StandardEditorsRegistryItem = { id: 'radio', name: 'Radio', description: 'Allows option selection', diff --git a/public/app/core/components/PanelTypeFilter/PanelTypeFilter.tsx b/public/app/core/components/PanelTypeFilter/PanelTypeFilter.tsx index 14cc84f8b76..ca93e4fb182 100644 --- a/public/app/core/components/PanelTypeFilter/PanelTypeFilter.tsx +++ b/public/app/core/components/PanelTypeFilter/PanelTypeFilter.tsx @@ -32,8 +32,8 @@ export const PanelTypeFilter = ({ onChange: propsOnChange, maxMenuHeight }: Prop const selectOptions = { defaultOptions: true, - getOptionLabel: (i: any) => i.label, - getOptionValue: (i: any) => i.value, + getOptionLabel: (i: SelectableValue) => i.label, + getOptionValue: (i: SelectableValue) => i.value, noOptionsMessage: 'No Panel types found', placeholder: 'Filter by type', maxMenuHeight, @@ -56,7 +56,7 @@ export const PanelTypeFilter = ({ onChange: propsOnChange, maxMenuHeight }: Prop Clear types )} - } aria-label="Panel Type filter" /> + {...selectOptions} prefix={} aria-label="Panel Type filter" /> ); }; diff --git a/public/app/core/components/TagFilter/TagOption.tsx b/public/app/core/components/TagFilter/TagOption.tsx index fab2dff7cb8..fbec9997007 100644 --- a/public/app/core/components/TagFilter/TagOption.tsx +++ b/public/app/core/components/TagFilter/TagOption.tsx @@ -7,7 +7,7 @@ import { useStyles2 } from '@grafana/ui'; import { TagBadge } from './TagBadge'; -export const TagOption = ({ data, className, label, isFocused, innerProps }: OptionProps) => { +export const TagOption = ({ data, className, label, isFocused, innerProps }: OptionProps) => { const styles = useStyles2(getStyles); return ( diff --git a/public/app/core/components/TimelineChart/TimelineChart.tsx b/public/app/core/components/TimelineChart/TimelineChart.tsx index f5085987c81..926a1f64532 100644 --- a/public/app/core/components/TimelineChart/TimelineChart.tsx +++ b/public/app/core/components/TimelineChart/TimelineChart.tsx @@ -32,7 +32,7 @@ const propsToDiff = ['rowHeight', 'colWidth', 'showValue', 'mergeValues', 'align export class TimelineChart extends React.Component { declare context: React.ContextType; static contextType = PanelContextRoot; - panelContext: PanelContext = {} as PanelContext; + panelContext: PanelContext | undefined; getValueColor = (frameIdx: number, fieldIdx: number, value: unknown) => { const field = this.props.frames[frameIdx].fields[fieldIdx]; diff --git a/public/app/core/components/modals/AngularModalProxy.tsx b/public/app/core/components/modals/AngularModalProxy.tsx index 2231f856ef4..fe21787dc3b 100644 --- a/public/app/core/components/modals/AngularModalProxy.tsx +++ b/public/app/core/components/modals/AngularModalProxy.tsx @@ -7,7 +7,7 @@ import { connectWithProvider } from '../../utils/connectWithReduxStore'; /** * Component that enables rendering React modals from Angular */ -export const AngularModalProxy = connectWithProvider((props: any) => { +export const AngularModalProxy = connectWithProvider((props: Record) => { return ( <> diff --git a/public/app/core/navigation/GrafanaRoute.test.tsx b/public/app/core/navigation/GrafanaRoute.test.tsx index 8fcc532a4d4..46c99b24139 100644 --- a/public/app/core/navigation/GrafanaRoute.test.tsx +++ b/public/app/core/navigation/GrafanaRoute.test.tsx @@ -9,6 +9,7 @@ import { setEchoSrv } from '@grafana/runtime'; import { Echo } from '../services/echo/Echo'; import { GrafanaRoute, Props } from './GrafanaRoute'; +import { GrafanaRouteComponentProps } from './types'; function setup(overrides: Partial) { const props: Props = { @@ -35,14 +36,14 @@ describe('GrafanaRoute', () => { }); it('Parses search', () => { - let capturedProps: any; - const PageComponent = (props: any) => { + let capturedProps: GrafanaRouteComponentProps; + const PageComponent = (props: GrafanaRouteComponentProps) => { capturedProps = props; return
; }; setup({ route: { component: PageComponent, path: '' } }); - expect(capturedProps.queryParams.query).toBe('hello'); + expect(capturedProps!.queryParams.query).toBe('hello'); }); it('Shows loading on lazy load', async () => { diff --git a/public/app/core/navigation/__mocks__/routeProps.ts b/public/app/core/navigation/__mocks__/routeProps.ts index 260d4d58a79..23eac8bf7ad 100644 --- a/public/app/core/navigation/__mocks__/routeProps.ts +++ b/public/app/core/navigation/__mocks__/routeProps.ts @@ -9,10 +9,16 @@ export function getRouteComponentProps = { history: createMemoryHistory(), location: { + hash: '', + pathname: '', + state: {}, search: '', - } as any, + }, match: { params: {} } as any, - route: {} as any, + route: { + path: '', + component: () => null, + }, queryParams: {} as any, }; diff --git a/public/app/core/navigation/types.ts b/public/app/core/navigation/types.ts index 8ccd484eb19..5a06963cd0e 100644 --- a/public/app/core/navigation/types.ts +++ b/public/app/core/navigation/types.ts @@ -12,7 +12,7 @@ export type GrafanaRouteComponent = React.ComponentType; + component: GrafanaRouteComponent; roles?: () => string[]; pageClass?: string; /** Can be used like an id for the route if the same component is used by many routes */ diff --git a/public/app/core/services/ResponseQueue.ts b/public/app/core/services/ResponseQueue.ts index 567263bd8bd..8fd4ca59004 100644 --- a/public/app/core/services/ResponseQueue.ts +++ b/public/app/core/services/ResponseQueue.ts @@ -16,8 +16,8 @@ interface FetchResponsesEntry { } export class ResponseQueue { - private queue: Subject = new Subject(); // internal stream for requests that are to be executed - private responses: Subject> = new Subject>(); // external stream with responses from fetch + private queue = new Subject(); // internal stream for requests that are to be executed + private responses = new Subject>(); // external stream with responses from fetch constructor(fetchQueue: FetchQueue, fetch: (options: BackendSrvRequest) => Observable>) { // This will create an implicit live subscription for as long as this class lives. diff --git a/public/app/core/services/context_srv.ts b/public/app/core/services/context_srv.ts index 06057e46e1b..d29bbc26a16 100644 --- a/public/app/core/services/context_srv.ts +++ b/public/app/core/services/context_srv.ts @@ -63,8 +63,6 @@ export class User implements Omit { } export class ContextSrv { - pinned: any; - version: any; user: User; isSignedIn: boolean; isGrafanaAdmin: boolean; diff --git a/public/app/core/utils/acl.ts b/public/app/core/utils/acl.ts index e8aeaa60fec..eadce788d2e 100644 --- a/public/app/core/utils/acl.ts +++ b/public/app/core/utils/acl.ts @@ -5,7 +5,7 @@ export function processAclItems(items: DashboardAclDTO[]): DashboardAcl[] { } function processAclItem(dto: DashboardAclDTO): DashboardAcl { - const item = dto as DashboardAcl; + const item: DashboardAcl = dto; item.sortRank = 0; diff --git a/public/app/core/utils/explore.ts b/public/app/core/utils/explore.ts index fbea62123d7..c19c5b3e405 100644 --- a/public/app/core/utils/explore.ts +++ b/public/app/core/utils/explore.ts @@ -195,7 +195,7 @@ export const safeParseJson = (text?: string): any | undefined => { } }; -export const safeStringifyValue = (value: any, space?: number) => { +export const safeStringifyValue = (value: unknown, space?: number) => { if (value === undefined || value === null) { return ''; } @@ -469,8 +469,8 @@ export const getTimeRangeFromUrl = ( }; return { - from: dateMath.parse(raw.from, false, timeZone as any)!, - to: dateMath.parse(raw.to, true, timeZone as any)!, + from: dateMath.parse(raw.from, false, timeZone)!, + to: dateMath.parse(raw.to, true, timeZone)!, raw, }; }; diff --git a/public/app/core/utils/flatten.ts b/public/app/core/utils/flatten.ts index 1dcccbefe10..47bdba83fbe 100644 --- a/public/app/core/utils/flatten.ts +++ b/public/app/core/utils/flatten.ts @@ -1,13 +1,16 @@ // Copyright (c) 2014, Hugh Kennedy // Based on code from https://github.com/hughsk/flat/blob/master/index.js // -export default function flatten(target: object, opts?: { delimiter?: any; maxDepth?: any; safe?: any }): any { +export default function flatten( + target: object, + opts?: { delimiter?: string; maxDepth?: number; safe?: boolean } +): Record { opts = opts || {}; const delimiter = opts.delimiter || '.'; let maxDepth = opts.maxDepth || 3; let currentDepth = 1; - const output: any = {}; + const output: Record = {}; function step(object: any, prev: string | null) { Object.keys(object).forEach((key) => { diff --git a/public/app/core/utils/kbn.ts b/public/app/core/utils/kbn.ts index e4a01b47e54..f36ebc2e9b9 100644 --- a/public/app/core/utils/kbn.ts +++ b/public/app/core/utils/kbn.ts @@ -12,8 +12,9 @@ import { escapeRegex, } from '@grafana/data'; +const valueFormats: ValueFormatterIndex = {}; const kbn = { - valueFormats: {} as ValueFormatterIndex, + valueFormats, intervalRegex: /(\d+(?:\.\d+)?)(ms|[Mwdhmsy])/, intervalsInSeconds: { y: 31536000, @@ -24,7 +25,7 @@ const kbn = { m: 60, s: 1, ms: 0.001, - } as { [index: string]: number }, + } as const, /** @deprecated since 9.4, use grafana/data */ regexEscape: (value: string): string => { deprecationWarning('kbn.ts', 'kbn.regexEscape()', 'escapeRegex from @grafana/data'); diff --git a/public/app/features/canvas/elements/droneFront.tsx b/public/app/features/canvas/elements/droneFront.tsx index f06b6eb2f5c..c91a92fe62f 100644 --- a/public/app/features/canvas/elements/droneFront.tsx +++ b/public/app/features/canvas/elements/droneFront.tsx @@ -69,7 +69,7 @@ const DroneFrontDisplay = ({ data }: CanvasElementProps = { +export const droneFrontItem: CanvasElementItem = { id: 'droneFront', name: 'Drone Front', description: 'Drone front', diff --git a/public/app/features/canvas/elements/droneSide.tsx b/public/app/features/canvas/elements/droneSide.tsx index 76c2cdd18eb..bc84404b19a 100644 --- a/public/app/features/canvas/elements/droneSide.tsx +++ b/public/app/features/canvas/elements/droneSide.tsx @@ -68,7 +68,7 @@ const DroneSideDisplay = ({ data }: CanvasElementProps = { +export const droneSideItem: CanvasElementItem = { id: 'droneSide', name: 'Drone Side', description: 'Drone Side', diff --git a/public/app/features/canvas/elements/droneTop.tsx b/public/app/features/canvas/elements/droneTop.tsx index 6551f37ad9d..84a14885b5f 100644 --- a/public/app/features/canvas/elements/droneTop.tsx +++ b/public/app/features/canvas/elements/droneTop.tsx @@ -80,7 +80,7 @@ const DroneTopDisplay = ({ data }: CanvasElementProps = { +export const droneTopItem: CanvasElementItem = { id: 'droneTop', name: 'Drone Top', description: 'Drone top', diff --git a/public/app/features/canvas/elements/windTurbine.tsx b/public/app/features/canvas/elements/windTurbine.tsx index 59b2ce7e0ff..db593e265e6 100644 --- a/public/app/features/canvas/elements/windTurbine.tsx +++ b/public/app/features/canvas/elements/windTurbine.tsx @@ -64,7 +64,7 @@ const WindTurbineDisplay = ({ data }: CanvasElementProps = { +export const windTurbineItem: CanvasElementItem = { id: 'windTurbine', name: 'Wind Turbine', description: 'Spinny spinny', diff --git a/public/app/features/dashboard/components/HelpWizard/randomizer.ts b/public/app/features/dashboard/components/HelpWizard/randomizer.ts index d54a0ae9405..c082e5d3ecc 100644 --- a/public/app/features/dashboard/components/HelpWizard/randomizer.ts +++ b/public/app/features/dashboard/components/HelpWizard/randomizer.ts @@ -66,8 +66,7 @@ export function randomizeData(data: DataFrameJSON[], opts: Randomize): DataFrame if (opts.values) { schema.fields.forEach((f, idx) => { if (f.type === FieldType.string && data) { - // eslint-ignore-next-line - const v = data.values[idx].map((v) => rand(v as string)); + const v = data.values[idx].map((v) => rand(String(v))); data.values[idx] = v; } }); diff --git a/public/app/features/dashboard/components/SaveDashboard/SaveDashboardErrorProxy.tsx b/public/app/features/dashboard/components/SaveDashboard/SaveDashboardErrorProxy.tsx index f8a7fff8496..9f9addf0a94 100644 --- a/public/app/features/dashboard/components/SaveDashboard/SaveDashboardErrorProxy.tsx +++ b/public/app/features/dashboard/components/SaveDashboard/SaveDashboardErrorProxy.tsx @@ -14,7 +14,7 @@ interface SaveDashboardErrorProxyProps { /** original dashboard */ dashboard: DashboardModel; /** dashboard save model with applied modifications, i.e. title */ - dashboardSaveModel: any; + dashboardSaveModel: DashboardModel; error: FetchError; onDismiss: () => void; } diff --git a/public/app/features/dashboard/components/SaveDashboard/types.ts b/public/app/features/dashboard/components/SaveDashboard/types.ts index 084ff68b517..9f0dcd447c0 100644 --- a/public/app/features/dashboard/components/SaveDashboard/types.ts +++ b/public/app/features/dashboard/components/SaveDashboard/types.ts @@ -28,7 +28,7 @@ export interface SaveDashboardFormProps { dashboard: DashboardModel; onCancel: () => void; onSuccess: () => void; - onSubmit?: (clone: any, options: SaveDashboardOptions, dashboard: DashboardModel) => Promise; + onSubmit?: (clone: DashboardModel, options: SaveDashboardOptions, dashboard: DashboardModel) => Promise; } export interface SaveDashboardModalProps { diff --git a/public/app/features/dashboard/components/SaveDashboard/useDashboardSave.tsx b/public/app/features/dashboard/components/SaveDashboard/useDashboardSave.tsx index 391ac86c90f..41f7c977199 100644 --- a/public/app/features/dashboard/components/SaveDashboard/useDashboardSave.tsx +++ b/public/app/features/dashboard/components/SaveDashboard/useDashboardSave.tsx @@ -29,7 +29,7 @@ export const useDashboardSave = (dashboard: DashboardModel, isCopy = false) => { const dispatch = useDispatch(); const notifyApp = useAppNotification(); const [state, onDashboardSave] = useAsyncFn( - async (clone: any, options: SaveDashboardOptions, dashboard: DashboardModel) => { + async (clone: DashboardModel, options: SaveDashboardOptions, dashboard: DashboardModel) => { try { const result = await saveDashboard(clone, options, dashboard); dashboard.version = result.version; diff --git a/public/app/features/dashboard/components/VersionHistory/__mocks__/dashboardHistoryMocks.ts b/public/app/features/dashboard/components/VersionHistory/__mocks__/dashboardHistoryMocks.ts index a19e1264dd5..517bf6a183b 100644 --- a/public/app/features/dashboard/components/VersionHistory/__mocks__/dashboardHistoryMocks.ts +++ b/public/app/features/dashboard/components/VersionHistory/__mocks__/dashboardHistoryMocks.ts @@ -48,11 +48,7 @@ export function versions() { ]; } -export function compare(type: any) { - return type === 'basic' ? '
' : '
'; -} - -export function restore(version: any, restoredFrom?: any): any { +export function restore(version: number, restoredFrom?: number) { return { dashboard: { meta: { diff --git a/public/app/features/dashboard/dashgrid/LazyLoader.tsx b/public/app/features/dashboard/dashgrid/LazyLoader.tsx index 1170d2fb0c0..6bf02bf7bf4 100644 --- a/public/app/features/dashboard/dashgrid/LazyLoader.tsx +++ b/public/app/features/dashboard/dashgrid/LazyLoader.tsx @@ -50,7 +50,8 @@ export function LazyLoader({ children, width, height, onLoad, onChange }: Props) ); } -LazyLoader.callbacks = {} as Record void>; +const callbacks: Record void> = {}; +LazyLoader.callbacks = callbacks; LazyLoader.addCallback = (id: string, c: (e: IntersectionObserverEntry) => void) => (LazyLoader.callbacks[id] = c); LazyLoader.observer = new IntersectionObserver( (entries) => { diff --git a/public/app/features/dashboard/services/DashboardLoaderSrv.ts b/public/app/features/dashboard/services/DashboardLoaderSrv.ts index a86a81bd057..9633c06020d 100644 --- a/public/app/features/dashboard/services/DashboardLoaderSrv.ts +++ b/public/app/features/dashboard/services/DashboardLoaderSrv.ts @@ -48,7 +48,7 @@ export class DashboardLoaderSrv { } else if (type === 'public') { promise = backendSrv .getPublicDashboardByUid(uid) - .then((result: any) => { + .then((result) => { return result; }) .catch((e) => { @@ -73,7 +73,7 @@ export class DashboardLoaderSrv { } else { promise = backendSrv .getDashboardByUid(uid) - .then((result: any) => { + .then((result) => { if (result.meta.isFolder) { appEvents.emit(AppEvents.alertError, ['Dashboard not found']); throw new Error('Dashboard not found'); @@ -114,7 +114,7 @@ export class DashboardLoaderSrv { dashboard: result.data, }; }, - (err: any) => { + (err) => { console.error('Script dashboard error ' + err); appEvents.emit(AppEvents.alertError, [ 'Script Error', @@ -142,7 +142,7 @@ export class DashboardLoaderSrv { return Promise.reject('expecting path parameter'); } - const queryParams: { [key: string]: any } = {}; + const queryParams: { [key: string]: string } = {}; params.forEach((value, key) => { queryParams[key] = value; diff --git a/public/app/features/dashboard/services/DashboardSrv.ts b/public/app/features/dashboard/services/DashboardSrv.ts index 61a9b83494b..b562b70b853 100644 --- a/public/app/features/dashboard/services/DashboardSrv.ts +++ b/public/app/features/dashboard/services/DashboardSrv.ts @@ -2,6 +2,7 @@ import { lastValueFrom } from 'rxjs'; import { AppEvents } from '@grafana/data'; import { BackendSrvRequest } from '@grafana/runtime'; +import { Dashboard } from '@grafana/schema'; import { appEvents } from 'app/core/app_events'; import { t } from 'app/core/internationalization'; import { getBackendSrv } from 'app/core/services/backend_srv'; @@ -45,7 +46,7 @@ export class DashboardSrv { appEvents.subscribe(RemovePanelEvent, (e) => this.onRemovePanel(e.payload)); } - create(dashboard: any, meta: DashboardMeta) { + create(dashboard: Dashboard, meta: DashboardMeta) { return new DashboardModel(dashboard, meta); } diff --git a/public/app/features/dashboard/services/TimeSrv.ts b/public/app/features/dashboard/services/TimeSrv.ts index 273c7924bc9..94e13f3de82 100644 --- a/public/app/features/dashboard/services/TimeSrv.ts +++ b/public/app/features/dashboard/services/TimeSrv.ts @@ -22,17 +22,18 @@ import { TimeModel } from '../state/TimeModel'; import { getRefreshFromUrl } from '../utils/getRefreshFromUrl'; export class TimeSrv { - time: any; + time: RawTimeRange; refreshTimer: number | undefined; refresh: any; oldRefresh: string | null | undefined; timeModel?: TimeModel; - timeAtLoad: any; + timeAtLoad: RawTimeRange; private autoRefreshBlocked?: boolean; constructor(private contextSrv: ContextSrv) { // default time this.time = getDefaultTimeRange().raw; + this.timeAtLoad = getDefaultTimeRange().raw; this.refreshTimeModel = this.refreshTimeModel.bind(this); appEvents.subscribe(ZoomOutEvent, (e) => { @@ -105,7 +106,7 @@ export class TimeSrv { } } - private parseUrlParam(value: any) { + private parseUrlParam(value: string) { if (value.indexOf('now') !== -1) { return value; } @@ -121,7 +122,7 @@ export class TimeSrv { } } - if (!isNaN(value)) { + if (!isNaN(Number(value))) { const epoch = parseInt(value, 10); return toUtc(epoch); } diff --git a/public/app/plugins/panel/canvas/CanvasPanel.tsx b/public/app/plugins/panel/canvas/CanvasPanel.tsx index e7a00e702f4..9ee04d1b349 100644 --- a/public/app/plugins/panel/canvas/CanvasPanel.tsx +++ b/public/app/plugins/panel/canvas/CanvasPanel.tsx @@ -44,7 +44,7 @@ export const activePanelSubject = new ReplaySubject(1); export class CanvasPanel extends Component { declare context: React.ContextType; static contextType = PanelContextRoot; - panelContext: PanelContext = {} as PanelContext; + panelContext: PanelContext | undefined; readonly scene: Scene; private subs = new Subscription(); @@ -104,7 +104,7 @@ export class CanvasPanel extends Component { activeCanvasPanel = this; activePanelSubject.next({ panel: this }); - this.panelContext = this.context as PanelContext; + this.panelContext = this.context; if (this.panelContext.onInstanceStateChange) { this.panelContext.onInstanceStateChange({ scene: this.scene, @@ -126,7 +126,7 @@ export class CanvasPanel extends Component { } }); - this.panelContext.onInstanceStateChange!({ + this.panelContext?.onInstanceStateChange!({ scene: this.scene, selected: v, layer: this.scene.root, @@ -142,7 +142,7 @@ export class CanvasPanel extends Component { return; } - this.panelContext.onInstanceStateChange!({ + this.panelContext?.onInstanceStateChange!({ scene: this.scene, selected: this.context.instanceState.selected, selectedConnection: v, diff --git a/public/app/plugins/panel/canvas/InlineEdit.tsx b/public/app/plugins/panel/canvas/InlineEdit.tsx index f8784769b26..666f555f753 100644 --- a/public/app/plugins/panel/canvas/InlineEdit.tsx +++ b/public/app/plugins/panel/canvas/InlineEdit.tsx @@ -1,6 +1,6 @@ import { css } from '@emotion/css'; import React, { SyntheticEvent, useEffect, useRef, useState } from 'react'; -import Draggable from 'react-draggable'; +import Draggable, { DraggableEventHandler } from 'react-draggable'; import { Resizable, ResizeCallbackData } from 'react-resizable'; import { Dimensions2D, GrafanaTheme2 } from '@grafana/data'; @@ -53,7 +53,7 @@ export function InlineEdit({ onClose, id, scene }: Props) { } }, [windowHeight, windowWidth, placement, measurements]); - const onDragStop = (event: any, dragElement: any) => { + const onDragStop: DraggableEventHandler = (event, dragElement) => { let x = dragElement.x < 0 ? 0 : dragElement.x; let y = dragElement.y < 0 ? 0 : dragElement.y; diff --git a/public/app/plugins/panel/canvas/InlineEditBody.tsx b/public/app/plugins/panel/canvas/InlineEditBody.tsx index b6344125491..4aecb720e46 100644 --- a/public/app/plugins/panel/canvas/InlineEditBody.tsx +++ b/public/app/plugins/panel/canvas/InlineEditBody.tsx @@ -138,8 +138,8 @@ function getOptionsPaneCategoryDescriptor( }; const access: NestedValueAccess = { - getValue: (path: string) => lodashGet(props.options, path), - onChange: (path: string, value: any) => { + getValue: (path) => lodashGet(props.options, path), + onChange: (path, value) => { props.onChange(setOptionImmutably(props.options as any, path, value)); }, }; diff --git a/public/app/plugins/panel/canvas/editor/APIEditor.tsx b/public/app/plugins/panel/canvas/editor/APIEditor.tsx index 6d3fe3d891e..2118657ff04 100644 --- a/public/app/plugins/panel/canvas/editor/APIEditor.tsx +++ b/public/app/plugins/panel/canvas/editor/APIEditor.tsx @@ -11,9 +11,9 @@ export interface APIEditorConfig { data?: string; } -const dummyStringSettings: StandardEditorsRegistryItem = { +const dummyStringSettings = { settings: {}, -} as any; +} as StandardEditorsRegistryItem; export const callApi = (api: APIEditorConfig, isTest = false) => { if (api) { @@ -24,7 +24,7 @@ export const callApi = (api: APIEditorConfig, isTest = false) => { data: api.data ?? {}, }) .subscribe({ - error: (error: any) => { + error: (error) => { if (isTest) { appEvents.emit(AppEvents.alertError, ['Error has occurred: ', JSON.stringify(error)]); console.error(error); @@ -39,7 +39,7 @@ export const callApi = (api: APIEditorConfig, isTest = false) => { } }; -type Props = StandardEditorProps; +type Props = StandardEditorProps; export function APIEditor({ value, context, onChange }: Props) { const labelWidth = 9; diff --git a/public/app/plugins/panel/canvas/utils.ts b/public/app/plugins/panel/canvas/utils.ts index 26fac0ec0a6..a61767d9b2a 100644 --- a/public/app/plugins/panel/canvas/utils.ts +++ b/public/app/plugins/panel/canvas/utils.ts @@ -82,8 +82,11 @@ export function getElementTypesOptions(items: CanvasElementItem[], current: stri export function onAddItem(sel: SelectableValue, rootLayer: FrameState | undefined, anchorPoint?: AnchorPoint) { const newItem = canvasElementRegistry.getIfExists(sel.value) ?? notFoundItem; - const newElementOptions = newItem.getNewOptions() as CanvasElementOptions; - newElementOptions.type = newItem.id; + const newElementOptions: CanvasElementOptions = { + ...newItem.getNewOptions(), + type: newItem.id, + name: '', + }; if (anchorPoint) { newElementOptions.placement = { ...newElementOptions.placement, top: anchorPoint.y, left: anchorPoint.x }; diff --git a/public/app/plugins/panel/geomap/components/MarkersLegend.tsx b/public/app/plugins/panel/geomap/components/MarkersLegend.tsx index 4fac7e82e70..cc036bf8e72 100644 --- a/public/app/plugins/panel/geomap/components/MarkersLegend.tsx +++ b/public/app/plugins/panel/geomap/components/MarkersLegend.tsx @@ -36,13 +36,13 @@ export function MarkersLegend(props: MarkersLegendProps) { } const props = hoverEvent.getProperties(); - const frame = props.frame as DataFrame; // eslint-disable-line + const frame: DataFrame = props.frame; if (!frame) { return undefined; } - const rowIndex = props.rowIndex as number; // eslint-disable-line + const rowIndex: number = props.rowIndex; return colorField.values[rowIndex]; }, [hoverEvent, colorField]); @@ -99,8 +99,8 @@ export function MarkersLegend(props: MarkersLegendProps) { diff --git a/public/app/plugins/panel/geomap/layers/basemaps/carto.ts b/public/app/plugins/panel/geomap/layers/basemaps/carto.ts index 9a1b0fb1a5d..4fc8318c009 100644 --- a/public/app/plugins/panel/geomap/layers/basemaps/carto.ts +++ b/public/app/plugins/panel/geomap/layers/basemaps/carto.ts @@ -36,7 +36,7 @@ export const carto: MapLayerRegistryItem = { create: async (map: Map, options: MapLayerOptions, eventBus: EventBus, theme: GrafanaTheme2) => ({ init: () => { const cfg = { ...defaultCartoConfig, ...options.config }; - let style = cfg.theme as string; + let style: string | undefined = cfg.theme; if (!style || style === LayerTheme.Auto) { style = theme.isDark ? 'dark' : 'light'; } diff --git a/public/app/plugins/panel/geomap/migrations.ts b/public/app/plugins/panel/geomap/migrations.ts index ae9e7a74bcc..4cac1c431f5 100644 --- a/public/app/plugins/panel/geomap/migrations.ts +++ b/public/app/plugins/panel/geomap/migrations.ts @@ -153,14 +153,14 @@ export function worldmapToGeomapOptions(angular: any): { 'SE Asia': 'se-asia', 'Last GeoHash': MapCenterID.Coordinates, // MapCenterID.LastPoint, }; - options.view.id = mapCenters[angular.mapCenter as any]; + options.view.id = mapCenters[angular.mapCenter]; options.view.lat = asNumber(angular.mapCenterLatitude); options.view.lon = asNumber(angular.mapCenterLongitude); return { fieldConfig, options, xform }; } -function asNumber(v: any): number | undefined { - const num = +v; +function asNumber(v: unknown): number | undefined { + const num = Number(v); return isNaN(num) ? undefined : num; } diff --git a/public/app/plugins/panel/geomap/utils/tootltip.ts b/public/app/plugins/panel/geomap/utils/tootltip.ts index 07c75dd0c5b..dbdd792418c 100644 --- a/public/app/plugins/panel/geomap/utils/tootltip.ts +++ b/public/app/plugins/panel/geomap/utils/tootltip.ts @@ -65,9 +65,9 @@ export const pointerMoveListener = (evt: MapBrowserEvent, panel: Geo //this is used as the generic hover event if (!hoverPayload.data) { const props = feature.getProperties(); - const frame = props['frame']; + const frame: DataFrame = props['frame']; if (frame) { - hoverPayload.data = ttip.data = frame as DataFrame; + hoverPayload.data = ttip.data = frame; hoverPayload.rowIndex = ttip.rowIndex = props['rowIndex']; } diff --git a/public/app/plugins/panel/heatmap/HeatmapHoverView.tsx b/public/app/plugins/panel/heatmap/HeatmapHoverView.tsx index 53c7b976494..e0862331827 100644 --- a/public/app/plugins/panel/heatmap/HeatmapHoverView.tsx +++ b/public/app/plugins/panel/heatmap/HeatmapHoverView.tsx @@ -39,7 +39,7 @@ const HeatmapHoverCell = ({ data, hover, showHistogram }: Props) => { const yField = data.heatmap?.fields[1]; const countField = data.heatmap?.fields[2]; - const xDisp = (v: any) => { + const xDisp = (v: number) => { if (xField?.display) { return formattedValueToString(xField.display(v)); } @@ -57,7 +57,7 @@ const HeatmapHoverCell = ({ data, hover, showHistogram }: Props) => { // labeled buckets const meta = readHeatmapRowsCustomMeta(data.heatmap); - const yDisp = yField?.display ? (v: any) => formattedValueToString(yField.display!(v)) : (v: any) => `${v}`; + const yDisp = yField?.display ? (v: string) => formattedValueToString(yField.display!(v)) : (v: string) => `${v}`; const yValueIdx = index % data.yBucketCount! ?? 0; diff --git a/public/app/plugins/panel/heatmap/utils.ts b/public/app/plugins/panel/heatmap/utils.ts index dbfe8ea127e..163f3905577 100644 --- a/public/app/plugins/panel/heatmap/utils.ts +++ b/public/app/plugins/panel/heatmap/utils.ts @@ -289,8 +289,7 @@ export function prepConfig(opts: PrepConfigOpts) { return builder; // early abort (avoids error) } - // eslint-ignore @typescript-eslint/no-explicit-any - const yFieldConfig = yField.config?.custom as FieldConfig | undefined; + const yFieldConfig: FieldConfig | undefined = yField.config?.custom; const yScale = yFieldConfig?.scaleDistribution ?? { type: ScaleDistribution.Linear }; const yAxisReverse = Boolean(yAxisConfig.reverse); const isSparseHeatmap = heatmapType === DataFrameType.HeatmapCells && !isHeatmapCellsDense(dataRef.current?.heatmap!); diff --git a/public/app/plugins/panel/live/LivePanel.tsx b/public/app/plugins/panel/live/LivePanel.tsx index e3161112ed7..4276c398bab 100644 --- a/public/app/plugins/panel/live/LivePanel.tsx +++ b/public/app/plugins/panel/live/LivePanel.tsx @@ -192,10 +192,10 @@ export class LivePanel extends PureComponent { }), state: LoadingState.Streaming, } as PanelData; - const props = { + const props: PanelProps = { ...this.props, options: { frameIndex: 0, showHeader: true }, - } as PanelProps; + }; return ; } } diff --git a/public/app/plugins/panel/nodeGraph/usePanning.ts b/public/app/plugins/panel/nodeGraph/usePanning.ts index 77563e5638d..1e012c3d071 100644 --- a/public/app/plugins/panel/nodeGraph/usePanning.ts +++ b/public/app/plugins/panel/nodeGraph/usePanning.ts @@ -184,11 +184,11 @@ function inBounds(value: number, min: number | undefined, max: number | undefine } function getEventXY(event: Event): { x: number; y: number } { - if ((event as any).changedTouches) { - const e = event as TouchEvent; - return { x: e.changedTouches[0].clientX, y: e.changedTouches[0].clientY }; + if (event instanceof TouchEvent) { + return { x: event.changedTouches[0].clientX, y: event.changedTouches[0].clientY }; + } else if (event instanceof MouseEvent) { + return { x: event.clientX, y: event.clientY }; } else { - const e = event as MouseEvent; - return { x: e.clientX, y: e.clientY }; + return { x: 0, y: 0 }; } } diff --git a/public/app/plugins/panel/timeseries/SpanNullsEditor.tsx b/public/app/plugins/panel/timeseries/SpanNullsEditor.tsx index 1ee39c4f1a8..bbf137d7411 100644 --- a/public/app/plugins/panel/timeseries/SpanNullsEditor.tsx +++ b/public/app/plugins/panel/timeseries/SpanNullsEditor.tsx @@ -22,8 +22,8 @@ type Props = FieldOverrideEditorProps; export const SpanNullsEditor = ({ value, onChange }: Props) => { const isThreshold = typeof value === 'number'; - const formattedTime = isThreshold ? rangeUtil.secondsToHms((value as number) / 1000) : undefined; - GAPS_OPTIONS[2].value = isThreshold ? (value as number) : 3600000; // 1h + const formattedTime = isThreshold ? rangeUtil.secondsToHms(value / 1000) : undefined; + GAPS_OPTIONS[2].value = isThreshold ? value : 3600000; // 1h const checkAndUpdate = (txt: string) => { let val: boolean | number = false; @@ -41,11 +41,11 @@ export const SpanNullsEditor = ({ value, onChange }: Props) => { if (e.key !== 'Enter') { return; } - checkAndUpdate((e.target as any).value); + checkAndUpdate(e.currentTarget.value); }; const handleBlur = (e: React.FocusEvent) => { - checkAndUpdate(e.target.value); + checkAndUpdate(e.currentTarget.value); }; return ( diff --git a/public/app/plugins/panel/timeseries/suggestions.ts b/public/app/plugins/panel/timeseries/suggestions.ts index 2b44dd129bb..29989b55544 100644 --- a/public/app/plugins/panel/timeseries/suggestions.ts +++ b/public/app/plugins/panel/timeseries/suggestions.ts @@ -4,7 +4,14 @@ import { VisualizationSuggestion, DataTransformerID, } from '@grafana/data'; -import { GraphDrawStyle, GraphFieldConfig, GraphGradientMode, LineInterpolation, StackingMode } from '@grafana/schema'; +import { + GraphDrawStyle, + GraphFieldConfig, + GraphGradientMode, + LineInterpolation, + StackingMode, + VizLegendOptions, +} from '@grafana/schema'; import { getDashboardSrv } from 'app/features/dashboard/services/DashboardSrv'; import { SuggestionName } from 'app/types/suggestions'; @@ -22,7 +29,7 @@ export class TimeSeriesSuggestionsSupplier { name: SuggestionName.LineChart, pluginId: 'timeseries', options: { - legend: {} as any, + legend: {} as VizLegendOptions, }, fieldConfig: { defaults: { diff --git a/public/app/plugins/panel/trend/suggestions.ts b/public/app/plugins/panel/trend/suggestions.ts index 7b028361251..25eb3b91d2f 100644 --- a/public/app/plugins/panel/trend/suggestions.ts +++ b/public/app/plugins/panel/trend/suggestions.ts @@ -1,5 +1,5 @@ import { VisualizationSuggestionsBuilder } from '@grafana/data'; -import { GraphDrawStyle, GraphFieldConfig } from '@grafana/schema'; +import { GraphDrawStyle, GraphFieldConfig, VizLegendOptions } from '@grafana/schema'; import { SuggestionName } from 'app/types/suggestions'; import { Options } from './panelcfg.gen'; @@ -17,7 +17,7 @@ export class TrendSuggestionsSupplier { name: SuggestionName.LineChart, pluginId: 'trend', options: { - legend: {} as any, + legend: {} as VizLegendOptions, }, fieldConfig: { defaults: {