From 3cf95d7eee9c78081ce087b1f9582da477c9be3c Mon Sep 17 00:00:00 2001 From: Ashley Harrison Date: Mon, 22 Aug 2022 16:51:33 +0100 Subject: [PATCH] Chore: fix some `any`s pt.2 (#53928) * correctly type some more any's * undo this change for now... --- .betterer.results | 136 ++++-------------- .../ClipboardButton/ClipboardButton.tsx | 2 +- .../src/components/Select/SelectMenu.tsx | 2 +- .../src/components/Table/FooterCell.tsx | 2 +- .../components/Tooltip/PopoverController.tsx | 6 +- .../SpanDetail/KeyValuesTable.tsx | 2 +- .../src/model/link-patterns.tsx | 6 +- .../components/Layers/LayerDragDropList.tsx | 2 +- .../app/core/components/Login/LoginCtrl.tsx | 4 +- .../DisabledPermissionListItem.tsx | 4 +- .../PermissionList/PermissionList.tsx | 4 +- .../app/core/components/Select/TeamPicker.tsx | 4 +- .../app/core/components/Select/UserPicker.tsx | 4 +- public/app/features/admin/UserProfile.tsx | 2 +- .../features/api-keys/ApiKeysPage.test.tsx | 2 +- .../dashboard/components/DashNav/DashNav.tsx | 2 +- .../DashNav/DashNavTimeControls.test.tsx | 5 +- .../AnnotationsSettings.test.tsx | 16 ++- .../AutoRefreshIntervals.test.tsx | 8 +- .../VersionsSettings.test.tsx | 5 +- .../LinksSettings/LinkSettingsEdit.tsx | 2 +- .../SaveDashboard/SaveDashboardDrawer.tsx | 4 +- .../SaveDashboard/SaveDashboardErrorProxy.tsx | 3 +- .../forms/SaveDashboardAsForm.tsx | 2 +- .../SaveDashboard/forms/SaveDashboardForm.tsx | 2 +- .../components/ShareModal/ShareEmbed.test.tsx | 3 +- .../components/ShareModal/ShareExport.tsx | 12 +- .../ShareModal/SharePublicDashboard.test.tsx | 3 +- .../components/SubMenu/Annotations.tsx | 4 +- .../dashboard/components/SubMenu/SubMenu.tsx | 4 +- .../containers/DashboardPage.test.tsx | 4 +- .../containers/SoloPanelPage.test.tsx | 12 +- .../dashboard/dashgrid/DashboardGrid.test.tsx | 4 +- .../datasources/components/ButtonRow.tsx | 2 +- .../dimensions/editors/ResourcePicker.tsx | 2 +- .../ThresholdsEditor.test.tsx | 2 +- public/app/features/explore/Explore.tsx | 6 +- .../features/explore/ExplorePaneContainer.tsx | 4 +- public/app/features/playlist/StartModal.tsx | 4 +- .../features/plugins/admin/pages/Browse.tsx | 2 +- .../ValueMatchers/BasicMatcherEditor.tsx | 2 +- .../loki/components/LokiCheatSheet.tsx | 2 +- 42 files changed, 113 insertions(+), 190 deletions(-) diff --git a/.betterer.results b/.betterer.results index fb147155b2d..d3cf00326dd 100644 --- a/.betterer.results +++ b/.betterer.results @@ -71,7 +71,7 @@ exports[`no enzyme tests`] = { "public/app/features/dashboard/components/ShareModal/ShareLink.test.tsx:3716733755": [ [0, 35, 13, "RegExp match", "2409514259"] ], - "public/app/features/dimensions/editors/ThresholdsEditor/ThresholdsEditor.test.tsx:4164297658": [ + "public/app/features/dimensions/editors/ThresholdsEditor/ThresholdsEditor.test.tsx:145048794": [ [0, 17, 13, "RegExp match", "2409514259"] ], "public/app/plugins/datasource/cloudwatch/components/ConfigEditor.test.tsx:4057721851": [ @@ -1623,8 +1623,7 @@ exports[`better eslint`] = { ], "packages/grafana-ui/src/components/Select/SelectMenu.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.", "1"] ], "packages/grafana-ui/src/components/Select/SelectOptionGroup.tsx:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"], @@ -1720,9 +1719,6 @@ exports[`better eslint`] = { "packages/grafana-ui/src/components/Table/FilterPopup.tsx:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"] ], - "packages/grafana-ui/src/components/Table/FooterCell.tsx:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"] - ], "packages/grafana-ui/src/components/Table/FooterRow.tsx:5381": [ [0, 0, 0, "Do not use any type assertions.", "0"], [0, 0, 0, "Unexpected any. Specify a different type.", "1"] @@ -1830,9 +1826,6 @@ exports[`better eslint`] = { [0, 0, 0, "Unexpected any. Specify a different type.", "1"], [0, 0, 0, "Do not use any type assertions.", "2"] ], - "packages/grafana-ui/src/components/Tooltip/PopoverController.tsx:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"] - ], "packages/grafana-ui/src/components/Tooltip/Tooltip.tsx:5381": [ [0, 0, 0, "Do not use any type assertions.", "0"], [0, 0, 0, "Unexpected any. Specify a different type.", "1"] @@ -2109,9 +2102,6 @@ exports[`better eslint`] = { "packages/jaeger-ui-components/src/TraceTimelineViewer/SpanBar.tsx:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"] ], - "packages/jaeger-ui-components/src/TraceTimelineViewer/SpanDetail/KeyValuesTable.tsx:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"] - ], "packages/jaeger-ui-components/src/TraceTimelineViewer/SpanDetail/index.tsx:5381": [ [0, 0, 0, "Do not use any type assertions.", "0"], [0, 0, 0, "Unexpected any. Specify a different type.", "1"] @@ -2163,13 +2153,10 @@ exports[`better eslint`] = { [0, 0, 0, "Unexpected any. Specify a different type.", "7"], [0, 0, 0, "Unexpected any. Specify a different type.", "8"], [0, 0, 0, "Unexpected any. Specify a different type.", "9"], - [0, 0, 0, "Unexpected any. Specify a different type.", "10"], + [0, 0, 0, "Do not use any type assertions.", "10"], [0, 0, 0, "Unexpected any. Specify a different type.", "11"], - [0, 0, 0, "Unexpected any. Specify a different type.", "12"], - [0, 0, 0, "Do not use any type assertions.", "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.", "12"], + [0, 0, 0, "Unexpected any. Specify a different type.", "13"] ], "packages/jaeger-ui-components/src/model/transform-trace-data.tsx:5381": [ [0, 0, 0, "Do not use any type assertions.", "0"], @@ -2750,17 +2737,14 @@ exports[`better eslint`] = { [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.", "3"] ], "public/app/core/components/Layers/LayerName.tsx:5381": [ [0, 0, 0, "Do not use any type assertions.", "0"], [0, 0, 0, "Unexpected any. Specify a different type.", "1"] ], "public/app/core/components/Login/LoginCtrl.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.", "0"] ], "public/app/core/components/Login/LoginPage.test.tsx:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"] @@ -2905,10 +2889,6 @@ exports[`better eslint`] = { [0, 0, 0, "Unexpected any. Specify a different type.", "1"] ], "public/app/core/components/PermissionList/DisabledPermissionListItem.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/PermissionList/PermissionList.tsx:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"] ], "public/app/core/components/RolePicker/RolePickerMenu.tsx:5381": [ @@ -2930,12 +2910,6 @@ exports[`better eslint`] = { "public/app/core/components/Select/SortPicker.tsx:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"] ], - "public/app/core/components/Select/TeamPicker.tsx:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"] - ], - "public/app/core/components/Select/UserPicker.tsx:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"] - ], "public/app/core/components/SharedPreferences/SharedPreferences.tsx:5381": [ [0, 0, 0, "Do not use any type assertions.", "0"] ], @@ -3391,8 +3365,7 @@ exports[`better eslint`] = { [0, 0, 0, "Unexpected any. Specify a different type.", "0"] ], "public/app/features/admin/UserProfile.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/admin/ldap/LdapPage.tsx:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"] @@ -3774,9 +3747,6 @@ exports[`better eslint`] = { "public/app/features/api-keys/ApiKeysForm.tsx:5381": [ [0, 0, 0, "Do not use any type assertions.", "0"] ], - "public/app/features/api-keys/ApiKeysPage.test.tsx:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"] - ], "public/app/features/api-keys/ApiKeysTable.tsx:5381": [ [0, 0, 0, "Do not use any type assertions.", "0"] ], @@ -3882,13 +3852,6 @@ exports[`better eslint`] = { [0, 0, 0, "Do not use any type assertions.", "10"], [0, 0, 0, "Unexpected any. Specify a different type.", "11"] ], - "public/app/features/dashboard/components/DashNav/DashNav.tsx:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"] - ], - "public/app/features/dashboard/components/DashNav/DashNavTimeControls.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/features/dashboard/components/DashboardPrompt/DashboardPrompt.test.tsx:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"], [0, 0, 0, "Unexpected any. Specify a different type.", "1"], @@ -3914,15 +3877,6 @@ exports[`better eslint`] = { "public/app/features/dashboard/components/DashboardRow/DashboardRow.tsx:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"] ], - "public/app/features/dashboard/components/DashboardSettings/AnnotationsSettings.test.tsx:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"] - ], - "public/app/features/dashboard/components/DashboardSettings/AutoRefreshIntervals.test.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"] - ], "public/app/features/dashboard/components/DashboardSettings/DashboardSettings.test.tsx:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"] ], @@ -3935,9 +3889,6 @@ exports[`better eslint`] = { "public/app/features/dashboard/components/DashboardSettings/GeneralSettings.tsx:5381": [ [0, 0, 0, "Do not use any type assertions.", "0"] ], - "public/app/features/dashboard/components/DashboardSettings/VersionsSettings.test.tsx:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"] - ], "public/app/features/dashboard/components/DashboardSettings/VersionsSettings.tsx:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"], [0, 0, 0, "Unexpected any. Specify a different type.", "1"] @@ -3956,8 +3907,7 @@ exports[`better eslint`] = { [0, 0, 0, "Unexpected any. Specify a different type.", "2"] ], "public/app/features/dashboard/components/LinksSettings/LinkSettingsEdit.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, "Do not use any type assertions.", "0"] ], "public/app/features/dashboard/components/PanelEditor/AngularPanelOptions.tsx:5381": [ [0, 0, 0, "Do not use any type assertions.", "0"] @@ -4037,13 +3987,9 @@ exports[`better eslint`] = { [0, 0, 0, "Unexpected any. Specify a different type.", "1"] ], "public/app/features/dashboard/components/SaveDashboard/SaveDashboardErrorProxy.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/dashboard/components/SaveDashboard/forms/SaveDashboardAsForm.test.tsx:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"] ], - "public/app/features/dashboard/components/SaveDashboard/forms/SaveDashboardAsForm.tsx:5381": [ + "public/app/features/dashboard/components/SaveDashboard/forms/SaveDashboardAsForm.test.tsx:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"] ], "public/app/features/dashboard/components/SaveDashboard/forms/SaveDashboardForm.test.tsx:5381": [ @@ -4057,8 +4003,7 @@ exports[`better eslint`] = { [0, 0, 0, "Unexpected any. Specify a different type.", "7"] ], "public/app/features/dashboard/components/SaveDashboard/forms/SaveDashboardForm.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/SaveDashboard/types.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"], @@ -4070,17 +4015,10 @@ exports[`better eslint`] = { ], "public/app/features/dashboard/components/ShareModal/ShareEmbed.test.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.", "1"] ], "public/app/features/dashboard/components/ShareModal/ShareExport.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, "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.", "0"] ], "public/app/features/dashboard/components/ShareModal/ShareLink.test.tsx:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"], @@ -4096,8 +4034,7 @@ exports[`better eslint`] = { [0, 0, 0, "Unexpected any. Specify a different type.", "0"] ], "public/app/features/dashboard/components/ShareModal/SharePublicDashboard.test.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/ShareSnapshot.tsx:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"] @@ -4108,9 +4045,6 @@ exports[`better eslint`] = { [0, 0, 0, "Do not use any type assertions.", "2"], [0, 0, 0, "Unexpected any. Specify a different type.", "3"] ], - "public/app/features/dashboard/components/SubMenu/Annotations.tsx:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"] - ], "public/app/features/dashboard/components/SubMenu/DashboardLinks.tsx:5381": [ [0, 0, 0, "Do not use any type assertions.", "0"] ], @@ -4118,9 +4052,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/features/dashboard/components/SubMenu/SubMenu.tsx:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"] - ], "public/app/features/dashboard/components/TransformationsEditor/TransformationEditor.tsx:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"], [0, 0, 0, "Unexpected any. Specify a different type.", "1"] @@ -4165,8 +4096,7 @@ 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.", "4"] ], "public/app/features/dashboard/containers/DashboardPage.tsx:5381": [ [0, 0, 0, "Do not use any type assertions.", "0"], @@ -4181,16 +4111,10 @@ 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, "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"], - [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.", "6"] ], "public/app/features/dashboard/dashgrid/DashboardGrid.test.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/dashgrid/DashboardGrid.tsx:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"], @@ -4512,8 +4436,7 @@ exports[`better eslint`] = { [0, 0, 0, "Unexpected any. Specify a different type.", "11"] ], "public/app/features/datasources/components/ButtonRow.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/datasources/passwordHandlers.test.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"] @@ -4565,8 +4488,7 @@ exports[`better eslint`] = { [0, 0, 0, "Unexpected any. Specify a different type.", "2"] ], "public/app/features/dimensions/editors/ResourcePicker.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/dimensions/editors/ScalarDimensionEditor.tsx:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"] @@ -4586,8 +4508,7 @@ 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.", "4"] ], "public/app/features/dimensions/editors/ThresholdsEditor/ThresholdsEditor.tsx:5381": [ [0, 0, 0, "Do not use any type assertions.", "0"] @@ -4639,17 +4560,13 @@ exports[`better eslint`] = { [0, 0, 0, "Unexpected any. Specify a different type.", "0"] ], "public/app/features/explore/Explore.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.", "0"] ], "public/app/features/explore/ExploreGraph.tsx:5381": [ [0, 0, 0, "Do not use any type assertions.", "0"] ], "public/app/features/explore/ExplorePaneContainer.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.", "0"] ], "public/app/features/explore/ExploreQueryInspector.test.tsx:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"], @@ -5134,9 +5051,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/features/playlist/StartModal.tsx:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"] - ], "public/app/features/playlist/usePlaylistItems.tsx:5381": [ [0, 0, 0, "Do not use any type assertions.", "0"] ], @@ -5180,8 +5094,7 @@ exports[`better eslint`] = { [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, "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.", "3"] ], "public/app/features/plugins/admin/pages/PluginDetails.test.tsx:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"] @@ -5620,8 +5533,7 @@ exports[`better eslint`] = { "public/app/features/transformers/FilterByValueTransformer/ValueMatchers/BasicMatcherEditor.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, "Unexpected any. Specify a different type.", "2"] ], "public/app/features/transformers/FilterByValueTransformer/ValueMatchers/NoopMatcherEditor.tsx:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"], diff --git a/packages/grafana-ui/src/components/ClipboardButton/ClipboardButton.tsx b/packages/grafana-ui/src/components/ClipboardButton/ClipboardButton.tsx index 7c6c3e72b52..9a37d35e210 100644 --- a/packages/grafana-ui/src/components/ClipboardButton/ClipboardButton.tsx +++ b/packages/grafana-ui/src/components/ClipboardButton/ClipboardButton.tsx @@ -32,7 +32,7 @@ export function ClipboardButton({ const [showCopySuccess, setShowCopySuccess] = useState(false); useEffect(() => { - let timeoutId: NodeJS.Timeout; + let timeoutId: ReturnType; if (showCopySuccess) { timeoutId = setTimeout(() => { diff --git a/packages/grafana-ui/src/components/Select/SelectMenu.tsx b/packages/grafana-ui/src/components/Select/SelectMenu.tsx index d3e9c7c4352..d24253c85e8 100644 --- a/packages/grafana-ui/src/components/Select/SelectMenu.tsx +++ b/packages/grafana-ui/src/components/Select/SelectMenu.tsx @@ -35,7 +35,7 @@ interface SelectMenuOptionProps { isDisabled: boolean; isFocused: boolean; isSelected: boolean; - innerProps: any; + innerProps: JSX.IntrinsicElements['div']; innerRef: RefCallback; renderOptionLabel?: (value: SelectableValue) => JSX.Element; data: SelectableValue; diff --git a/packages/grafana-ui/src/components/Table/FooterCell.tsx b/packages/grafana-ui/src/components/Table/FooterCell.tsx index cadfb05ed31..b4ada5f441a 100644 --- a/packages/grafana-ui/src/components/Table/FooterCell.tsx +++ b/packages/grafana-ui/src/components/Table/FooterCell.tsx @@ -43,6 +43,6 @@ export const FooterCell = (props: FooterProps) => { return EmptyCell; }; -export const EmptyCell = (props: any) => { +export const EmptyCell = () => { return  ; }; diff --git a/packages/grafana-ui/src/components/Tooltip/PopoverController.tsx b/packages/grafana-ui/src/components/Tooltip/PopoverController.tsx index e5eff577f27..7128a67528a 100644 --- a/packages/grafana-ui/src/components/Tooltip/PopoverController.tsx +++ b/packages/grafana-ui/src/components/Tooltip/PopoverController.tsx @@ -26,11 +26,13 @@ interface State { } class PopoverController extends Component { - private hideTimeout: any; + private hideTimeout: ReturnType | null = null; state = { show: false }; showPopper = () => { - clearTimeout(this.hideTimeout); + if (this.hideTimeout) { + clearTimeout(this.hideTimeout); + } this.setState({ show: true }); }; diff --git a/packages/jaeger-ui-components/src/TraceTimelineViewer/SpanDetail/KeyValuesTable.tsx b/packages/jaeger-ui-components/src/TraceTimelineViewer/SpanDetail/KeyValuesTable.tsx index e6b0f0970af..42ed0bb9855 100644 --- a/packages/jaeger-ui-components/src/TraceTimelineViewer/SpanDetail/KeyValuesTable.tsx +++ b/packages/jaeger-ui-components/src/TraceTimelineViewer/SpanDetail/KeyValuesTable.tsx @@ -75,7 +75,7 @@ export const getStyles = (theme: GrafanaTheme2) => { const jsonObjectOrArrayStartRegex = /^(\[|\{)/; -function parseIfComplexJson(value: any) { +function parseIfComplexJson(value: unknown) { // if the value is a string representing actual json object or array, then use json-markup if (typeof value === 'string' && jsonObjectOrArrayStartRegex.test(value)) { // otherwise just return as is diff --git a/packages/jaeger-ui-components/src/model/link-patterns.tsx b/packages/jaeger-ui-components/src/model/link-patterns.tsx index 6031ddfdb1c..c660d963189 100644 --- a/packages/jaeger-ui-components/src/model/link-patterns.tsx +++ b/packages/jaeger-ui-components/src/model/link-patterns.tsx @@ -56,7 +56,7 @@ function stringSupplant(str: string, encodeFn: (unencoded: any) => string, map: }); } -export function processTemplate(template: any, encodeFn: (unencoded: any) => string): ProcessedTemplate { +export function processTemplate(template: unknown, encodeFn: (unencoded: any) => string): ProcessedTemplate { if (typeof template !== 'string') { /* @@ -76,10 +76,10 @@ export function processTemplate(template: any, encodeFn: (unencoded: any) => str export function createTestFunction(entry: any) { if (typeof entry === 'string') { - return (arg: any) => arg === entry; + return (arg: unknown) => arg === entry; } if (Array.isArray(entry)) { - return (arg: any) => entry.indexOf(arg) > -1; + return (arg: unknown) => entry.indexOf(arg) > -1; } /* diff --git a/public/app/core/components/Layers/LayerDragDropList.tsx b/public/app/core/components/Layers/LayerDragDropList.tsx index fe5c127f432..df6c503d2e0 100644 --- a/public/app/core/components/Layers/LayerDragDropList.tsx +++ b/public/app/core/components/Layers/LayerDragDropList.tsx @@ -49,7 +49,7 @@ export const LayerDragDropList = ({
{(() => { // reverse order - const rows: any = []; + const rows: JSX.Element[] = []; const lastLayerIndex = excludeBaseLayer ? 1 : 0; const shouldRenderDragIconLengthThreshold = excludeBaseLayer ? 2 : 1; for (let i = layers.length - 1; i >= lastLayerIndex; i--) { diff --git a/public/app/core/components/Login/LoginCtrl.tsx b/public/app/core/components/Login/LoginCtrl.tsx index 7c39e1eb324..9ae577ad3ed 100644 --- a/public/app/core/components/Login/LoginCtrl.tsx +++ b/public/app/core/components/Login/LoginCtrl.tsx @@ -77,7 +77,7 @@ export class LoginCtrl extends PureComponent { .then(() => { this.toGrafana(); }) - .catch((err: any) => console.error(err)); + .catch((err) => console.error(err)); } }; @@ -88,7 +88,7 @@ export class LoginCtrl extends PureComponent { getBackendSrv() .post('/login', formModel) - .then((result: any) => { + .then((result) => { this.result = result; if (formModel.password !== 'admin' || config.ldapEnabled || config.authProxyEnabled) { this.toGrafana(); diff --git a/public/app/core/components/PermissionList/DisabledPermissionListItem.tsx b/public/app/core/components/PermissionList/DisabledPermissionListItem.tsx index be22bde694a..cd6b0ed68f1 100644 --- a/public/app/core/components/PermissionList/DisabledPermissionListItem.tsx +++ b/public/app/core/components/PermissionList/DisabledPermissionListItem.tsx @@ -1,10 +1,10 @@ import React, { Component } from 'react'; import { Select, Icon, Button } from '@grafana/ui'; -import { dashboardPermissionLevels } from 'app/types/acl'; +import { DashboardAcl, dashboardPermissionLevels } from 'app/types/acl'; export interface Props { - item: any; + item: DashboardAcl; } export default class DisabledPermissionListItem extends Component { diff --git a/public/app/core/components/PermissionList/PermissionList.tsx b/public/app/core/components/PermissionList/PermissionList.tsx index 02f4aee63fa..2631905e799 100644 --- a/public/app/core/components/PermissionList/PermissionList.tsx +++ b/public/app/core/components/PermissionList/PermissionList.tsx @@ -1,7 +1,7 @@ import React, { PureComponent } from 'react'; import { FolderInfo } from 'app/types'; -import { DashboardAcl } from 'app/types/acl'; +import { DashboardAcl, PermissionLevel } from 'app/types/acl'; import DisabledPermissionsListItem from './DisabledPermissionListItem'; import PermissionsListItem from './PermissionListItem'; @@ -9,7 +9,7 @@ import PermissionsListItem from './PermissionListItem'; export interface Props { items: DashboardAcl[]; onRemoveItem: (item: DashboardAcl) => void; - onPermissionChanged: any; + onPermissionChanged: (item: DashboardAcl, level: PermissionLevel) => void; isFetching: boolean; folderInfo?: FolderInfo; } diff --git a/public/app/core/components/Select/TeamPicker.tsx b/public/app/core/components/Select/TeamPicker.tsx index 5d0a0ef2047..b2a2acbb2c1 100644 --- a/public/app/core/components/Select/TeamPicker.tsx +++ b/public/app/core/components/Select/TeamPicker.tsx @@ -1,4 +1,4 @@ -import { debounce, isNil } from 'lodash'; +import { debounce, DebouncedFuncLeading, isNil } from 'lodash'; import React, { Component } from 'react'; import { SelectableValue } from '@grafana/data'; @@ -16,7 +16,7 @@ export interface State { } export class TeamPicker extends Component { - debouncedSearch: any; + debouncedSearch: DebouncedFuncLeading; constructor(props: Props) { super(props); diff --git a/public/app/core/components/Select/UserPicker.tsx b/public/app/core/components/Select/UserPicker.tsx index cb342edee01..c71bfa9af62 100644 --- a/public/app/core/components/Select/UserPicker.tsx +++ b/public/app/core/components/Select/UserPicker.tsx @@ -1,4 +1,4 @@ -import { debounce, isNil } from 'lodash'; +import { debounce, DebouncedFuncLeading, isNil } from 'lodash'; import React, { Component } from 'react'; import { SelectableValue } from '@grafana/data'; @@ -17,7 +17,7 @@ export interface State { } export class UserPicker extends Component { - debouncedSearch: any; + debouncedSearch: DebouncedFuncLeading; constructor(props: Props) { super(props); diff --git a/public/app/features/admin/UserProfile.tsx b/public/app/features/admin/UserProfile.tsx index fe9b7646db5..b2c92caa137 100644 --- a/public/app/features/admin/UserProfile.tsx +++ b/public/app/features/admin/UserProfile.tsx @@ -203,7 +203,7 @@ export class UserProfileRow extends PureComponent { + setInputElem = (elem: HTMLInputElement) => { this.inputElem = elem; }; diff --git a/public/app/features/api-keys/ApiKeysPage.test.tsx b/public/app/features/api-keys/ApiKeysPage.test.tsx index a2d1a772fc7..c28c52898e7 100644 --- a/public/app/features/api-keys/ApiKeysPage.test.tsx +++ b/public/app/features/api-keys/ApiKeysPage.test.tsx @@ -172,7 +172,7 @@ describe('ApiKeysPage', () => { describe('when a user adds an API key from CTA', () => { it('then it should call addApiKey with correct parameters', async () => { - const apiKeys: any[] = []; + const apiKeys: ApiKey[] = []; const { addApiKeyMock } = setup({ apiKeys, apiKeysCount: apiKeys.length, hasFetched: true }); addApiKeyMock.mockClear(); diff --git a/public/app/features/dashboard/components/DashNav/DashNav.tsx b/public/app/features/dashboard/components/DashNav/DashNav.tsx index 48719217219..2a1154e1a32 100644 --- a/public/app/features/dashboard/components/DashNav/DashNav.tsx +++ b/public/app/features/dashboard/components/DashNav/DashNav.tsx @@ -70,7 +70,7 @@ export const DashNav = React.memo((props) => { const dashboardSrv = getDashboardSrv(); const { dashboard, setStarred } = props; - dashboardSrv.starDashboard(dashboard.id, dashboard.meta.isStarred).then((newState: any) => { + dashboardSrv.starDashboard(dashboard.id, dashboard.meta.isStarred).then((newState) => { setStarred({ id: dashboard.uid, title: dashboard.title, url: dashboard.meta.url ?? '', isStarred: newState }); dashboard.meta.isStarred = newState; forceUpdate(); diff --git a/public/app/features/dashboard/components/DashNav/DashNavTimeControls.test.tsx b/public/app/features/dashboard/components/DashNav/DashNavTimeControls.test.tsx index b855f9633bb..836eaef3f59 100644 --- a/public/app/features/dashboard/components/DashNav/DashNavTimeControls.test.tsx +++ b/public/app/features/dashboard/components/DashNav/DashNavTimeControls.test.tsx @@ -3,6 +3,7 @@ import React from 'react'; import { getDashboardModel } from '../../../../../test/helpers/getDashboardModel'; import { DashboardModel } from '../../state/DashboardModel'; +import { PanelModel } from '../../state/PanelModel'; import { DashNavTimeControls } from './DashNavTimeControls'; @@ -47,7 +48,7 @@ describe('DashNavTimeControls', () => { }); it('should not render RefreshPicker interval button in panel edit', () => { - const panel: any = { destroy: jest.fn(), isEditing: true }; + const panel: PanelModel = new PanelModel({ destroy: jest.fn(), isEditing: true }); dashboardModel.startRefresh = jest.fn(); dashboardModel.panelInEdit = panel; const container = render( @@ -57,7 +58,7 @@ describe('DashNavTimeControls', () => { }); it('should render RefreshPicker run button in panel edit', () => { - const panel: any = { destroy: jest.fn(), isEditing: true }; + const panel: PanelModel = new PanelModel({ destroy: jest.fn(), isEditing: true }); dashboardModel.startRefresh = jest.fn(); dashboardModel.panelInEdit = panel; const container = render( diff --git a/public/app/features/dashboard/components/DashboardSettings/AnnotationsSettings.test.tsx b/public/app/features/dashboard/components/DashboardSettings/AnnotationsSettings.test.tsx index b838b8dd479..e793a736f28 100644 --- a/public/app/features/dashboard/components/DashboardSettings/AnnotationsSettings.test.tsx +++ b/public/app/features/dashboard/components/DashboardSettings/AnnotationsSettings.test.tsx @@ -7,10 +7,12 @@ import { selectors } from '@grafana/e2e-selectors'; import { setAngularLoader, setDataSourceSrv } from '@grafana/runtime'; import { mockDataSource, MockDataSourceSrv } from 'app/features/alerting/unified/mocks'; +import { DashboardModel } from '../../state/DashboardModel'; + import { AnnotationsSettings } from './AnnotationsSettings'; describe('AnnotationsSettings', () => { - let dashboard: any; + let dashboard: DashboardModel; const dataSources = { grafana: mockDataSource( @@ -57,7 +59,7 @@ describe('AnnotationsSettings', () => { }); beforeEach(() => { - dashboard = { + dashboard = new DashboardModel({ id: 74, version: 7, annotations: { @@ -74,7 +76,7 @@ describe('AnnotationsSettings', () => { ], }, links: [], - }; + }); }); test('it renders a header and cta if no annotations or only builtIn annotation', async () => { @@ -143,12 +145,12 @@ describe('AnnotationsSettings', () => { type: 'dashboard', }, ]; - const dashboardWithAnnotations = { + const dashboardWithAnnotations = new DashboardModel({ ...dashboard, annotations: { list: [...annotationsList], }, - }; + }); render(); // Check that we have the correct annotations expect(screen.queryByText(/prometheus/i)).toBeInTheDocument(); @@ -177,12 +179,12 @@ describe('AnnotationsSettings', () => { type: 'dashboard', }, ]; - const dashboardWithAnnotations = { + const dashboardWithAnnotations = new DashboardModel({ ...dashboard, annotations: { list: [...annotationsList], }, - }; + }); render(); // Check that we have sorting buttons expect(within(getTableBodyRows()[0]).queryByRole('button', { name: 'arrow-up' })).not.toBeInTheDocument(); diff --git a/public/app/features/dashboard/components/DashboardSettings/AutoRefreshIntervals.test.tsx b/public/app/features/dashboard/components/DashboardSettings/AutoRefreshIntervals.test.tsx index 5f6ffb16a33..27bc5ba5cb9 100644 --- a/public/app/features/dashboard/components/DashboardSettings/AutoRefreshIntervals.test.tsx +++ b/public/app/features/dashboard/components/DashboardSettings/AutoRefreshIntervals.test.tsx @@ -99,7 +99,7 @@ describe('getValidIntervals', () => { const dependencies = { getTimeSrv: () => ({ - getValidIntervals: (intervals: any) => intervals, + getValidIntervals: (intervals: string[]) => intervals, } as unknown as TimeSrv), }; @@ -115,7 +115,7 @@ describe('getValidIntervals', () => { const dependencies = { getTimeSrv: () => ({ - getValidIntervals: (intervals: any) => intervals, + getValidIntervals: (intervals: string[]) => intervals, } as unknown as TimeSrv), }; @@ -131,7 +131,7 @@ describe('getValidIntervals', () => { const dependencies = { getTimeSrv: () => ({ - getValidIntervals: (intervals: any) => intervals, + getValidIntervals: (intervals: string[]) => intervals, } as unknown as TimeSrv), }; @@ -148,7 +148,7 @@ describe('validateIntervals', () => { const dependencies = { getTimeSrv: () => ({ - getValidIntervals: (intervals: any) => intervals, + getValidIntervals: (intervals: string[]) => intervals, } as unknown as TimeSrv), }; diff --git a/public/app/features/dashboard/components/DashboardSettings/VersionsSettings.test.tsx b/public/app/features/dashboard/components/DashboardSettings/VersionsSettings.test.tsx index 8721e0e98e9..ddd45639e4d 100644 --- a/public/app/features/dashboard/components/DashboardSettings/VersionsSettings.test.tsx +++ b/public/app/features/dashboard/components/DashboardSettings/VersionsSettings.test.tsx @@ -4,6 +4,7 @@ import userEvent from '@testing-library/user-event'; import { UserEvent } from '@testing-library/user-event/dist/types/setup'; import React from 'react'; +import { DashboardModel } from '../../state/DashboardModel'; import { historySrv } from '../VersionHistory/HistorySrv'; import { VersionsSettings, VERSIONS_FETCH_LIMIT } from './VersionsSettings'; @@ -23,12 +24,12 @@ const queryByFullText = (text: string) => }); describe('VersionSettings', () => { - const dashboard: any = { + const dashboard = new DashboardModel({ id: 74, version: 11, formatDate: jest.fn(() => 'date'), getRelativeTime: jest.fn(() => 'time ago'), - }; + }); let user: UserEvent; diff --git a/public/app/features/dashboard/components/LinksSettings/LinkSettingsEdit.tsx b/public/app/features/dashboard/components/LinksSettings/LinkSettingsEdit.tsx index 70d5a3ade1e..8e6df111c6a 100644 --- a/public/app/features/dashboard/components/LinksSettings/LinkSettingsEdit.tsx +++ b/public/app/features/dashboard/components/LinksSettings/LinkSettingsEdit.tsx @@ -51,7 +51,7 @@ export const LinkSettingsEdit: React.FC = ({ editLinkIdx, setLinkSettings(link); }; - const onTagsChange = (tags: any[]) => { + const onTagsChange = (tags: string[]) => { onUpdate({ ...linkSettings, tags: tags }); }; diff --git a/public/app/features/dashboard/components/SaveDashboard/SaveDashboardDrawer.tsx b/public/app/features/dashboard/components/SaveDashboard/SaveDashboardDrawer.tsx index 01fd4680c12..ff721917e6f 100644 --- a/public/app/features/dashboard/components/SaveDashboard/SaveDashboardDrawer.tsx +++ b/public/app/features/dashboard/components/SaveDashboard/SaveDashboardDrawer.tsx @@ -1,7 +1,7 @@ import React, { useMemo, useState } from 'react'; import { useAsync } from 'react-use'; -import { config } from '@grafana/runtime'; +import { config, isFetchError } from '@grafana/runtime'; import { Drawer, Spinner, Tab, TabsBar } from '@grafana/ui'; import { backendSrv } from 'app/core/services/backend_srv'; @@ -126,7 +126,7 @@ export const SaveDashboardDrawer = ({ dashboard, onDismiss, onSaveSuccess, isCop ); }; - if (state.error) { + if (state.error && isFetchError(state.error)) { return ( void; } diff --git a/public/app/features/dashboard/components/SaveDashboard/forms/SaveDashboardAsForm.tsx b/public/app/features/dashboard/components/SaveDashboard/forms/SaveDashboardAsForm.tsx index 7208f9e177c..5cadc40f402 100644 --- a/public/app/features/dashboard/components/SaveDashboard/forms/SaveDashboardAsForm.tsx +++ b/public/app/features/dashboard/components/SaveDashboard/forms/SaveDashboardAsForm.tsx @@ -14,7 +14,7 @@ interface SaveDashboardAsFormDTO { } const getSaveAsDashboardClone = (dashboard: DashboardModel) => { - const clone: any = dashboard.getSaveModelClone(); + const clone = dashboard.getSaveModelClone(); clone.id = null; clone.uid = ''; clone.title += ' Copy'; diff --git a/public/app/features/dashboard/components/SaveDashboard/forms/SaveDashboardForm.tsx b/public/app/features/dashboard/components/SaveDashboard/forms/SaveDashboardForm.tsx index d7934768826..177da94a803 100644 --- a/public/app/features/dashboard/components/SaveDashboard/forms/SaveDashboardForm.tsx +++ b/public/app/features/dashboard/components/SaveDashboard/forms/SaveDashboardForm.tsx @@ -15,7 +15,7 @@ export type SaveProps = { saveModel: SaveDashboardData; // already cloned onCancel: () => void; onSuccess: () => void; - onSubmit?: (clone: any, options: SaveDashboardOptions, dashboard: DashboardModel) => Promise; + onSubmit?: (clone: DashboardModel, options: SaveDashboardOptions, dashboard: DashboardModel) => Promise; options: SaveDashboardOptions; onOptionsChange: (opts: SaveDashboardOptions) => void; }; diff --git a/public/app/features/dashboard/components/ShareModal/ShareEmbed.test.tsx b/public/app/features/dashboard/components/ShareModal/ShareEmbed.test.tsx index aa81cc1cb33..d64617b0f49 100644 --- a/public/app/features/dashboard/components/ShareModal/ShareEmbed.test.tsx +++ b/public/app/features/dashboard/components/ShareModal/ShareEmbed.test.tsx @@ -1,6 +1,7 @@ import { render, screen } from '@testing-library/react'; import React from 'react'; +import { BootData } from '@grafana/data'; import { setEchoSrv } from '@grafana/runtime/src'; import config from 'app/core/config'; @@ -48,7 +49,7 @@ function mockLocationHref(href: string) { } describe('ShareEmbed', () => { - let originalBootData: any; + let originalBootData: BootData; beforeAll(() => { setEchoSrv(new Echo()); diff --git a/public/app/features/dashboard/components/ShareModal/ShareExport.tsx b/public/app/features/dashboard/components/ShareModal/ShareExport.tsx index c8699cd1e4a..6fa3ec0c929 100644 --- a/public/app/features/dashboard/components/ShareModal/ShareExport.tsx +++ b/public/app/features/dashboard/components/ShareModal/ShareExport.tsx @@ -54,11 +54,11 @@ export class ShareExport extends PureComponent { const { trimDefaults } = this.state; if (shareExternally) { - this.exporter.makeExportable(dashboard).then((dashboardJson: any) => { + this.exporter.makeExportable(dashboard).then((dashboardJson) => { if (trimDefaults) { getBackendSrv() .post('/api/dashboards/trim', { dashboard: dashboardJson }) - .then((resp: any) => { + .then((resp) => { this.openSaveAsDialog(resp.dashboard); }); } else { @@ -69,7 +69,7 @@ export class ShareExport extends PureComponent { if (trimDefaults) { getBackendSrv() .post('/api/dashboards/trim', { dashboard: dashboard.getSaveModelClone() }) - .then((resp: any) => { + .then((resp) => { this.openSaveAsDialog(resp.dashboard); }); } else { @@ -84,11 +84,11 @@ export class ShareExport extends PureComponent { const { trimDefaults } = this.state; if (shareExternally) { - this.exporter.makeExportable(dashboard).then((dashboardJson: any) => { + this.exporter.makeExportable(dashboard).then((dashboardJson) => { if (trimDefaults) { getBackendSrv() .post('/api/dashboards/trim', { dashboard: dashboardJson }) - .then((resp: any) => { + .then((resp) => { this.openJsonModal(resp.dashboard); }); } else { @@ -99,7 +99,7 @@ export class ShareExport extends PureComponent { if (trimDefaults) { getBackendSrv() .post('/api/dashboards/trim', { dashboard: dashboard.getSaveModelClone() }) - .then((resp: any) => { + .then((resp) => { this.openJsonModal(resp.dashboard); }); } else { diff --git a/public/app/features/dashboard/components/ShareModal/SharePublicDashboard.test.tsx b/public/app/features/dashboard/components/ShareModal/SharePublicDashboard.test.tsx index 3288b4fa7ee..565ebeeb716 100644 --- a/public/app/features/dashboard/components/ShareModal/SharePublicDashboard.test.tsx +++ b/public/app/features/dashboard/components/ShareModal/SharePublicDashboard.test.tsx @@ -1,6 +1,7 @@ import { fireEvent, render, screen, waitFor } from '@testing-library/react'; import React from 'react'; +import { BootData } from '@grafana/data'; import { BackendSrv, setEchoSrv } from '@grafana/runtime'; import config from 'app/core/config'; import { DashboardModel, PanelModel } from 'app/features/dashboard/state'; @@ -44,7 +45,7 @@ jest.mock('app/core/core', () => { }); describe('SharePublic', () => { - let originalBootData: any; + let originalBootData: BootData; beforeAll(() => { setEchoSrv(new Echo()); diff --git a/public/app/features/dashboard/components/SubMenu/Annotations.tsx b/public/app/features/dashboard/components/SubMenu/Annotations.tsx index a08f235341a..d123df764b2 100644 --- a/public/app/features/dashboard/components/SubMenu/Annotations.tsx +++ b/public/app/features/dashboard/components/SubMenu/Annotations.tsx @@ -1,13 +1,13 @@ import React, { FunctionComponent, useEffect, useState } from 'react'; -import { AnnotationQuery, EventBus } from '@grafana/data'; +import { AnnotationQuery, DataQuery, EventBus } from '@grafana/data'; import { AnnotationPicker } from './AnnotationPicker'; interface Props { events: EventBus; annotations: AnnotationQuery[]; - onAnnotationChanged: (annotation: any) => void; + onAnnotationChanged: (annotation: AnnotationQuery) => void; } export const Annotations: FunctionComponent = ({ annotations, onAnnotationChanged, events }) => { diff --git a/public/app/features/dashboard/components/SubMenu/SubMenu.tsx b/public/app/features/dashboard/components/SubMenu/SubMenu.tsx index a7e6479c1a2..125c8c731aa 100644 --- a/public/app/features/dashboard/components/SubMenu/SubMenu.tsx +++ b/public/app/features/dashboard/components/SubMenu/SubMenu.tsx @@ -2,7 +2,7 @@ import { css } from '@emotion/css'; import React, { PureComponent } from 'react'; import { connect, MapStateToProps } from 'react-redux'; -import { AnnotationQuery } from '@grafana/data'; +import { AnnotationQuery, DataQuery } from '@grafana/data'; import { StoreState } from '../../../../types'; import { getSubMenuVariables, getVariablesState } from '../../../variables/state/selectors'; @@ -29,7 +29,7 @@ interface DispatchProps {} type Props = OwnProps & ConnectedProps & DispatchProps; class SubMenuUnConnected extends PureComponent { - onAnnotationStateChanged = (updatedAnnotation: any) => { + onAnnotationStateChanged = (updatedAnnotation: AnnotationQuery) => { // we're mutating dashboard state directly here until annotations are in Redux. for (let index = 0; index < this.props.dashboard.annotations.list.length; index++) { const annotation = this.props.dashboard.annotations.list[index]; diff --git a/public/app/features/dashboard/containers/DashboardPage.test.tsx b/public/app/features/dashboard/containers/DashboardPage.test.tsx index b8471051196..ad40ed62c2c 100644 --- a/public/app/features/dashboard/containers/DashboardPage.test.tsx +++ b/public/app/features/dashboard/containers/DashboardPage.test.tsx @@ -11,7 +11,7 @@ import { selectors } from '@grafana/e2e-selectors'; import { config, locationService, setDataSourceSrv } from '@grafana/runtime'; import { notifyApp } from 'app/core/actions'; import { getRouteComponentProps } from 'app/core/navigation/__mocks__/routeProps'; -import { DashboardInitPhase, DashboardRoutes } from 'app/types'; +import { DashboardInitPhase, DashboardMeta, DashboardRoutes } from 'app/types'; import { configureStore } from '../../../store/configureStore'; import { Props as LazyLoaderProps } from '../dashgrid/LazyLoader'; @@ -74,7 +74,7 @@ interface ScenarioContext { setup: (fn: () => void) => void; } -function getTestDashboard(overrides?: any, metaOverrides?: any): DashboardModel { +function getTestDashboard(overrides?: any, metaOverrides?: Partial): DashboardModel { const data = Object.assign( { title: 'My dashboard', diff --git a/public/app/features/dashboard/containers/SoloPanelPage.test.tsx b/public/app/features/dashboard/containers/SoloPanelPage.test.tsx index c292c978f37..608fa06cadc 100644 --- a/public/app/features/dashboard/containers/SoloPanelPage.test.tsx +++ b/public/app/features/dashboard/containers/SoloPanelPage.test.tsx @@ -1,7 +1,7 @@ import { render, screen } from '@testing-library/react'; import React from 'react'; -import { DashboardRoutes } from 'app/types'; +import { DashboardMeta, DashboardRoutes } from 'app/types'; import { getRouteComponentProps } from '../../../core/navigation/__mocks__/routeProps'; import { Props as DashboardPanelProps } from '../dashgrid/DashboardPanel'; @@ -24,14 +24,14 @@ jest.mock('app/features/dashboard/dashgrid/DashboardPanel', () => { interface ScenarioContext { dashboard?: DashboardModel | null; secondaryDashboard?: DashboardModel | null; - setDashboard: (overrides?: any, metaOverrides?: any) => void; - setSecondaryDashboard: (overrides?: any, metaOverrides?: any) => void; + setDashboard: (overrides?: any, metaOverrides?: Partial) => void; + setSecondaryDashboard: (overrides?: any, metaOverrides?: Partial) => void; mount: (propOverrides?: Partial) => void; rerender: (propOverrides?: Partial) => void; setup: (fn: () => void) => void; } -function getTestDashboard(overrides?: any, metaOverrides?: any): DashboardModel { +function getTestDashboard(overrides?: any, metaOverrides?: Partial): DashboardModel { const data = Object.assign( { title: 'My dashboard', @@ -59,10 +59,10 @@ function soloPanelPageScenario(description: string, scenarioFn: (ctx: ScenarioCo setup: (fn) => { setupFn = fn; }, - setDashboard: (overrides?: any, metaOverrides?: any) => { + setDashboard: (overrides?: any, metaOverrides?: Partial) => { ctx.dashboard = getTestDashboard(overrides, metaOverrides); }, - setSecondaryDashboard: (overrides?: any, metaOverrides?: any) => { + setSecondaryDashboard: (overrides?: any, metaOverrides?: Partial) => { ctx.secondaryDashboard = getTestDashboard(overrides, metaOverrides); }, mount: (propOverrides?: Partial) => { diff --git a/public/app/features/dashboard/dashgrid/DashboardGrid.test.tsx b/public/app/features/dashboard/dashgrid/DashboardGrid.test.tsx index 28d0ac6f398..00b0e7e8d37 100644 --- a/public/app/features/dashboard/dashgrid/DashboardGrid.test.tsx +++ b/public/app/features/dashboard/dashgrid/DashboardGrid.test.tsx @@ -1,6 +1,8 @@ import { render } from '@testing-library/react'; import React from 'react'; +import { DashboardMeta } from 'app/types'; + import { DashboardModel } from '../state'; import { DashboardGridUnconnected as DashboardGrid, Props } from './DashboardGrid'; @@ -12,7 +14,7 @@ jest.mock('app/features/dashboard/dashgrid/LazyLoader', () => { return { LazyLoader }; }); -function getTestDashboard(overrides?: any, metaOverrides?: any): DashboardModel { +function getTestDashboard(overrides?: any, metaOverrides?: Partial): DashboardModel { const data = Object.assign( { title: 'My dashboard', diff --git a/public/app/features/datasources/components/ButtonRow.tsx b/public/app/features/datasources/components/ButtonRow.tsx index b0082ce1e5b..c4de895d609 100644 --- a/public/app/features/datasources/components/ButtonRow.tsx +++ b/public/app/features/datasources/components/ButtonRow.tsx @@ -11,7 +11,7 @@ export interface Props { canDelete: boolean; onDelete: () => void; onSubmit: (event: any) => void; - onTest: (event: any) => void; + onTest: (event: React.MouseEvent) => void; } export function ButtonRow({ canSave, canDelete, onDelete, onSubmit, onTest, exploreUrl }: Props) { diff --git a/public/app/features/dimensions/editors/ResourcePicker.tsx b/public/app/features/dimensions/editors/ResourcePicker.tsx index 7bc55df26b7..30246d6aa0d 100644 --- a/public/app/features/dimensions/editors/ResourcePicker.tsx +++ b/public/app/features/dimensions/editors/ResourcePicker.tsx @@ -90,7 +90,7 @@ export const ResourcePicker = (props: Props) => { {...popperProps} referenceElement={pickerTriggerRef.current} onMouseEnter={showPopper} - onKeyDown={(event: any) => { + onKeyDown={(event) => { closePopover(event, hidePopper); }} /> diff --git a/public/app/features/dimensions/editors/ThresholdsEditor/ThresholdsEditor.test.tsx b/public/app/features/dimensions/editors/ThresholdsEditor/ThresholdsEditor.test.tsx index c680e51c66f..49fc77ebd96 100644 --- a/public/app/features/dimensions/editors/ThresholdsEditor/ThresholdsEditor.test.tsx +++ b/public/app/features/dimensions/editors/ThresholdsEditor/ThresholdsEditor.test.tsx @@ -28,7 +28,7 @@ function getCurrentThresholds(editor: ThresholdsEditor) { } describe('ThresholdsEditor', () => { - let restoreThemeContext: any; + let restoreThemeContext: () => void; beforeAll(() => { restoreThemeContext = mockThemeContext(createTheme()); diff --git a/public/app/features/explore/Explore.tsx b/public/app/features/explore/Explore.tsx index 55233403242..1e0da59d225 100644 --- a/public/app/features/explore/Explore.tsx +++ b/public/app/features/explore/Explore.tsx @@ -6,7 +6,7 @@ import AutoSizer from 'react-virtualized-auto-sizer'; import { compose } from 'redux'; import { Unsubscribable } from 'rxjs'; -import { AbsoluteTimeRange, DataQuery, GrafanaTheme2, LoadingState, RawTimeRange } from '@grafana/data'; +import { AbsoluteTimeRange, DataQuery, GrafanaTheme2, LoadingState, QueryFixAction, RawTimeRange } from '@grafana/data'; import { selectors } from '@grafana/e2e-selectors'; import { Collapse, CustomScrollbar, ErrorBoundaryAlert, Themeable2, withTheme2, PanelContainer } from '@grafana/ui'; import { FILTER_FOR_OPERATOR, FILTER_OUT_OPERATOR, FilterItem } from '@grafana/ui/src/components/Table/types'; @@ -167,10 +167,10 @@ export class Explore extends React.PureComponent { makeAbsoluteTime(); }; - onModifyQueries = (action: any, index?: number) => { + onModifyQueries = (action: QueryFixAction, index?: number) => { const { datasourceInstance } = this.props; if (datasourceInstance?.modifyQuery) { - const modifier = (queries: DataQuery, modification: any) => + const modifier = (queries: DataQuery, modification: QueryFixAction) => datasourceInstance.modifyQuery!(queries, modification); this.props.modifyQueries(this.props.exploreId, action, modifier, index); } diff --git a/public/app/features/explore/ExplorePaneContainer.tsx b/public/app/features/explore/ExplorePaneContainer.tsx index 0e7dc124a1f..eeb30de7ca9 100644 --- a/public/app/features/explore/ExplorePaneContainer.tsx +++ b/public/app/features/explore/ExplorePaneContainer.tsx @@ -53,7 +53,7 @@ interface Props extends OwnProps, ConnectedProps {} * of state based on URL changes and preventing any infinite loops. */ class ExplorePaneContainerUnconnected extends React.PureComponent { - el: any; + el: HTMLDivElement | null = null; exploreEvents: EventBusExtended; constructor(props: Props) { @@ -100,7 +100,7 @@ class ExplorePaneContainerUnconnected extends React.PureComponent { } }; - getRef = (el: any) => { + getRef = (el: HTMLDivElement) => { this.el = el; }; diff --git a/public/app/features/playlist/StartModal.tsx b/public/app/features/playlist/StartModal.tsx index 5ce2fcef263..171523eec55 100644 --- a/public/app/features/playlist/StartModal.tsx +++ b/public/app/features/playlist/StartModal.tsx @@ -1,6 +1,6 @@ import React, { FC, useState } from 'react'; -import { SelectableValue, urlUtil } from '@grafana/data'; +import { SelectableValue, UrlQueryMap, urlUtil } from '@grafana/data'; import { locationService } from '@grafana/runtime'; import { Button, Checkbox, Field, FieldSet, Modal, RadioButtonGroup } from '@grafana/ui'; @@ -22,7 +22,7 @@ export const StartModal: FC = ({ playlist, onDismiss }) => { ]; const onStart = () => { - const params: any = {}; + const params: UrlQueryMap = {}; if (mode) { params.kiosk = mode; } diff --git a/public/app/features/plugins/admin/pages/Browse.tsx b/public/app/features/plugins/admin/pages/Browse.tsx index e67c588851f..3c8edae639f 100644 --- a/public/app/features/plugins/admin/pages/Browse.tsx +++ b/public/app/features/plugins/admin/pages/Browse.tsx @@ -55,7 +55,7 @@ export default function Browse({ route }: GrafanaRouteComponentProps): ReactElem history.push({ query: { filterByType: value } }); }; - const onSearch = (q: any) => { + const onSearch = (q: string) => { history.push({ query: { filterBy: 'all', filterByType: 'all', q } }); }; diff --git a/public/app/features/transformers/FilterByValueTransformer/ValueMatchers/BasicMatcherEditor.tsx b/public/app/features/transformers/FilterByValueTransformer/ValueMatchers/BasicMatcherEditor.tsx index 726c2fb8bbd..e86bae96704 100644 --- a/public/app/features/transformers/FilterByValueTransformer/ValueMatchers/BasicMatcherEditor.tsx +++ b/public/app/features/transformers/FilterByValueTransformer/ValueMatchers/BasicMatcherEditor.tsx @@ -99,7 +99,7 @@ export const getBasicValueMatchersUI = (): Array({ validator: () => true, - converter: (value: any) => String(value), + converter: (value) => String(value), }), }, ]; diff --git a/public/app/plugins/datasource/loki/components/LokiCheatSheet.tsx b/public/app/plugins/datasource/loki/components/LokiCheatSheet.tsx index e4d966ccb70..f983d2caa72 100644 --- a/public/app/plugins/datasource/loki/components/LokiCheatSheet.tsx +++ b/public/app/plugins/datasource/loki/components/LokiCheatSheet.tsx @@ -37,7 +37,7 @@ const LOGQL_EXAMPLES = [ ]; export default class LokiCheatSheet extends PureComponent, { userExamples: string[] }> { - declare userLabelTimer: NodeJS.Timeout; + declare userLabelTimer: ReturnType; state = { userExamples: [], };