diff --git a/.betterer.results b/.betterer.results index 9d3421eff52..168342a6030 100644 --- a/.betterer.results +++ b/.betterer.results @@ -8,44 +8,8 @@ exports[`better eslint`] = { "e2e/cypress/support/index.d.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"] ], - "e2e/utils/flows/addDashboard.ts:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"], - [0, 0, 0, "Do not use any type assertions.", "1"] - ], "e2e/utils/flows/addDataSource.ts:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"], - [0, 0, 0, "Do not use any type assertions.", "1"] - ], - "e2e/utils/flows/addPanel.ts:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"] - ], - "e2e/utils/flows/configurePanel.ts:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"] - ], - "e2e/utils/flows/deleteDashboard.ts:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"] - ], - "e2e/utils/flows/deleteDataSource.ts:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"] - ], - "e2e/utils/flows/openDashboard.ts:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"] - ], - "e2e/utils/flows/revertAllChanges.ts:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"], - [0, 0, 0, "Unexpected any. Specify a different type.", "1"] - ], - "e2e/utils/flows/selectOption.ts:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"], - [0, 0, 0, "Unexpected any. Specify a different type.", "1"] - ], - "e2e/utils/support/localStorage.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, "Do not use any type assertions.", "5"] + [0, 0, 0, "Do not use any type assertions.", "0"] ], "e2e/utils/support/scenarioContext.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"] @@ -122,9 +86,6 @@ exports[`better eslint`] = { "packages/grafana-data/src/dataframe/dimensions.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"] ], - "packages/grafana-data/src/dataframe/frameComparisons.ts:5381": [ - [0, 0, 0, "Do not use any type assertions.", "0"] - ], "packages/grafana-data/src/dataframe/processDataFrame.test.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"] ], @@ -190,16 +151,9 @@ exports[`better eslint`] = { "packages/grafana-data/src/datetime/rangeutil.ts:5381": [ [0, 0, 0, "Do not use any type assertions.", "0"] ], - "packages/grafana-data/src/datetime/timezones.ts:5381": [ - [0, 0, 0, "Do not use any type assertions.", "0"], - [0, 0, 0, "Do not use any type assertions.", "1"] - ], "packages/grafana-data/src/events/EventBus.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.", "4"] + [0, 0, 0, "Unexpected any. Specify a different type.", "1"] ], "packages/grafana-data/src/events/common.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"], @@ -276,9 +230,6 @@ exports[`better eslint`] = { [0, 0, 0, "Do not use any type assertions.", "2"], [0, 0, 0, "Do not use any type assertions.", "3"] ], - "packages/grafana-data/src/text/text.ts:5381": [ - [0, 0, 0, "Do not use any type assertions.", "0"] - ], "packages/grafana-data/src/themes/colorManipulator.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"], [0, 0, 0, "Unexpected any. Specify a different type.", "1"], @@ -300,13 +251,6 @@ exports[`better eslint`] = { "packages/grafana-data/src/transformations/transformDataFrame.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"] ], - "packages/grafana-data/src/transformations/transformers/calculateField.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, "Do not use any type assertions.", "3"], - [0, 0, 0, "Unexpected any. Specify a different type.", "4"] - ], "packages/grafana-data/src/transformations/transformers/groupBy.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"], [0, 0, 0, "Unexpected any. Specify a different type.", "1"] @@ -315,8 +259,7 @@ exports[`better eslint`] = { [0, 0, 0, "Unexpected any. Specify a different type.", "0"] ], "packages/grafana-data/src/transformations/transformers/histogram.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, "Unexpected any. Specify a different type.", "0"] ], "packages/grafana-data/src/transformations/transformers/joinDataFrames.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"] @@ -458,9 +401,7 @@ exports[`better eslint`] = { [0, 0, 0, "Do not use any type assertions.", "8"] ], "packages/grafana-data/src/types/logs.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.", "2"] + [0, 0, 0, "Do not use any type assertions.", "0"] ], "packages/grafana-data/src/types/options.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"], @@ -487,10 +428,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-data/src/types/query.ts:5381": [ - [0, 0, 0, "Do not use any type assertions.", "0"], - [0, 0, 0, "Do not use any type assertions.", "1"] - ], "packages/grafana-data/src/types/select.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"], [0, 0, 0, "Unexpected any. Specify a different type.", "1"] @@ -514,19 +451,8 @@ exports[`better eslint`] = { ], "packages/grafana-data/src/types/vector.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"], - [0, 0, 0, "Do not use any type assertions.", "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, "Unexpected any. Specify a different type.", "6"], - [0, 0, 0, "Do not use any type assertions.", "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, "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.", "1"], + [0, 0, 0, "Unexpected any. Specify a different type.", "2"] ], "packages/grafana-data/src/utils/OptionsUIBuilders.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"], @@ -675,11 +601,8 @@ exports[`better eslint`] = { [0, 0, 0, "Unexpected any. Specify a different type.", "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, "Do not use any type assertions.", "4"], - [0, 0, 0, "Do not use any type assertions.", "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.", "3"], + [0, 0, 0, "Unexpected any. Specify a different type.", "4"] ], "packages/grafana-data/src/vector/AppendedVectors.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"], @@ -941,10 +864,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/GraphNG/utils.ts:5381": [ - [0, 0, 0, "Do not use any type assertions.", "0"], - [0, 0, 0, "Unexpected any. Specify a different type.", "1"] - ], "packages/grafana-ui/src/components/InfoBox/InfoBox.tsx:5381": [ [0, 0, 0, "Do not use any type assertions.", "0"] ], @@ -953,9 +872,7 @@ exports[`better eslint`] = { ], "packages/grafana-ui/src/components/JSONFormatter/json_explorer/json_explorer.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, "Do not use any type assertions.", "3"] + [0, 0, 0, "Unexpected any. Specify a different type.", "1"] ], "packages/grafana-ui/src/components/Layout/Layout.story.tsx:5381": [ [0, 0, 0, "Do not use any type assertions.", "0"] @@ -1062,23 +979,18 @@ exports[`better eslint`] = { [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, "Do not use any type assertions.", "14"], + [0, 0, 0, "Unexpected any. Specify a different type.", "14"], [0, 0, 0, "Unexpected any. Specify a different type.", "15"], [0, 0, 0, "Unexpected any. Specify a different type.", "16"], [0, 0, 0, "Unexpected any. Specify a different type.", "17"], [0, 0, 0, "Unexpected any. Specify a different type.", "18"], - [0, 0, 0, "Unexpected any. Specify a different type.", "19"], - [0, 0, 0, "Unexpected any. Specify a different type.", "20"] + [0, 0, 0, "Unexpected any. Specify a different type.", "19"] ], "packages/grafana-ui/src/components/StatsPicker/StatsPicker.story.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"] ], - "packages/grafana-ui/src/components/Table/ExpandedRow.tsx:5381": [ - [0, 0, 0, "Do not use any type assertions.", "0"], - [0, 0, 0, "Do not use any type assertions.", "1"] - ], "packages/grafana-ui/src/components/Table/Filter.tsx:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"] ], @@ -1094,17 +1006,13 @@ exports[`better eslint`] = { ], "packages/grafana-ui/src/components/Table/Table.tsx:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "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, "Do not use any type assertions.", "1"] ], "packages/grafana-ui/src/components/Table/TableCell.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"], - [0, 0, 0, "Do not use any type assertions.", "4"], - [0, 0, 0, "Do not use any type assertions.", "5"] + [0, 0, 0, "Unexpected any. Specify a different type.", "3"] ], "packages/grafana-ui/src/components/Table/TableCellInspectModal.tsx:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"] @@ -1118,20 +1026,12 @@ exports[`better eslint`] = { [0, 0, 0, "Unexpected any. Specify a different type.", "1"] ], "packages/grafana-ui/src/components/Table/utils.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"], + [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"], - [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.", "13"] + [0, 0, 0, "Unexpected any. Specify a different type.", "5"] ], "packages/grafana-ui/src/components/Tags/Tag.tsx:5381": [ [0, 0, 0, "Do not use any type assertions.", "0"] @@ -1193,9 +1093,7 @@ exports[`better eslint`] = { ], "packages/grafana-ui/src/components/uPlot/utils.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.", "2"], - [0, 0, 0, "Do not use any type assertions.", "3"] + [0, 0, 0, "Do not use any type assertions.", "1"] ], "packages/grafana-ui/src/options/builder/axis.tsx:5381": [ [0, 0, 0, "Do not use any type assertions.", "0"], @@ -3132,9 +3030,6 @@ exports[`better eslint`] = { "public/app/features/dashboard-scene/inspect/InspectJsonTab.tsx:5381": [ [0, 0, 0, "Use data-testid for E2E selectors instead of aria-label", "0"] ], - "public/app/features/dashboard-scene/scene/RowRepeaterBehavior.ts:5381": [ - [0, 0, 0, "Do not use any type assertions.", "0"] - ], "public/app/features/dashboard-scene/serialization/transformSaveModelToScene.test.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"], [0, 0, 0, "Unexpected any. Specify a different type.", "1"] @@ -3218,10 +3113,8 @@ exports[`better eslint`] = { [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, "Do not use any type assertions.", "10"], - [0, 0, 0, "Do not use any type assertions.", "11"], - [0, 0, 0, "Unexpected any. Specify a different type.", "12"] + [0, 0, 0, "Do not use any type assertions.", "9"], + [0, 0, 0, "Unexpected any. Specify a different type.", "10"] ], "public/app/features/dashboard/components/DashNav/DashNavButton.tsx:5381": [ [0, 0, 0, "Styles should be written using objects.", "0"] @@ -3624,19 +3517,17 @@ exports[`better eslint`] = { [0, 0, 0, "Unexpected any. Specify a different type.", "19"], [0, 0, 0, "Unexpected any. Specify a different type.", "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.", "22"], [0, 0, 0, "Unexpected any. Specify a different type.", "23"], [0, 0, 0, "Unexpected any. Specify a different type.", "24"], [0, 0, 0, "Unexpected any. Specify a different type.", "25"], [0, 0, 0, "Unexpected any. Specify a different type.", "26"], [0, 0, 0, "Unexpected any. Specify a different type.", "27"], - [0, 0, 0, "Unexpected any. Specify a different type.", "28"], + [0, 0, 0, "Do not use any type assertions.", "28"], [0, 0, 0, "Do not use any type assertions.", "29"], - [0, 0, 0, "Do not use any type assertions.", "30"], + [0, 0, 0, "Unexpected any. Specify a different type.", "30"], [0, 0, 0, "Unexpected any. Specify a different type.", "31"], - [0, 0, 0, "Do not use any type assertions.", "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.", "32"] ], "public/app/features/dashboard/state/DashboardModel.repeat.test.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"], @@ -3677,16 +3568,13 @@ exports[`better eslint`] = { [0, 0, 0, "Unexpected any. Specify a different type.", "23"], [0, 0, 0, "Unexpected any. Specify a different type.", "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, "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, "Unexpected any. Specify a different type.", "29"], [0, 0, 0, "Unexpected any. Specify a different type.", "30"], [0, 0, 0, "Unexpected any. Specify a different type.", "31"], - [0, 0, 0, "Unexpected any. Specify a different type.", "32"], - [0, 0, 0, "Unexpected any. Specify a different type.", "33"], - [0, 0, 0, "Unexpected any. Specify a different type.", "34"], - [0, 0, 0, "Unexpected any. Specify a different type.", "35"] + [0, 0, 0, "Unexpected any. Specify a different type.", "32"] ], "public/app/features/dashboard/state/PanelModel.test.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"], @@ -3710,27 +3598,19 @@ exports[`better eslint`] = { [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.", "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.", "11"], + [0, 0, 0, "Do not use any type assertions.", "12"], + [0, 0, 0, "Unexpected any. Specify a different type.", "13"], + [0, 0, 0, "Do not use any type assertions.", "14"], + [0, 0, 0, "Unexpected any. Specify a different type.", "15"], [0, 0, 0, "Unexpected any. Specify a different type.", "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, "Unexpected any. Specify a different type.", "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, "Unexpected any. Specify a different type.", "31"] + [0, 0, 0, "Unexpected any. Specify a different type.", "22"], + [0, 0, 0, "Unexpected any. Specify a different type.", "23"] ], "public/app/features/dashboard/state/TimeModel.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"], @@ -4520,8 +4400,7 @@ exports[`better eslint`] = { ], "public/app/features/geo/utils/frameVectorSource.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.", "2"] + [0, 0, 0, "Do not use any type assertions.", "1"] ], "public/app/features/inspector/DetailText.tsx:5381": [ [0, 0, 0, "Styles should be written using objects.", "0"] @@ -4631,15 +4510,13 @@ exports[`better eslint`] = { [0, 0, 0, "Unexpected any. Specify a different type.", "2"] ], "public/app/features/live/centrifuge/LiveDataStream.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/features/live/centrifuge/channel.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"] ], "public/app/features/live/centrifuge/serviceWorkerProxy.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/features/live/centrifuge/transferHandlers.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"] @@ -4752,9 +4629,6 @@ exports[`better eslint`] = { [0, 0, 0, "Styles should be written using objects.", "1"], [0, 0, 0, "Styles should be written using objects.", "2"] ], - "public/app/features/manage-dashboards/components/ImportDashboardForm.tsx:5381": [ - [0, 0, 0, "Do not use any type assertions.", "0"] - ], "public/app/features/manage-dashboards/components/ImportDashboardLibraryPanelsList.tsx:5381": [ [0, 0, 0, "Do not use any type assertions.", "0"], [0, 0, 0, "Styles should be written using objects.", "1"], @@ -4844,12 +4718,11 @@ exports[`better eslint`] = { [0, 0, 0, "Unexpected any. Specify a different type.", "0"] ], "public/app/features/panel/panellinks/link_srv.ts:5381": [ - [0, 0, 0, "Do not use any type assertions.", "0"], + [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.", "4"] ], "public/app/features/panel/state/actions.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"] @@ -4983,15 +4856,8 @@ exports[`better eslint`] = { [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, "Do not use any type assertions.", "13"], - [0, 0, 0, "Do not use any type assertions.", "14"], - [0, 0, 0, "Unexpected any. Specify a different type.", "15"], - [0, 0, 0, "Unexpected any. Specify a different type.", "16"], - [0, 0, 0, "Do not use any type assertions.", "17"] - ], - "public/app/features/plugins/importPanelPlugin.ts:5381": [ - [0, 0, 0, "Do not use any type assertions.", "0"] + [0, 0, 0, "Unexpected any. Specify a different type.", "12"], + [0, 0, 0, "Do not use any type assertions.", "13"] ], "public/app/features/plugins/pluginSettings.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"], @@ -5090,8 +4956,7 @@ exports[`better eslint`] = { [0, 0, 0, "Unexpected any. Specify a different type.", "0"] ], "public/app/features/query/state/DashboardQueryRunner/AnnotationsQueryRunner.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/features/query/state/DashboardQueryRunner/DashboardQueryRunner.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"] @@ -5102,10 +4967,7 @@ exports[`better eslint`] = { "public/app/features/query/state/DashboardQueryRunner/testHelpers.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, "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.", "2"] ], "public/app/features/query/state/DashboardQueryRunner/utils.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"], @@ -5237,10 +5099,7 @@ exports[`better eslint`] = { [0, 0, 0, "Styles should be written using objects.", "2"] ], "public/app/features/search/page/components/columns.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.", "0"] ], "public/app/features/search/service/bluge.ts:5381": [ [0, 0, 0, "Do not use any type assertions.", "0"], @@ -5303,9 +5162,7 @@ exports[`better eslint`] = { [0, 0, 0, "Styles should be written using objects.", "5"] ], "public/app/features/serviceaccounts/state/reducers.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.", "2"] + [0, 0, 0, "Do not use any type assertions.", "0"] ], "public/app/features/storage/Breadcrumb.tsx:5381": [ [0, 0, 0, "Styles should be written using objects.", "0"] @@ -5331,13 +5188,12 @@ exports[`better eslint`] = { [0, 0, 0, "Styles should be written using objects.", "1"] ], "public/app/features/storage/StoragePage.tsx:5381": [ - [0, 0, 0, "Do not use any type assertions.", "0"], + [0, 0, 0, "Styles should be written using objects.", "0"], [0, 0, 0, "Styles should be written using objects.", "1"], [0, 0, 0, "Styles should be written using objects.", "2"], [0, 0, 0, "Styles should be written using objects.", "3"], [0, 0, 0, "Styles should be written using objects.", "4"], - [0, 0, 0, "Styles should be written using objects.", "5"], - [0, 0, 0, "Styles should be written using objects.", "6"] + [0, 0, 0, "Styles should be written using objects.", "5"] ], "public/app/features/storage/UploadButton.tsx:5381": [ [0, 0, 0, "Styles should be written using objects.", "0"] @@ -5346,8 +5202,7 @@ 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, "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, "Unexpected any. Specify a different type.", "3"] ], "public/app/features/teams/TeamGroupSync.tsx:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"], @@ -5359,13 +5214,8 @@ exports[`better eslint`] = { "public/app/features/teams/TeamMembers.tsx:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"] ], - "public/app/features/teams/TeamPages.tsx:5381": [ - [0, 0, 0, "Do not use any type assertions.", "0"] - ], "public/app/features/teams/state/reducers.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.", "2"] + [0, 0, 0, "Do not use any type assertions.", "0"] ], "public/app/features/teams/state/selectors.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"] @@ -5479,9 +5329,7 @@ exports[`better eslint`] = { [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, "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, "Unexpected any. Specify a different type.", "3"] ], "public/app/features/transformers/extractFields/components/JSONPathEditor.tsx:5381": [ [0, 0, 0, "Styles should be written using objects.", "0"], @@ -5559,10 +5407,6 @@ exports[`better eslint`] = { "public/app/features/variables/adhoc/picker/AdHocFilterRenderer.tsx:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"] ], - "public/app/features/variables/adhoc/urlParser.ts:5381": [ - [0, 0, 0, "Do not use any type assertions.", "0"], - [0, 0, 0, "Unexpected any. Specify a different type.", "1"] - ], "public/app/features/variables/constant/reducer.ts:5381": [ [0, 0, 0, "Do not use any type assertions.", "0"] ], @@ -5624,10 +5468,6 @@ exports[`better eslint`] = { "public/app/features/variables/editor/types.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"] ], - "public/app/features/variables/getAllVariableValuesForUrl.ts:5381": [ - [0, 0, 0, "Do not use any type assertions.", "0"], - [0, 0, 0, "Unexpected any. Specify a different type.", "1"] - ], "public/app/features/variables/guard.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"], [0, 0, 0, "Unexpected any. Specify a different type.", "1"] @@ -5682,9 +5522,6 @@ exports[`better eslint`] = { [0, 0, 0, "Unexpected any. Specify a different type.", "11"], [0, 0, 0, "Unexpected any. Specify a different type.", "12"] ], - "public/app/features/variables/pickers/shared/VariableInput.tsx:5381": [ - [0, 0, 0, "Do not use any type assertions.", "0"] - ], "public/app/features/variables/pickers/shared/VariableLink.tsx:5381": [ [0, 0, 0, "Use data-testid for E2E selectors instead of aria-label", "0"], [0, 0, 0, "Styles should be written using objects.", "1"], @@ -5762,10 +5599,6 @@ exports[`better eslint`] = { "public/app/features/variables/shared/testing/datasourceVariableBuilder.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"] ], - "public/app/features/variables/shared/testing/helpers.ts:5381": [ - [0, 0, 0, "Do not use any type assertions.", "0"], - [0, 0, 0, "Do not use any type assertions.", "1"] - ], "public/app/features/variables/shared/testing/optionsVariableBuilder.ts:5381": [ [0, 0, 0, "Do not use any type assertions.", "0"], [0, 0, 0, "Do not use any type assertions.", "1"], @@ -5873,9 +5706,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/datasource/azuremonitor/components/MonitorConfig.tsx:5381": [ - [0, 0, 0, "Do not use any type assertions.", "0"] - ], "public/app/plugins/datasource/azuremonitor/components/QueryEditor/QueryEditor.tsx:5381": [ [0, 0, 0, "Do not use any type assertions.", "0"] ], @@ -5885,16 +5715,14 @@ exports[`better eslint`] = { "public/app/plugins/datasource/cloud-monitoring/CloudMonitoringMetricFindQuery.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.", "2"], - [0, 0, 0, "Unexpected any. Specify a different type.", "3"] + [0, 0, 0, "Unexpected any. Specify a different type.", "2"] ], "public/app/plugins/datasource/cloud-monitoring/annotationSupport.ts:5381": [ [0, 0, 0, "Do not use any type assertions.", "0"], [0, 0, 0, "Do not use any type assertions.", "1"] ], "public/app/plugins/datasource/cloud-monitoring/components/Aggregation.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.", "0"] ], "public/app/plugins/datasource/cloud-monitoring/components/AliasBy.tsx:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"], @@ -5923,11 +5751,10 @@ 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, "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.", "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, "Do not use any type assertions.", "7"] + [0, 0, 0, "Do not use any type assertions.", "5"], + [0, 0, 0, "Do not use any type assertions.", "6"] ], "public/app/plugins/datasource/cloud-monitoring/functions.ts:5381": [ [0, 0, 0, "Do not use any type assertions.", "0"], @@ -6009,15 +5836,15 @@ 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, "Do not use any type assertions.", "5"], - [0, 0, 0, "Do not use any type assertions.", "6"], + [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, "Do not use any type assertions.", "11"], [0, 0, 0, "Do not use any type assertions.", "12"], - [0, 0, 0, "Do not use any type assertions.", "13"], - [0, 0, 0, "Do not use any type assertions.", "14"], + [0, 0, 0, "Unexpected any. Specify a different type.", "13"], + [0, 0, 0, "Unexpected any. Specify a different type.", "14"], [0, 0, 0, "Unexpected any. Specify a different type.", "15"], [0, 0, 0, "Unexpected any. Specify a different type.", "16"], [0, 0, 0, "Unexpected any. Specify a different type.", "17"], @@ -6028,9 +5855,9 @@ exports[`better eslint`] = { [0, 0, 0, "Unexpected any. Specify a different type.", "22"], [0, 0, 0, "Unexpected any. Specify a different type.", "23"], [0, 0, 0, "Unexpected any. Specify a different type.", "24"], - [0, 0, 0, "Unexpected any. Specify a different type.", "25"], + [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.", "27"], [0, 0, 0, "Unexpected any. Specify a different type.", "28"], [0, 0, 0, "Unexpected any. Specify a different type.", "29"], [0, 0, 0, "Unexpected any. Specify a different type.", "30"], @@ -6048,9 +5875,7 @@ exports[`better eslint`] = { [0, 0, 0, "Unexpected any. Specify a different type.", "42"], [0, 0, 0, "Unexpected any. Specify a different type.", "43"], [0, 0, 0, "Unexpected any. Specify a different type.", "44"], - [0, 0, 0, "Unexpected any. Specify a different type.", "45"], - [0, 0, 0, "Unexpected any. Specify a different type.", "46"], - [0, 0, 0, "Unexpected any. Specify a different type.", "47"] + [0, 0, 0, "Unexpected any. Specify a different type.", "45"] ], "public/app/plugins/datasource/elasticsearch/LanguageProvider.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"], diff --git a/e2e/utils/flows/addDashboard.ts b/e2e/utils/flows/addDashboard.ts index 8d721ee8c0f..cc8e7548032 100644 --- a/e2e/utils/flows/addDashboard.ts +++ b/e2e/utils/flows/addDashboard.ts @@ -3,7 +3,6 @@ import { v4 as uuidv4 } from 'uuid'; import { e2e } from '../index'; import { getDashboardUid } from '../support/url'; -import { DeleteDashboardConfig } from './deleteDashboard'; import { selectOption } from './selectOption'; import { setDashboardTimeRange, TimeRangeConfig } from './setDashboardTimeRange'; @@ -154,9 +153,9 @@ export const addDashboard = (config?: Partial) => { .then((url: string) => { const uid = getDashboardUid(url); - e2e.getScenarioContext().then(({ addedDashboards }: any) => { + e2e.getScenarioContext().then(({ addedDashboards }) => { e2e.setScenarioContext({ - addedDashboards: [...addedDashboards, { title, uid } as DeleteDashboardConfig], + addedDashboards: [...addedDashboards, { title, uid }], }); }); diff --git a/e2e/utils/flows/addDataSource.ts b/e2e/utils/flows/addDataSource.ts index 8dc5c859d3a..808b14c3bcb 100644 --- a/e2e/utils/flows/addDataSource.ts +++ b/e2e/utils/flows/addDataSource.ts @@ -94,7 +94,7 @@ export const addDataSource = (config?: Partial) => { cy.logToConsole('Added data source with name:', name); return cy.url().then(() => { - e2e.getScenarioContext().then(({ addedDataSources }: any) => { + e2e.getScenarioContext().then(({ addedDataSources }) => { e2e.setScenarioContext({ addedDataSources: [...addedDataSources, { name } as DeleteDataSourceConfig], }); diff --git a/e2e/utils/flows/addPanel.ts b/e2e/utils/flows/addPanel.ts index 0f214e51835..e906415ff54 100644 --- a/e2e/utils/flows/addPanel.ts +++ b/e2e/utils/flows/addPanel.ts @@ -5,7 +5,7 @@ import { getScenarioContext } from '../support/scenarioContext'; import { configurePanel, PartialAddPanelConfig } from './configurePanel'; export const addPanel = (config?: Partial) => - getScenarioContext().then(({ lastAddedDataSource }: any) => + getScenarioContext().then(({ lastAddedDataSource }) => configurePanel({ dataSourceName: lastAddedDataSource, panelTitle: `e2e-${uuidv4()}`, diff --git a/e2e/utils/flows/configurePanel.ts b/e2e/utils/flows/configurePanel.ts index 1e6a088438a..ef35a9f3815 100644 --- a/e2e/utils/flows/configurePanel.ts +++ b/e2e/utils/flows/configurePanel.ts @@ -52,9 +52,8 @@ export type AddPanelConfig = ConfigurePanelConfig & AddPanelOverrides; export type PartialEditPanelConfig = PartialConfigurePanelConfig & EditPanelOverrides; export type EditPanelConfig = ConfigurePanelConfig & EditPanelOverrides; -// @todo this actually returns type `Cypress.Chainable` export const configurePanel = (config: PartialAddPanelConfig | PartialEditPanelConfig | PartialConfigurePanelConfig) => - getScenarioContext().then(({ lastAddedDashboardUid }: any) => { + getScenarioContext().then(({ lastAddedDashboardUid }) => { const fullConfig: AddPanelConfig | EditPanelConfig | ConfigurePanelConfig = { chartData: { method: 'POST', @@ -171,7 +170,6 @@ export const configurePanel = (config: PartialAddPanelConfig | PartialEditPanelC return cy.wrap({ config: fullConfig }, { log: false }); }); -// @todo this actually returns type `Cypress.Chainable` const closeOptions = () => e2e.components.PanelEditor.toggleVizOptions().click(); export const VISUALIZATION_ALERT_LIST = 'Alert list'; diff --git a/e2e/utils/flows/deleteDashboard.ts b/e2e/utils/flows/deleteDashboard.ts index 170c675d824..de492012c2f 100644 --- a/e2e/utils/flows/deleteDashboard.ts +++ b/e2e/utils/flows/deleteDashboard.ts @@ -18,7 +18,7 @@ export const deleteDashboard = ({ quick = false, title, uid }: DeleteDashboardCo cy.logToConsole('Deleted dashboard with uid:', uid); - e2e.getScenarioContext().then(({ addedDashboards }: any) => { + e2e.getScenarioContext().then(({ addedDashboards }) => { e2e.setScenarioContext({ addedDashboards: addedDashboards.filter((dashboard: DeleteDashboardConfig) => { return dashboard.title !== title && dashboard.uid !== uid; diff --git a/e2e/utils/flows/deleteDataSource.ts b/e2e/utils/flows/deleteDataSource.ts index f78e31caa78..359c899d01d 100644 --- a/e2e/utils/flows/deleteDataSource.ts +++ b/e2e/utils/flows/deleteDataSource.ts @@ -18,7 +18,7 @@ export const deleteDataSource = ({ id, name, quick = false }: DeleteDataSourceCo cy.logToConsole('Deleted data source with name:', name); - e2e.getScenarioContext().then(({ addedDataSources }: any) => { + e2e.getScenarioContext().then(({ addedDataSources }) => { e2e.setScenarioContext({ addedDataSources: addedDataSources.filter((dataSource: DeleteDataSourceConfig) => { return dataSource.id !== id && dataSource.name !== name; diff --git a/e2e/utils/flows/openDashboard.ts b/e2e/utils/flows/openDashboard.ts index 889afc36da3..3c666a11fd1 100644 --- a/e2e/utils/flows/openDashboard.ts +++ b/e2e/utils/flows/openDashboard.ts @@ -15,9 +15,8 @@ interface OpenDashboardOptional { export type PartialOpenDashboardConfig = Partial & OpenDashboardOptional; export type OpenDashboardConfig = OpenDashboardDefault & OpenDashboardOptional; -// @todo this actually returns type `Cypress.Chainable` export const openDashboard = (config?: PartialOpenDashboardConfig) => - getScenarioContext().then(({ lastAddedDashboardUid }: any) => { + getScenarioContext().then(({ lastAddedDashboardUid }) => { const fullConfig: OpenDashboardConfig = { uid: lastAddedDashboardUid, ...config, diff --git a/e2e/utils/flows/revertAllChanges.ts b/e2e/utils/flows/revertAllChanges.ts index 94b2e966bd6..7551dd1b74a 100644 --- a/e2e/utils/flows/revertAllChanges.ts +++ b/e2e/utils/flows/revertAllChanges.ts @@ -2,8 +2,8 @@ import { e2e } from '../index'; export const revertAllChanges = () => { e2e.getScenarioContext().then(({ addedDashboards, addedDataSources, hasChangedUserPreferences }) => { - addedDashboards.forEach((dashboard: any) => e2e.flows.deleteDashboard({ ...dashboard, quick: true })); - addedDataSources.forEach((dataSource: any) => e2e.flows.deleteDataSource({ ...dataSource, quick: true })); + addedDashboards.forEach((dashboard) => e2e.flows.deleteDashboard({ ...dashboard, quick: true })); + addedDataSources.forEach((dataSource) => e2e.flows.deleteDataSource({ ...dataSource, quick: true })); if (hasChangedUserPreferences) { e2e.flows.setDefaultUserPreferences(); diff --git a/e2e/utils/flows/selectOption.ts b/e2e/utils/flows/selectOption.ts index 2848aadfe8b..68f3717f1bd 100644 --- a/e2e/utils/flows/selectOption.ts +++ b/e2e/utils/flows/selectOption.ts @@ -2,13 +2,12 @@ import { e2e } from '../index'; export interface SelectOptionConfig { clickToOpen?: boolean; - container: any; + container: Cypress.Chainable>; forceClickOption?: boolean; optionText: string | RegExp; } -// @todo this actually returns type `Cypress.Chainable` -export const selectOption = (config: SelectOptionConfig): any => { +export const selectOption = (config: SelectOptionConfig) => { const fullConfig: SelectOptionConfig = { clickToOpen: true, forceClickOption: false, diff --git a/e2e/utils/support/localStorage.ts b/e2e/utils/support/localStorage.ts index 8ff921fb5ea..c7f8436a522 100644 --- a/e2e/utils/support/localStorage.ts +++ b/e2e/utils/support/localStorage.ts @@ -1,10 +1,9 @@ // @todo this actually returns type `Cypress.Chainable` -const get = (key: string): any => +const get = (key: string) => cy.wrap({ getLocalStorage: () => localStorage.getItem(key) }, { log: false }).invoke('getLocalStorage'); -// @todo this actually returns type `Cypress.Chainable` -export const getLocalStorage = (key: string): any => - get(key).then((value: any) => { +export const getLocalStorage = (key: string) => + get(key).then((value) => { if (value === null) { return value; } else { @@ -12,8 +11,7 @@ export const getLocalStorage = (key: string): any => } }); -// @todo this actually returns type `Cypress.Chainable` -export const requireLocalStorage = (key: string): any => +export const requireLocalStorage = (key: string) => get(key) // `getLocalStorage()` would turn 'null' into `null` .should('not.equal', null) - .then((value: any) => JSON.parse(value as string)); + .then((value) => JSON.parse(value)); diff --git a/packages/grafana-data/src/dataframe/frameComparisons.ts b/packages/grafana-data/src/dataframe/frameComparisons.ts index 01329cbe3ca..67eee91bae4 100644 --- a/packages/grafana-data/src/dataframe/frameComparisons.ts +++ b/packages/grafana-data/src/dataframe/frameComparisons.ts @@ -50,6 +50,7 @@ export function compareDataFrameStructures(a: DataFrame, b: DataFrame, skipConfi // see e.g. https://github.com/Microsoft/TypeScript/issues/12870 // eslint-disable-next-line @typescript-eslint/consistent-type-assertions let aKeys = Object.keys(cfgA) as Array; + // eslint-disable-next-line @typescript-eslint/consistent-type-assertions let bKeys = Object.keys(cfgB) as Array; if (aKeys.length !== bKeys.length) { diff --git a/packages/grafana-data/src/datetime/timezones.ts b/packages/grafana-data/src/datetime/timezones.ts index f1cca497c55..6045ef51d7c 100644 --- a/packages/grafana-data/src/datetime/timezones.ts +++ b/packages/grafana-data/src/datetime/timezones.ts @@ -120,14 +120,14 @@ const mapInternal = (zone: string, timestamp: number): TimeZoneInfo | undefined case InternalTimeZones.default: { const tz = getTimeZone(); const isInternal = tz === 'browser' || tz === 'utc'; - const info = (isInternal ? mapInternal(tz, timestamp) : mapToInfo(tz, timestamp)) ?? {}; + const info = isInternal ? mapInternal(tz, timestamp) : mapToInfo(tz, timestamp); return { countries: countriesByTimeZone[tz] ?? [], abbreviation: '', offsetInMins: 0, ...info, - ianaName: (info as TimeZoneInfo).ianaName, + ianaName: info?.ianaName ?? '', name: 'Default', zone, }; @@ -135,7 +135,7 @@ const mapInternal = (zone: string, timestamp: number): TimeZoneInfo | undefined case InternalTimeZones.localBrowserTime: { const tz = moment.tz.guess(true); - const info = mapToInfo(tz, timestamp) ?? {}; + const info = mapToInfo(tz, timestamp); return { countries: countriesByTimeZone[tz] ?? [], @@ -143,7 +143,7 @@ const mapInternal = (zone: string, timestamp: number): TimeZoneInfo | undefined offsetInMins: new Date().getTimezoneOffset(), ...info, name: 'Browser Time', - ianaName: (info as TimeZoneInfo).ianaName, + ianaName: info?.ianaName ?? '', zone, }; } diff --git a/packages/grafana-data/src/events/EventBus.ts b/packages/grafana-data/src/events/EventBus.ts index 106ff4da074..a842d567f4b 100644 --- a/packages/grafana-data/src/events/EventBus.ts +++ b/packages/grafana-data/src/events/EventBus.ts @@ -123,20 +123,20 @@ class ScopedEventBus implements EventBus { publish(event: T): void { if (!event.origin) { - (event as any).origin = this; + event.origin = this; } this.eventBus.publish(event); } - filter = (event: BusEvent) => { + filter(event: T) { if (this.filterConfig.onlyLocal) { return event.origin === this; } return true; - }; + } getStream(eventType: BusEventType): Observable { - return this.eventBus.getStream(eventType).pipe(filter(this.filter)) as Observable; + return this.eventBus.getStream(eventType).pipe(filter(this.filter)); } // syntax sugar diff --git a/packages/grafana-data/src/events/types.ts b/packages/grafana-data/src/events/types.ts index ce7d89f17c1..5ef531a46f9 100644 --- a/packages/grafana-data/src/events/types.ts +++ b/packages/grafana-data/src/events/types.ts @@ -7,7 +7,7 @@ import { Unsubscribable, Observable } from 'rxjs'; export interface BusEvent { readonly type: string; readonly payload?: any; - readonly origin?: EventBus; + origin?: EventBus; } /** diff --git a/packages/grafana-data/src/text/text.ts b/packages/grafana-data/src/text/text.ts index 0791641a9dc..f5baa5b0a3a 100644 --- a/packages/grafana-data/src/text/text.ts +++ b/packages/grafana-data/src/text/text.ts @@ -18,7 +18,9 @@ export function findHighlightChunksInText({ }) { const chunks: TextMatch[] = []; for (const term of searchWords) { - chunks.push(...findMatchesInText(textToHighlight, term as string)); + if (typeof term === 'string') { + chunks.push(...findMatchesInText(textToHighlight, term)); + } } return chunks; } diff --git a/packages/grafana-data/src/transformations/transformers/calculateField.ts b/packages/grafana-data/src/transformations/transformers/calculateField.ts index 3a5a9218ffc..44bdd79b15a 100644 --- a/packages/grafana-data/src/transformations/transformers/calculateField.ts +++ b/packages/grafana-data/src/transformations/transformers/calculateField.ts @@ -58,7 +58,7 @@ export interface CalculateFieldTransformerOptions { // TODO: config?: FieldConfig; or maybe field overrides? since the UI exists } -type ValuesCreator = (data: DataFrame) => any[]; +type ValuesCreator = (data: DataFrame) => unknown[] | undefined; export const calculateFieldTransformer: DataTransformerInfo = { id: DataTransformerID.calculateField, @@ -178,7 +178,7 @@ function getReduceRowCreator(options: ReduceOptions, allFrames: DataFrame[]): Va return (frame: DataFrame) => { // Find the columns that should be examined - const columns: any[] = []; + const columns = []; for (const field of frame.fields) { if (matcher(field, frame, allFrames)) { columns.push(field.values); @@ -239,7 +239,7 @@ function getBinaryCreator(options: BinaryOptions, allFrames: DataFrame[]): Value const left = findFieldValuesWithNameOrConstant(frame, options.left, allFrames); const right = findFieldValuesWithNameOrConstant(frame, options.right, allFrames); if (!left || !right || !operator) { - return undefined as unknown as any[]; + return undefined; } const arr = new Array(left.length); diff --git a/packages/grafana-data/src/transformations/transformers/histogram.ts b/packages/grafana-data/src/transformations/transformers/histogram.ts index cba17782e67..d3020490749 100644 --- a/packages/grafana-data/src/transformations/transformers/histogram.ts +++ b/packages/grafana-data/src/transformations/transformers/histogram.ts @@ -253,7 +253,7 @@ export function buildHistogram(frames: DataFrame[], options?: HistogramTransform for (const frame of frames) { for (const field of frame.fields) { if (field.type === FieldType.number) { - let fieldHist = histogram(field.values, getBucket, histFilter, histSort) as AlignedData; + let fieldHist = histogram(field.values, getBucket, histFilter, histSort); histograms.push(fieldHist); counts.push({ ...field, @@ -362,7 +362,7 @@ function histogram( getBucket: (v: number) => number, filterOut?: any[] | null, sort?: ((a: number, b: number) => number) | null -) { +): AlignedData { let hist = new Map(); for (let i = 0; i < vals.length; i++) { diff --git a/packages/grafana-data/src/types/logs.ts b/packages/grafana-data/src/types/logs.ts index 557c445162d..947fcc59f44 100644 --- a/packages/grafana-data/src/types/logs.ts +++ b/packages/grafana-data/src/types/logs.ts @@ -157,9 +157,7 @@ export const hasLogsContextSupport = (datasource: unknown): datasource is DataSo return false; } - const withLogsSupport = datasource as DataSourceWithLogsContextSupport; - - return withLogsSupport.getLogRowContext !== undefined && withLogsSupport.showContextToggle !== undefined; + return 'getLogRowContext' in datasource && 'showContextToggle' in datasource; }; /** @@ -259,9 +257,7 @@ export const hasLogsContextUiSupport = (datasource: unknown): datasource is Data return false; } - const withLogsSupport = datasource as DataSourceWithLogsContextSupport; - - return withLogsSupport.getLogRowContextUi !== undefined; + return 'getLogRowContextUi' in datasource; }; export interface QueryFilterOptions extends KeyValue {} diff --git a/packages/grafana-data/src/types/query.ts b/packages/grafana-data/src/types/query.ts index 18476dd54d1..f335755a8cd 100644 --- a/packages/grafana-data/src/types/query.ts +++ b/packages/grafana-data/src/types/query.ts @@ -66,7 +66,10 @@ export interface DataSourceWithQueryExportSupport( datasource: unknown ): datasource is DataSourceWithQueryImportSupport => { - return (datasource as DataSourceWithQueryImportSupport).importFromAbstractQueries !== undefined; + if (!datasource) { + return false; + } + return 'importFromAbstractQueries' in datasource; }; /** @@ -75,5 +78,8 @@ export const hasQueryImportSupport = ( export const hasQueryExportSupport = ( datasource: unknown ): datasource is DataSourceWithQueryExportSupport => { - return (datasource as DataSourceWithQueryExportSupport).exportToAbstractQueries !== undefined; + if (!datasource) { + return false; + } + return 'exportToAbstractQueries' in datasource; }; diff --git a/packages/grafana-data/src/types/vector.ts b/packages/grafana-data/src/types/vector.ts index 34c05aa9146..bb6895246ae 100644 --- a/packages/grafana-data/src/types/vector.ts +++ b/packages/grafana-data/src/types/vector.ts @@ -16,24 +16,24 @@ declare global { if (!Object.getOwnPropertyDescriptor(Array.prototype, 'toArray')) { Object.defineProperties(Array.prototype, { get: { - value: function (idx: number): any { - return (this as any)[idx]; + value: function (idx: number) { + return this[idx]; }, writable: true, enumerable: false, configurable: true, }, set: { - value: function (idx: number, value: any) { - (this as any)[idx] = value; + value: function (idx: number, value: unknown) { + this[idx] = value; }, writable: true, enumerable: false, configurable: true, }, add: { - value: function (value: any) { - (this as any).push(value); + value: function (value: unknown) { + this.push(value); }, writable: true, enumerable: false, @@ -106,7 +106,7 @@ export interface MutableVector extends ReadWriteVector {} * @deprecated */ export function makeArrayIndexableVector(v: T): T { - return new Proxy(v, { + return new Proxy(v, { get(target: Vector, property: string, receiver: Vector) { if (typeof property !== 'symbol') { const idx = +property; @@ -116,7 +116,7 @@ export function makeArrayIndexableVector(v: T): T { } return Reflect.get(target, property, receiver); }, - set(target: Vector, property: string, value: any, receiver: Vector) { + set(target: Vector, property: string, value: unknown, receiver: Vector) { if (typeof property !== 'symbol') { const idx = +property; if (String(idx) === property) { @@ -126,5 +126,5 @@ export function makeArrayIndexableVector(v: T): T { } return Reflect.set(target, property, value, receiver); }, - }) as T; + }); } diff --git a/packages/grafana-data/src/utils/valueMappings.ts b/packages/grafana-data/src/utils/valueMappings.ts index a0df9109dc6..b6a6c4b7499 100644 --- a/packages/grafana-data/src/utils/valueMappings.ts +++ b/packages/grafana-data/src/utils/valueMappings.ts @@ -30,7 +30,7 @@ export function getValueMappingResult(valueMappings: ValueMapping[], value: any) continue; } - const valueAsNumber = parseFloat(value as string); + const valueAsNumber = parseFloat(value); if (isNaN(valueAsNumber)) { continue; } @@ -76,13 +76,13 @@ export function getValueMappingResult(valueMappings: ValueMapping[], value: any) break; } case SpecialValueMatch.NaN: { - if (isNaN(value as number)) { + if (typeof value === 'number' && isNaN(value)) { return vm.options.result; } break; } case SpecialValueMatch.NullAndNaN: { - if (isNaN(value as number) || value == null) { + if ((typeof value === 'number' && isNaN(value)) || value == null) { return vm.options.result; } break; diff --git a/packages/grafana-ui/src/components/GraphNG/utils.ts b/packages/grafana-ui/src/components/GraphNG/utils.ts index 66f511195ae..9922b85d9df 100644 --- a/packages/grafana-ui/src/components/GraphNG/utils.ts +++ b/packages/grafana-ui/src/components/GraphNG/utils.ts @@ -29,7 +29,7 @@ export function getRefField(frame: DataFrame, refFieldName?: string | null) { function applySpanNullsThresholds(frame: DataFrame, refFieldName?: string | null) { const refField = getRefField(frame, refFieldName); - let refValues = refField?.values as any[]; + let refValues = refField?.values; for (let i = 0; i < frame.fields.length; i++) { let field = frame.fields[i]; @@ -41,7 +41,7 @@ function applySpanNullsThresholds(frame: DataFrame, refFieldName?: string | null let spanNulls = field.config.custom?.spanNulls; if (typeof spanNulls === 'number') { - if (spanNulls !== -1) { + if (spanNulls !== -1 && refValues) { field.values = nullToUndefThreshold(refValues, field.values, spanNulls); } } diff --git a/packages/grafana-ui/src/components/JSONFormatter/json_explorer/helpers.ts b/packages/grafana-ui/src/components/JSONFormatter/json_explorer/helpers.ts index 51935173e4e..2739891ad2b 100644 --- a/packages/grafana-ui/src/components/JSONFormatter/json_explorer/helpers.ts +++ b/packages/grafana-ui/src/components/JSONFormatter/json_explorer/helpers.ts @@ -103,7 +103,11 @@ export function cssClass(className: string): string { * Creates a new DOM element with given type and class * TODO: move me to helpers */ -export function createElement(type: string, className?: string, content?: Element | string): Element { +export function createElement( + type: T, + className?: string, + content?: Element | string +) { const el = document.createElement(type); if (className) { el.classList.add(cssClass(className)); diff --git a/packages/grafana-ui/src/components/JSONFormatter/json_explorer/json_explorer.ts b/packages/grafana-ui/src/components/JSONFormatter/json_explorer/json_explorer.ts index c93e811a40d..8cda958b594 100644 --- a/packages/grafana-ui/src/components/JSONFormatter/json_explorer/json_explorer.ts +++ b/packages/grafana-ui/src/components/JSONFormatter/json_explorer/json_explorer.ts @@ -42,7 +42,7 @@ export class JsonExplorer { private _isOpen: boolean | null = null; // A reference to the element that we render to - private element: Element | null = null; + private element: HTMLDivElement | null = null; private skipChildren = false; @@ -358,7 +358,7 @@ export class JsonExplorer { togglerLink.addEventListener('click', this.toggleOpen.bind(this)); } - return this.element as HTMLDivElement; + return this.element; } /** @@ -404,8 +404,7 @@ export class JsonExplorer { * Animated option is used when user triggers this via a click */ removeChildren(animated = false) { - const childrenElement = - this.element && (this.element.querySelector(`div.${cssClass('children')}`) as HTMLDivElement); + const childrenElement = this.element && this.element.querySelector(`div.${cssClass('children')}`); if (animated) { let childrenRemoved = 0; diff --git a/packages/grafana-ui/src/components/SingleStatShared/SingleStatBaseOptions.ts b/packages/grafana-ui/src/components/SingleStatShared/SingleStatBaseOptions.ts index ee5febb6c56..49ce29f6818 100644 --- a/packages/grafana-ui/src/components/SingleStatShared/SingleStatBaseOptions.ts +++ b/packages/grafana-ui/src/components/SingleStatShared/SingleStatBaseOptions.ts @@ -236,7 +236,7 @@ export function sharedSingleStatMigrationHandler(panel: PanelModel { }; export function getExpandedRowHeight(nestedData: Field, rowIndex: number, tableStyles: TableStyles) { - const frames = nestedData.values as DataFrame[][]; + const frames: DataFrame[][] = nestedData.values; const height = frames[rowIndex].reduce((acc: number, frame: DataFrame) => { if (frame.length) { diff --git a/packages/grafana-ui/src/components/Table/Table.tsx b/packages/grafana-ui/src/components/Table/Table.tsx index 1f1ddf6f160..d7568efa1b7 100644 --- a/packages/grafana-ui/src/components/Table/Table.tsx +++ b/packages/grafana-ui/src/components/Table/Table.tsx @@ -12,7 +12,7 @@ import { } from 'react-table'; import { VariableSizeList } from 'react-window'; -import { Field, FieldType, ReducerID } from '@grafana/data'; +import { FieldType, ReducerID } from '@grafana/data'; import { selectors } from '@grafana/e2e-selectors'; import { TableCellHeight } from '@grafana/schema'; @@ -176,7 +176,7 @@ export const Table = memo((props: Props) => { } const footerItems = getFooterItems( - headerGroups[0].headers as unknown as Array<{ id: string; field: Field }>, + headerGroups[0].headers, createFooterCalculationValues(rows), footerOptions, theme diff --git a/packages/grafana-ui/src/components/Table/TableCell.tsx b/packages/grafana-ui/src/components/Table/TableCell.tsx index 329ae6568f3..8b0452a8550 100644 --- a/packages/grafana-ui/src/components/Table/TableCell.tsx +++ b/packages/grafana-ui/src/components/Table/TableCell.tsx @@ -30,16 +30,20 @@ export const TableCell = ({ cell, tableStyles, onCellFilterAdded, timeRange, use cellProps.style.justifyContent = (cell.column as any).justifyContent; } - let innerWidth = ((cell.column.width as number) ?? 24) - tableStyles.cellPadding * 2; + let innerWidth = (typeof cell.column.width === 'number' ? cell.column.width : 24) - tableStyles.cellPadding * 2; - return cell.render('Cell', { - field, - tableStyles, - onCellFilterAdded, - cellProps, - innerWidth, - timeRange, - userProps, - frame, - }) as React.ReactElement; + return ( + <> + {cell.render('Cell', { + field, + tableStyles, + onCellFilterAdded, + cellProps, + innerWidth, + timeRange, + userProps, + frame, + })} + + ); }; diff --git a/packages/grafana-ui/src/components/Table/utils.test.tsx b/packages/grafana-ui/src/components/Table/utils.test.ts similarity index 100% rename from packages/grafana-ui/src/components/Table/utils.test.tsx rename to packages/grafana-ui/src/components/Table/utils.test.ts diff --git a/packages/grafana-ui/src/components/Table/utils.ts b/packages/grafana-ui/src/components/Table/utils.ts index 7dd1f7cf58f..f237b8b7c80 100644 --- a/packages/grafana-ui/src/components/Table/utils.ts +++ b/packages/grafana-ui/src/components/Table/utils.ts @@ -49,7 +49,7 @@ export function getTextAlign(field?: Field): Property.JustifyContent { } if (field.config.custom) { - const custom = field.config.custom as TableFieldOptions; + const custom: TableFieldOptions = field.config.custom; switch (custom.align) { case 'right': @@ -101,7 +101,7 @@ export function getColumns( } for (const [fieldIndex, field] of data.fields.entries()) { - const fieldTableOptions = (field.config.custom || {}) as TableFieldOptions; + const fieldTableOptions: TableFieldOptions = field.config.custom || {}; if (fieldTableOptions.hidden || field.type === FieldType.nestedFrames) { continue; } @@ -131,7 +131,7 @@ export function getColumns( id: fieldIndex.toString(), field: field, Header: fieldTableOptions.hideHeader ? '' : getFieldDisplayName(field, data), - accessor: (_row: any, i: number) => { + accessor: (_row, i) => { return field.values[i]; }, sortType: selectSortType(field.type), @@ -255,7 +255,7 @@ export function rowToFieldValue(row: any, field?: Field): string { return value; } -export function valuesToOptions(unique: Record): SelectableValue[] { +export function valuesToOptions(unique: Record): SelectableValue[] { return Object.keys(unique) .reduce((all, key) => all.concat({ value: unique[key], label: key }), []) .sort(sortOptions); @@ -293,12 +293,12 @@ export function getFilteredOptions(options: SelectableValue[], filterValues?: Se return options.filter((option) => filterValues.some((filtered) => filtered.value === option.value)); } -export function sortCaseInsensitive(a: Row, b: Row, id: string) { +export function sortCaseInsensitive(a: Row, b: Row, id: string) { return String(a.values[id]).localeCompare(String(b.values[id]), undefined, { sensitivity: 'base' }); } // sortNumber needs to have great performance as it is called a lot -export function sortNumber(rowA: Row, rowB: Row, id: string) { +export function sortNumber(rowA: Row, rowB: Row, id: string) { const a = toNumber(rowA.values[id]); const b = toNumber(rowB.values[id]); return a === b ? 0 : a > b ? 1 : -1; diff --git a/packages/grafana-ui/src/components/uPlot/utils.ts b/packages/grafana-ui/src/components/uPlot/utils.ts index d44ad21ec6a..b9312097b66 100644 --- a/packages/grafana-ui/src/components/uPlot/utils.ts +++ b/packages/grafana-ui/src/components/uPlot/utils.ts @@ -118,11 +118,11 @@ export function getStackingGroups(frame: DataFrame) { let stackDir = getStackDirection(transform, values); let drawStyle: GraphDrawStyle = custom.drawStyle; - let drawStyle2 = + let drawStyle2: BarAlignment | LineInterpolation | null = drawStyle === GraphDrawStyle.Bars - ? (custom.barAlignment as BarAlignment) + ? custom.barAlignment : drawStyle === GraphDrawStyle.Line - ? (custom.lineInterpolation as LineInterpolation) + ? custom.lineInterpolation : null; let stackKey = `${stackDir}|${stackingMode}|${stackingGroup}|${buildScaleKey( diff --git a/public/app/features/dashboard-scene/scene/RowRepeaterBehavior.ts b/public/app/features/dashboard-scene/scene/RowRepeaterBehavior.ts index fa8dc661005..4e34cd8923b 100644 --- a/public/app/features/dashboard-scene/scene/RowRepeaterBehavior.ts +++ b/public/app/features/dashboard-scene/scene/RowRepeaterBehavior.ts @@ -85,7 +85,7 @@ export class RowRepeaterBehavior extends SceneObjectBase) { const loadDashboardMock = jest.fn().mockResolvedValue(rsp); setDashboardLoaderSrv({ loadDashboard: loadDashboardMock, + // disabling type checks since this is a test util + // eslint-disable-next-line @typescript-eslint/consistent-type-assertions } as unknown as DashboardLoaderSrv); return loadDashboardMock; } @@ -27,6 +29,8 @@ export function mockResizeObserver() { left: 100, right: 0, }, + // disabling type checks since this is a test util + // eslint-disable-next-line @typescript-eslint/consistent-type-assertions } as ResizeObserverEntry, ], this diff --git a/public/app/features/dashboard/components/DashExportModal/DashboardExporter.ts b/public/app/features/dashboard/components/DashExportModal/DashboardExporter.ts index c57069f339d..9dc25f22ffd 100644 --- a/public/app/features/dashboard/components/DashExportModal/DashboardExporter.ts +++ b/public/app/features/dashboard/components/DashExportModal/DashboardExporter.ts @@ -105,10 +105,10 @@ export class DashboardExporter { return; } - let datasource: string = obj.datasource; + let datasource = obj.datasource; let datasourceVariable: any = null; - const datasourceUid: string = (datasource as any)?.uid; + const datasourceUid: string = datasource?.uid; // ignore data source properties that contain a variable if (datasourceUid) { if (datasourceUid.indexOf('$') === 0) { diff --git a/public/app/features/dashboard/state/DashboardMigrator.ts b/public/app/features/dashboard/state/DashboardMigrator.ts index 6ab70552a50..4c800df104c 100644 --- a/public/app/features/dashboard/state/DashboardMigrator.ts +++ b/public/app/features/dashboard/state/DashboardMigrator.ts @@ -790,7 +790,7 @@ export class DashboardMigrator { if (panelDataSourceWasDefault && target.datasource?.uid !== '__expr__') { // We can have situations when default ds changed and the panel level data source is different from the queries // In this case we use the query level data source as source for truth - panel.datasource = target.datasource as DataSourceRef; + panel.datasource = target.datasource; } } } @@ -1206,7 +1206,7 @@ export function migrateDatasourceNameToRef( const ds = getDataSourceSrv().getInstanceSettings(nameOrRef); if (!ds) { - return { uid: nameOrRef as string }; // not found + return { uid: nameOrRef ? nameOrRef : undefined }; // not found } return getDataSourceRef(ds); diff --git a/public/app/features/dashboard/state/DashboardModel.ts b/public/app/features/dashboard/state/DashboardModel.ts index 3ad83834279..2b5130b18c8 100644 --- a/public/app/features/dashboard/state/DashboardModel.ts +++ b/public/app/features/dashboard/state/DashboardModel.ts @@ -1072,7 +1072,7 @@ export class DashboardModel implements TimeModel { } getTimezone(): TimeZone { - return (this.timezone ? this.timezone : contextSrv?.user?.timezone) as TimeZone; + return this.timezone ? this.timezone : contextSrv?.user?.timezone; } private updateSchema(old: any) { @@ -1141,7 +1141,7 @@ export class DashboardModel implements TimeModel { // First try to find it in a collapsed row and exand it const collapsedPanels = this.panels.filter((p) => p.collapsed); for (const panel of collapsedPanels) { - const hasPanel = panel.panels?.some((rp: any) => rp.id === panelId); + const hasPanel = panel.panels?.some((rp) => rp.id === panelId); hasPanel && this.toggleRow(panel); } @@ -1263,7 +1263,7 @@ export class DashboardModel implements TimeModel { return !isEqual(updated, originalVariables); } - private cloneVariablesFrom(variables: any[]): any[] { + private cloneVariablesFrom(variables: any[]) { return variables.map((variable) => ({ name: variable.name, type: variable.type, diff --git a/public/app/features/dashboard/state/PanelModel.ts b/public/app/features/dashboard/state/PanelModel.ts index 41fe17497ee..fc9de95199d 100644 --- a/public/app/features/dashboard/state/PanelModel.ts +++ b/public/app/features/dashboard/state/PanelModel.ts @@ -1,4 +1,4 @@ -import { cloneDeep, defaultsDeep, isArray, isEqual, keys } from 'lodash'; +import { cloneDeep, defaultsDeep, isArray, isEqual } from 'lodash'; import { v4 as uuidv4 } from 'uuid'; import { @@ -228,15 +228,15 @@ export class PanelModel implements DataConfigSource, IPanelModel { continue; } - if (typeof (this as any)[property] === 'function') { + if (typeof this[property] === 'function') { continue; } - if (typeof (this as any)[property] === 'symbol') { + if (typeof this[property] === 'symbol') { continue; } - delete (this as any)[property]; + delete this[property]; } // copy properties from persisted model @@ -463,11 +463,11 @@ export class PanelModel implements DataConfigSource, IPanelModel { clearPropertiesBeforePluginChange() { // remove panel type specific options - for (const key of keys(this)) { + for (const key in this) { if (mustKeepProps[key]) { continue; } - delete (this as any)[key]; + delete this[key]; } this.options = {}; diff --git a/public/app/features/geo/utils/frameVectorSource.ts b/public/app/features/geo/utils/frameVectorSource.ts index 25cf679a44c..a996aa55f88 100644 --- a/public/app/features/geo/utils/frameVectorSource.ts +++ b/public/app/features/geo/utils/frameVectorSource.ts @@ -45,7 +45,7 @@ export class FrameVectorSource extends VectorSour //eslint-disable-next-line const field = info.field as unknown as Field; - const geometry = new LineString(field.values.map((p) => p.getCoordinates())) as Geometry; + const geometry: Geometry = new LineString(field.values.map((p) => p.getCoordinates())); this.addFeatureInternal( new Feature({ frame, diff --git a/public/app/features/live/centrifuge/LiveDataStream.ts b/public/app/features/live/centrifuge/LiveDataStream.ts index fbb93929b81..a4b6eb80255 100644 --- a/public/app/features/live/centrifuge/LiveDataStream.ts +++ b/public/app/features/live/centrifuge/LiveDataStream.ts @@ -315,9 +315,7 @@ export class LiveDataStream { ? lastMessage.values : reduceNewValuesSameSchemaMessages(messages).values; - const filteredValues = matchingFieldIndexes - ? values.filter((v, i) => (matchingFieldIndexes as number[]).includes(i)) - : values; + const filteredValues = matchingFieldIndexes ? values.filter((v, i) => matchingFieldIndexes?.includes(i)) : values; return { key: subKey, diff --git a/public/app/features/live/centrifuge/serviceWorkerProxy.ts b/public/app/features/live/centrifuge/serviceWorkerProxy.ts index 9cbea1b8312..efb87e3cdd5 100644 --- a/public/app/features/live/centrifuge/serviceWorkerProxy.ts +++ b/public/app/features/live/centrifuge/serviceWorkerProxy.ts @@ -14,7 +14,7 @@ export class CentrifugeServiceWorkerProxy implements CentrifugeSrv { private centrifugeWorker; constructor(deps: CentrifugeSrvDeps) { - this.centrifugeWorker = comlink.wrap(createWorker() as comlink.Endpoint); + this.centrifugeWorker = comlink.wrap(createWorker()); this.centrifugeWorker.initialize(deps, comlink.proxy(deps.dataStreamSubscriberReadiness)); } diff --git a/public/app/features/manage-dashboards/components/ImportDashboardForm.tsx b/public/app/features/manage-dashboards/components/ImportDashboardForm.tsx index 2c11a7cd4c6..b49f9c1ca4e 100644 --- a/public/app/features/manage-dashboards/components/ImportDashboardForm.tsx +++ b/public/app/features/manage-dashboards/components/ImportDashboardForm.tsx @@ -1,4 +1,4 @@ -import React, { BaseSyntheticEvent, useEffect, useState } from 'react'; +import React, { useEffect, useState } from 'react'; import { selectors } from '@grafana/e2e-selectors'; import { ExpressionDatasourceRef } from '@grafana/runtime/src/utils/DataSourceWithBackend'; @@ -60,7 +60,7 @@ export const ImportDashboardForm = ({ */ useEffect(() => { if (isSubmitted && (errors.title || errors.uid)) { - onSubmit(getValues(), {} as BaseSyntheticEvent); + onSubmit(getValues()); } }, [errors, getValues, isSubmitted, onSubmit]); const newLibraryPanels = inputs?.libraryPanels?.filter((i) => i.state === LibraryPanelInputState.New) ?? []; diff --git a/public/app/features/panel/panellinks/link_srv.ts b/public/app/features/panel/panellinks/link_srv.ts index 2fc1e764325..e8d47aaa884 100644 --- a/public/app/features/panel/panellinks/link_srv.ts +++ b/public/app/features/panel/panellinks/link_srv.ts @@ -85,7 +85,7 @@ export const getPanelLinksVariableSuggestions = (): VariableSuggestion[] => [ ...getTemplateSrv() .getVariables() .map((variable) => ({ - value: variable.name as string, + value: variable.name, label: variable.name, origin: VariableOrigin.Template, })), diff --git a/public/app/features/plugins/datasource_srv.ts b/public/app/features/plugins/datasource_srv.ts index 87cab5d424c..78c23d8e92b 100644 --- a/public/app/features/plugins/datasource_srv.ts +++ b/public/app/features/plugins/datasource_srv.ts @@ -352,7 +352,7 @@ export function getNameOrUid(ref?: string | DataSourceRef | null): string | unde } const isString = typeof ref === 'string'; - return isString ? (ref as string) : ((ref as any)?.uid as string | undefined); + return isString ? ref : ref?.uid; } export function variableInterpolation(value: any[]) { diff --git a/public/app/features/plugins/importPanelPlugin.ts b/public/app/features/plugins/importPanelPlugin.ts index 00238238d86..deb130f838a 100644 --- a/public/app/features/plugins/importPanelPlugin.ts +++ b/public/app/features/plugins/importPanelPlugin.ts @@ -53,7 +53,7 @@ function getPanelPlugin(meta: PanelPluginMeta): Promise { }) .then((pluginExports) => { if (pluginExports.plugin) { - return pluginExports.plugin as PanelPlugin; + return pluginExports.plugin; } else if (pluginExports.PanelCtrl) { const plugin = new PanelPlugin(null); plugin.angularPanelCtrl = pluginExports.PanelCtrl; diff --git a/public/app/features/query/state/DashboardQueryRunner/AnnotationsQueryRunner.ts b/public/app/features/query/state/DashboardQueryRunner/AnnotationsQueryRunner.ts index 05b5bf7a3bc..6c656d4d8b3 100644 --- a/public/app/features/query/state/DashboardQueryRunner/AnnotationsQueryRunner.ts +++ b/public/app/features/query/state/DashboardQueryRunner/AnnotationsQueryRunner.ts @@ -23,7 +23,7 @@ export class AnnotationsQueryRunner implements AnnotationQueryRunner { return of([]); } - const panel: PanelModel = {} as unknown as PanelModel; // deliberate setting panel to empty object because executeAnnotationQuery shouldn't depend on panelModel + const panel: PanelModel = {} as PanelModel; // deliberate setting panel to empty object because executeAnnotationQuery shouldn't depend on panelModel return executeAnnotationQuery({ dashboard, range, panel }, datasource!, annotation).pipe( map((result) => { diff --git a/public/app/features/query/state/DashboardQueryRunner/testHelpers.ts b/public/app/features/query/state/DashboardQueryRunner/testHelpers.ts index 9e90efdf8a2..027f02514dd 100644 --- a/public/app/features/query/state/DashboardQueryRunner/testHelpers.ts +++ b/public/app/features/query/state/DashboardQueryRunner/testHelpers.ts @@ -1,11 +1,11 @@ import { asyncScheduler, Observable, of, scheduled } from 'rxjs'; -import { AnnotationEvent, getDefaultTimeRange } from '@grafana/data'; +import { AnnotationEvent, getDefaultTimeRange, PanelModel } from '@grafana/data'; import { DashboardQueryRunnerOptions } from './types'; // function that creates an async of result Observable -export function toAsyncOfResult(result: any): Observable { +export function toAsyncOfResult(result: T): Observable { return scheduled(of(result), asyncScheduler); } @@ -54,7 +54,7 @@ export function getDefaultOptions(): DashboardQueryRunnerOptions { subscribe: jest.fn().mockReturnValue({ unsubscribe: jest.fn() }), publish: jest.fn(), }, - panels: [{ alert: {} } as any], + panels: [{ alert: {} } as PanelModel], meta: {}, }; const range = getDefaultTimeRange(); diff --git a/public/app/features/search/page/components/columns.tsx b/public/app/features/search/page/components/columns.tsx index 7b1daf9357a..34625204aa1 100644 --- a/public/app/features/search/page/components/columns.tsx +++ b/public/app/features/search/page/components/columns.tsx @@ -43,7 +43,7 @@ export const generateColumns = ( const uidField = access.uid; const kindField = access.kind; let sortFieldWith = 0; - const sortField = (access as any)[response.view.dataFrame.meta?.custom?.sortBy] as Field; + const sortField: Field = access[response.view.dataFrame.meta?.custom?.sortBy]; if (sortField) { sortFieldWith = 175; if (sortField.type === FieldType.time) { diff --git a/public/app/features/serviceaccounts/state/reducers.ts b/public/app/features/serviceaccounts/state/reducers.ts index 8ff78f79ae4..0286d295cc9 100644 --- a/public/app/features/serviceaccounts/state/reducers.ts +++ b/public/app/features/serviceaccounts/state/reducers.ts @@ -13,7 +13,7 @@ import { export const initialStateProfile: ServiceAccountProfileState = { serviceAccount: {} as ServiceAccountDTO, isLoading: true, - tokens: [] as ApiKey[], + tokens: [], }; export const serviceAccountProfileSlice = createSlice({ @@ -41,7 +41,7 @@ export const { serviceAccountLoaded, serviceAccountTokensLoaded, serviceAccountF // serviceAccountsListPage export const initialStateList: ServiceAccountsState = { - serviceAccounts: [] as ServiceAccountDTO[], + serviceAccounts: [], isLoading: true, roleOptions: [], query: '', diff --git a/public/app/features/storage/StoragePage.tsx b/public/app/features/storage/StoragePage.tsx index f8b3b690a2f..dc7be8568f6 100644 --- a/public/app/features/storage/StoragePage.tsx +++ b/public/app/features/storage/StoragePage.tsx @@ -93,7 +93,7 @@ export default function StoragePage(props: Props) { if (listing.value) { const length = listing.value.length; if (length === 1) { - const first = listing.value.fields[0].values[0] as string; + const first: string = listing.value.fields[0].values[0]; isFolder = !path.endsWith(first); } else { // TODO: handle files/folders which do not exist diff --git a/public/app/features/storage/UploadButton.tsx b/public/app/features/storage/UploadButton.tsx index 984afcef183..e9115a1a376 100644 --- a/public/app/features/storage/UploadButton.tsx +++ b/public/app/features/storage/UploadButton.tsx @@ -5,7 +5,7 @@ import { GrafanaTheme2 } from '@grafana/data'; import { ConfirmModal, FileUpload, useStyles2 } from '@grafana/ui'; import { filenameAlreadyExists, getGrafanaStorage } from './storage'; -import { StorageView, UploadReponse } from './types'; +import { StorageView, UploadResponse } from './types'; interface Props { setErrorMessages: (errors: string[]) => void; @@ -28,7 +28,7 @@ export function UploadButton({ setErrorMessages, setPath, path, fileNames }: Pro setFileUploadKey((prev) => prev + 1); }, [file]); - const onUpload = (rsp: UploadReponse) => { + const onUpload = (rsp: UploadResponse) => { console.log('Uploaded: ' + path); if (rsp.path) { setPath(rsp.path); diff --git a/public/app/features/storage/storage.ts b/public/app/features/storage/storage.ts index d164577d4a8..41b0527d71f 100644 --- a/public/app/features/storage/storage.ts +++ b/public/app/features/storage/storage.ts @@ -2,13 +2,13 @@ import { DataFrame, dataFrameFromJSON, DataFrameJSON, getDisplayProcessor } from import { config, getBackendSrv } from '@grafana/runtime'; import { backendSrv } from 'app/core/services/backend_srv'; -import { UploadReponse, StorageInfo, ItemOptions, WriteValueRequest, WriteValueResponse } from './types'; +import { UploadResponse, StorageInfo, ItemOptions, WriteValueRequest, WriteValueResponse } from './types'; // Likely should be built into the search interface! export interface GrafanaStorage { get: (path: string) => Promise; list: (path: string) => Promise; - upload: (folder: string, file: File, overwriteExistingFile: boolean) => Promise; + upload: (folder: string, file: File, overwriteExistingFile: boolean) => Promise; createFolder: (path: string) => Promise<{ error?: string }>; delete: (path: { isFolder: boolean; path: string }) => Promise<{ error?: string }>; @@ -92,7 +92,7 @@ class SimpleStorage implements GrafanaStorage { return req.isFolder ? this.deleteFolder({ path: req.path, force: true }) : this.deleteFile({ path: req.path }); } - async upload(folder: string, file: File, overwriteExistingFile: boolean): Promise { + async upload(folder: string, file: File, overwriteExistingFile: boolean): Promise { const formData = new FormData(); formData.append('folder', folder); formData.append('file', file); @@ -102,7 +102,7 @@ class SimpleStorage implements GrafanaStorage { body: formData, }); - let body = (await res.json()) as UploadReponse; + let body: UploadResponse = await res.json(); if (!body) { body = {} as any; } diff --git a/public/app/features/storage/types.ts b/public/app/features/storage/types.ts index 4b42f5679a9..21f24bb126f 100644 --- a/public/app/features/storage/types.ts +++ b/public/app/features/storage/types.ts @@ -8,7 +8,7 @@ export enum StorageView { AddRoot = 'add', } -export interface UploadReponse { +export interface UploadResponse { status: number; statusText: string; diff --git a/public/app/features/teams/TeamPages.tsx b/public/app/features/teams/TeamPages.tsx index 6c0968237c6..707a511f499 100644 --- a/public/app/features/teams/TeamPages.tsx +++ b/public/app/features/teams/TeamPages.tsx @@ -50,7 +50,7 @@ function mapStateToProps(state: StoreState, props: OwnProps) { } } const pageName = props.match.params.page ?? defaultPage; - const teamLoadingNav = getTeamLoadingNav(pageName as string); + const teamLoadingNav = getTeamLoadingNav(pageName); const pageNav = getNavModel(state.navIndex, `team-${pageName}-${teamId}`, teamLoadingNav).main; const members = getTeamMembers(state.team); diff --git a/public/app/features/teams/state/reducers.ts b/public/app/features/teams/state/reducers.ts index 58d6f45fe5c..6cc15758e02 100644 --- a/public/app/features/teams/state/reducers.ts +++ b/public/app/features/teams/state/reducers.ts @@ -44,8 +44,8 @@ export const teamsReducer = teamsSlice.reducer; export const initialTeamState: TeamState = { team: {} as Team, - members: [] as TeamMember[], - groups: [] as TeamGroup[], + members: [], + groups: [], searchMemberQuery: '', }; diff --git a/public/app/features/transformers/extractFields/ExtractFieldsTransformerEditor.tsx b/public/app/features/transformers/extractFields/ExtractFieldsTransformerEditor.tsx index 1ce5fdc7408..594f0a49213 100644 --- a/public/app/features/transformers/extractFields/ExtractFieldsTransformerEditor.tsx +++ b/public/app/features/transformers/extractFields/ExtractFieldsTransformerEditor.tsx @@ -81,7 +81,7 @@ export const extractFieldsTransformerEditor = ({ context={{ data: input }} value={options.source ?? ''} onChange={onPickSourceField} - item={fieldNamePickerSettings as any} + item={fieldNamePickerSettings} /> diff --git a/public/app/features/variables/adhoc/urlParser.ts b/public/app/features/variables/adhoc/urlParser.ts index 11ed37103f2..bd8118954ff 100644 --- a/public/app/features/variables/adhoc/urlParser.ts +++ b/public/app/features/variables/adhoc/urlParser.ts @@ -9,7 +9,7 @@ export const toUrl = (filters: AdHocVariableFilter[]): string[] => { export const toFilters = (value: UrlQueryValue): AdHocVariableFilter[] => { if (isArray(value)) { - const values = value as any[]; + const values = value; return values.map(toFilter).filter(isFilter); } diff --git a/public/app/features/variables/getAllVariableValuesForUrl.ts b/public/app/features/variables/getAllVariableValuesForUrl.ts index 276f5139c33..6ec16e50743 100644 --- a/public/app/features/variables/getAllVariableValuesForUrl.ts +++ b/public/app/features/variables/getAllVariableValuesForUrl.ts @@ -19,7 +19,7 @@ export function getVariablesUrlParams(scopedVars?: ScopedVars): UrlQueryMap { if (scopedVar) { params[VARIABLE_PREFIX + variable.name] = scopedVar.value; } else { - params[VARIABLE_PREFIX + variable.name] = variableAdapters.get(variable.type).getValueForUrl(variable as any); + params[VARIABLE_PREFIX + variable.name] = variableAdapters.get(variable.type).getValueForUrl(variable); } } diff --git a/public/app/features/variables/pickers/shared/VariableInput.tsx b/public/app/features/variables/pickers/shared/VariableInput.tsx index 5c586233ae7..78a4898ce17 100644 --- a/public/app/features/variables/pickers/shared/VariableInput.tsx +++ b/public/app/features/variables/pickers/shared/VariableInput.tsx @@ -14,7 +14,7 @@ export class VariableInput extends PureComponent { onKeyDown = (event: React.KeyboardEvent) => { if (NavigationKey[event.keyCode] && event.keyCode !== NavigationKey.select) { const clearOthers = event.ctrlKey || event.metaKey || event.shiftKey; - this.props.onNavigate(event.keyCode as NavigationKey, clearOthers); + this.props.onNavigate(event.keyCode, clearOthers); event.preventDefault(); } }; diff --git a/public/app/features/variables/shared/testing/helpers.ts b/public/app/features/variables/shared/testing/helpers.ts index 83e02bf29e2..8bbdf0e9da5 100644 --- a/public/app/features/variables/shared/testing/helpers.ts +++ b/public/app/features/variables/shared/testing/helpers.ts @@ -1,4 +1,4 @@ -import { DataSourceInstanceSettings, DataSourceJsonData, DataSourcePluginMeta } from '@grafana/data'; +import { DataSourceInstanceSettings, DataSourcePluginMeta } from '@grafana/data'; export function getDataSourceInstanceSetting(name: string, meta: DataSourcePluginMeta): DataSourceInstanceSettings { return { @@ -8,7 +8,7 @@ export function getDataSourceInstanceSetting(name: string, meta: DataSourcePlugi name, meta, access: 'proxy', - jsonData: {} as unknown as DataSourceJsonData, + jsonData: {}, readOnly: false, }; } diff --git a/public/app/plugins/datasource/azuremonitor/components/MonitorConfig.tsx b/public/app/plugins/datasource/azuremonitor/components/MonitorConfig.tsx index affa617f708..0fa85c18159 100644 --- a/public/app/plugins/datasource/azuremonitor/components/MonitorConfig.tsx +++ b/public/app/plugins/datasource/azuremonitor/components/MonitorConfig.tsx @@ -9,11 +9,11 @@ import { AzureDataSourceSettings, AzureCredentials } from '../types'; import { AzureCredentialsForm } from './AzureCredentialsForm'; import { DefaultSubscription } from './DefaultSubscription'; -const azureClouds = [ +const azureClouds: SelectableValue[] = [ { value: 'azuremonitor', label: 'Azure' }, { value: 'govazuremonitor', label: 'Azure US Government' }, { value: 'chinaazuremonitor', label: 'Azure China' }, -] as SelectableValue[]; +]; export interface Props { options: AzureDataSourceSettings; diff --git a/public/app/plugins/datasource/cloud-monitoring/CloudMonitoringMetricFindQuery.ts b/public/app/plugins/datasource/cloud-monitoring/CloudMonitoringMetricFindQuery.ts index ae6af29ba6a..1ae2c1096e4 100644 --- a/public/app/plugins/datasource/cloud-monitoring/CloudMonitoringMetricFindQuery.ts +++ b/public/app/plugins/datasource/cloud-monitoring/CloudMonitoringMetricFindQuery.ts @@ -11,7 +11,7 @@ import { getLabelKeys, getMetricTypesByService, } from './functions'; -import { MetricKind, ValueTypes, MetricFindQueryTypes } from './types/query'; +import { ValueTypes, MetricFindQueryTypes } from './types/query'; import { CloudMonitoringVariableQuery, MetricDescriptor } from './types/types'; export default class CloudMonitoringMetricFindQuery { @@ -152,7 +152,7 @@ export default class CloudMonitoringMetricFindQuery { return []; } - return getAggregationOptionsByMetric(descriptor.valueType as ValueTypes, descriptor.metricKind as MetricKind).map( + return getAggregationOptionsByMetric(descriptor.valueType as ValueTypes, descriptor.metricKind).map( this.toFindQueryResult ); } diff --git a/public/app/plugins/datasource/cloud-monitoring/components/Aggregation.tsx b/public/app/plugins/datasource/cloud-monitoring/components/Aggregation.tsx index 5dab6ca3175..69482738689 100644 --- a/public/app/plugins/datasource/cloud-monitoring/components/Aggregation.tsx +++ b/public/app/plugins/datasource/cloud-monitoring/components/Aggregation.tsx @@ -5,7 +5,7 @@ import { EditorField } from '@grafana/experimental'; import { Select } from '@grafana/ui'; import { getAggregationOptionsByMetric } from '../functions'; -import { MetricKind, ValueTypes } from '../types/query'; +import { ValueTypes } from '../types/query'; import { MetricDescriptor } from '../types/types'; export interface Props { @@ -55,7 +55,7 @@ const useAggregationOptionsByMetric = ({ metricDescriptor }: Props): Array ({ + return getAggregationOptionsByMetric(valueType as ValueTypes, metricKind).map((a) => ({ ...a, label: a.text, })); diff --git a/public/app/plugins/datasource/cloud-monitoring/datasource.ts b/public/app/plugins/datasource/cloud-monitoring/datasource.ts index 142f5dc268b..f3973a04626 100644 --- a/public/app/plugins/datasource/cloud-monitoring/datasource.ts +++ b/public/app/plugins/datasource/cloud-monitoring/datasource.ts @@ -184,9 +184,7 @@ export default class CloudMonitoringDatasource extends DataSourceWithBackend< return []; } - return this.getResource( - `metricDescriptors/v3/projects/${this.templateSrv.replace(projectName)}/metricDescriptors` - ) as Promise; + return this.getResource(`metricDescriptors/v3/projects/${this.templateSrv.replace(projectName)}/metricDescriptors`); } async filterMetricsByType(projectName: string, filter: string): Promise { diff --git a/public/app/plugins/datasource/elasticsearch/ElasticResponse.ts b/public/app/plugins/datasource/elasticsearch/ElasticResponse.ts index f76107b0376..797ec344ec8 100644 --- a/public/app/plugins/datasource/elasticsearch/ElasticResponse.ts +++ b/public/app/plugins/datasource/elasticsearch/ElasticResponse.ts @@ -124,7 +124,7 @@ export class ElasticResponse { }; for (let i = 0; i < esAgg.buckets.length; i++) { const bucket = esAgg.buckets[i]; - const stats = bucket[metric.id] as TopMetricBucket; + const stats: TopMetricBucket = bucket[metric.id]; const values = stats.top.map((hit) => { if (hit.metrics[metricField]) { return hit.metrics[metricField]; @@ -239,7 +239,7 @@ export class ElasticResponse { // If we selected more than one metric we also add each metric name const metricName = metric.settings.metrics.length > 1 ? `${baseName} ${metricField}` : baseName; - const stats = bucket[metric.id] as TopMetricBucket; + const stats: TopMetricBucket = bucket[metric.id]; // Size of top_metrics is fixed to 1. addMetricValue(values, metricName, stats.top[0].metrics[metricField]);