Chore: Type improvements 🧹 (#75271)

* fix some e2e flows types

* some type fixes

* must... fix... more...

* MOAR

* MOREMOREMORE

* 1 more
This commit is contained in:
Ashley Harrison 2023-09-22 15:06:49 +01:00 committed by GitHub
parent eba74f0408
commit ff0642bf6e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
65 changed files with 217 additions and 387 deletions

View File

@ -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"],

View File

@ -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<AddDashboardConfig>) => {
.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 }],
});
});

View File

@ -94,7 +94,7 @@ export const addDataSource = (config?: Partial<AddDataSourceConfig>) => {
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],
});

View File

@ -5,7 +5,7 @@ import { getScenarioContext } from '../support/scenarioContext';
import { configurePanel, PartialAddPanelConfig } from './configurePanel';
export const addPanel = (config?: Partial<PartialAddPanelConfig>) =>
getScenarioContext().then(({ lastAddedDataSource }: any) =>
getScenarioContext().then(({ lastAddedDataSource }) =>
configurePanel({
dataSourceName: lastAddedDataSource,
panelTitle: `e2e-${uuidv4()}`,

View File

@ -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<AddPanelConfig | EditPanelConfig | ConfigurePanelConfig>`
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';

View File

@ -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;

View File

@ -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;

View File

@ -15,9 +15,8 @@ interface OpenDashboardOptional {
export type PartialOpenDashboardConfig = Partial<OpenDashboardDefault> & OpenDashboardOptional;
export type OpenDashboardConfig = OpenDashboardDefault & OpenDashboardOptional;
// @todo this actually returns type `Cypress.Chainable<OpenDashboardConfig>`
export const openDashboard = (config?: PartialOpenDashboardConfig) =>
getScenarioContext().then(({ lastAddedDashboardUid }: any) => {
getScenarioContext().then(({ lastAddedDashboardUid }) => {
const fullConfig: OpenDashboardConfig = {
uid: lastAddedDashboardUid,
...config,

View File

@ -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();

View File

@ -2,13 +2,12 @@ import { e2e } from '../index';
export interface SelectOptionConfig {
clickToOpen?: boolean;
container: any;
container: Cypress.Chainable<JQuery<HTMLElement>>;
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,

View File

@ -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));

View File

@ -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<keyof typeof cfgA>;
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
let bKeys = Object.keys(cfgB) as Array<keyof typeof cfgB>;
if (aKeys.length !== bKeys.length) {

View File

@ -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,
};
}

View File

@ -123,20 +123,20 @@ class ScopedEventBus implements EventBus {
publish<T extends BusEvent>(event: T): void {
if (!event.origin) {
(event as any).origin = this;
event.origin = this;
}
this.eventBus.publish(event);
}
filter = (event: BusEvent) => {
filter<T extends BusEvent>(event: T) {
if (this.filterConfig.onlyLocal) {
return event.origin === this;
}
return true;
};
}
getStream<T extends BusEvent>(eventType: BusEventType<T>): Observable<T> {
return this.eventBus.getStream(eventType).pipe(filter(this.filter)) as Observable<T>;
return this.eventBus.getStream(eventType).pipe(filter(this.filter));
}
// syntax sugar

View File

@ -7,7 +7,7 @@ import { Unsubscribable, Observable } from 'rxjs';
export interface BusEvent {
readonly type: string;
readonly payload?: any;
readonly origin?: EventBus;
origin?: EventBus;
}
/**

View File

@ -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;
}

View File

@ -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<CalculateFieldTransformerOptions> = {
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);

View File

@ -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++) {

View File

@ -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<string> {}

View File

@ -66,7 +66,10 @@ export interface DataSourceWithQueryExportSupport<TQuery extends SchemaDataQuery
export const hasQueryImportSupport = <TQuery extends SchemaDataQuery>(
datasource: unknown
): datasource is DataSourceWithQueryImportSupport<TQuery> => {
return (datasource as DataSourceWithQueryImportSupport<TQuery>).importFromAbstractQueries !== undefined;
if (!datasource) {
return false;
}
return 'importFromAbstractQueries' in datasource;
};
/**
@ -75,5 +78,8 @@ export const hasQueryImportSupport = <TQuery extends SchemaDataQuery>(
export const hasQueryExportSupport = <TQuery extends SchemaDataQuery>(
datasource: unknown
): datasource is DataSourceWithQueryExportSupport<TQuery> => {
return (datasource as DataSourceWithQueryExportSupport<TQuery>).exportToAbstractQueries !== undefined;
if (!datasource) {
return false;
}
return 'exportToAbstractQueries' in datasource;
};

View File

@ -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<T = any> extends ReadWriteVector<T> {}
* @deprecated
*/
export function makeArrayIndexableVector<T extends Vector>(v: T): T {
return new Proxy(v, {
return new Proxy<T>(v, {
get(target: Vector, property: string, receiver: Vector) {
if (typeof property !== 'symbol') {
const idx = +property;
@ -116,7 +116,7 @@ export function makeArrayIndexableVector<T extends Vector>(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<T extends Vector>(v: T): T {
}
return Reflect.set(target, property, value, receiver);
},
}) as T;
});
}

View File

@ -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;

View File

@ -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);
}
}

View File

@ -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<T extends keyof HTMLElementTagNameMap>(
type: T,
className?: string,
content?: Element | string
) {
const el = document.createElement(type);
if (className) {
el.classList.add(cssClass(className));

View File

@ -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<HTMLDivElement>(`div.${cssClass('children')}`);
if (animated) {
let childrenRemoved = 0;

View File

@ -236,7 +236,7 @@ export function sharedSingleStatMigrationHandler(panel: PanelModel<SingleStatBas
}
}
return options as SingleStatBaseOptions;
return options;
}
export function moveThresholdsAndMappingsToField(old: any) {

View File

@ -19,7 +19,7 @@ export interface Props {
}
export function ExpandedRow({ tableStyles, nestedData, rowIndex, width, cellHeight }: Props) {
const frames = nestedData.values as DataFrame[][];
const frames: DataFrame[][] = nestedData.values;
const subTables: React.ReactNode[] = [];
const theme = useTheme2();
const styles = useStyles2(getStyles);
@ -72,7 +72,7 @@ const getStyles = (theme: GrafanaTheme2) => {
};
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) {

View File

@ -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

View File

@ -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,
})}
</>
);
};

View File

@ -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<string, any>): SelectableValue[] {
export function valuesToOptions(unique: Record<string, unknown>): SelectableValue[] {
return Object.keys(unique)
.reduce<SelectableValue[]>((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<any>, b: Row<any>, 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<any>, rowB: Row<any>, 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;

View File

@ -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(

View File

@ -85,7 +85,7 @@ export class RowRepeaterBehavior extends SceneObjectBase<RowRepeaterBehaviorStat
return;
}
const rowToRepeat = this.parent as SceneGridRow;
const rowToRepeat = this.parent;
const { values, texts } = getMultiVariableValues(variable);
const rows: SceneGridRow[] = [];
const rowContentHeight = getRowContentHeight(this.state.sources);

View File

@ -6,6 +6,8 @@ export function setupLoadDashboardMock(rsp: DeepPartial<DashboardDTO>) {
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

View File

@ -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) {

View File

@ -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);

View File

@ -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,

View File

@ -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 = {};

View File

@ -45,7 +45,7 @@ export class FrameVectorSource<T extends Geometry = Geometry> extends VectorSour
//eslint-disable-next-line
const field = info.field as unknown as Field<Point>;
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,

View File

@ -315,9 +315,7 @@ export class LiveDataStream<T = unknown> {
? 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,

View File

@ -14,7 +14,7 @@ export class CentrifugeServiceWorkerProxy implements CentrifugeSrv {
private centrifugeWorker;
constructor(deps: CentrifugeSrvDeps) {
this.centrifugeWorker = comlink.wrap<RemoteCentrifugeService>(createWorker() as comlink.Endpoint);
this.centrifugeWorker = comlink.wrap<RemoteCentrifugeService>(createWorker());
this.centrifugeWorker.initialize(deps, comlink.proxy(deps.dataStreamSubscriberReadiness));
}

View File

@ -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) ?? [];

View File

@ -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,
})),

View File

@ -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[]) {

View File

@ -53,7 +53,7 @@ function getPanelPlugin(meta: PanelPluginMeta): Promise<PanelPlugin> {
})
.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;

View File

@ -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) => {

View File

@ -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<any> {
export function toAsyncOfResult<T>(result: T): Observable<T> {
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();

View File

@ -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) {

View File

@ -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: '',

View File

@ -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

View File

@ -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);

View File

@ -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: <T = any>(path: string) => Promise<T>;
list: (path: string) => Promise<DataFrame | undefined>;
upload: (folder: string, file: File, overwriteExistingFile: boolean) => Promise<UploadReponse>;
upload: (folder: string, file: File, overwriteExistingFile: boolean) => Promise<UploadResponse>;
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<UploadReponse> {
async upload(folder: string, file: File, overwriteExistingFile: boolean): Promise<UploadResponse> {
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;
}

View File

@ -8,7 +8,7 @@ export enum StorageView {
AddRoot = 'add',
}
export interface UploadReponse {
export interface UploadResponse {
status: number;
statusText: string;

View File

@ -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);

View File

@ -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: '',
};

View File

@ -81,7 +81,7 @@ export const extractFieldsTransformerEditor = ({
context={{ data: input }}
value={options.source ?? ''}
onChange={onPickSourceField}
item={fieldNamePickerSettings as any}
item={fieldNamePickerSettings}
/>
</InlineField>
</InlineFieldRow>

View File

@ -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);
}

View File

@ -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);
}
}

View File

@ -14,7 +14,7 @@ export class VariableInput extends PureComponent<Props> {
onKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {
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();
}
};

View File

@ -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,
};
}

View File

@ -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;

View File

@ -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
);
}

View File

@ -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<Selec
return [];
}
return getAggregationOptionsByMetric(valueType as ValueTypes, metricKind as MetricKind).map((a) => ({
return getAggregationOptionsByMetric(valueType as ValueTypes, metricKind).map((a) => ({
...a,
label: a.text,
}));

View File

@ -184,9 +184,7 @@ export default class CloudMonitoringDatasource extends DataSourceWithBackend<
return [];
}
return this.getResource(
`metricDescriptors/v3/projects/${this.templateSrv.replace(projectName)}/metricDescriptors`
) as Promise<MetricDescriptor[]>;
return this.getResource(`metricDescriptors/v3/projects/${this.templateSrv.replace(projectName)}/metricDescriptors`);
}
async filterMetricsByType(projectName: string, filter: string): Promise<MetricDescriptor[]> {

View File

@ -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]);