Chore: type fixes (#77618)

* type fixes

* couple more

* just a couple more

* small fixes to prometheus typings

* improve some more datasource types
This commit is contained in:
Ashley Harrison
2023-11-06 11:28:44 +00:00
committed by GitHub
parent a1718aafce
commit d1e52d4788
31 changed files with 131 additions and 215 deletions

View File

@@ -5958,16 +5958,16 @@ exports[`better eslint`] = {
[0, 0, 0, "Unexpected any. Specify a different type.", "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.", "1"],
[0, 0, 0, "Unexpected any. Specify a different type.", "2"], [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.", "3"],
[0, 0, 0, "Do not use any type assertions.", "4"], [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.", "5"],
[0, 0, 0, "Unexpected any. Specify a different type.", "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.", "7"],
[0, 0, 0, "Unexpected any. Specify a different type.", "8"], [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.", "9"],
[0, 0, 0, "Unexpected any. Specify a different type.", "10"], [0, 0, 0, "Do not use any type assertions.", "10"],
[0, 0, 0, "Do not use any type assertions.", "11"], [0, 0, 0, "Do not use any type assertions.", "11"],
[0, 0, 0, "Do not use any type assertions.", "12"], [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.", "13"],
[0, 0, 0, "Unexpected any. Specify a different type.", "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.", "15"],
@@ -6009,15 +6009,7 @@ exports[`better eslint`] = {
[0, 0, 0, "Unexpected any. Specify a different type.", "51"], [0, 0, 0, "Unexpected any. Specify a different type.", "51"],
[0, 0, 0, "Unexpected any. Specify a different type.", "52"], [0, 0, 0, "Unexpected any. Specify a different type.", "52"],
[0, 0, 0, "Unexpected any. Specify a different type.", "53"], [0, 0, 0, "Unexpected any. Specify a different type.", "53"],
[0, 0, 0, "Unexpected any. Specify a different type.", "54"], [0, 0, 0, "Unexpected any. Specify a different type.", "54"]
[0, 0, 0, "Unexpected any. Specify a different type.", "55"],
[0, 0, 0, "Unexpected any. Specify a different type.", "56"],
[0, 0, 0, "Unexpected any. Specify a different type.", "57"],
[0, 0, 0, "Unexpected any. Specify a different type.", "58"],
[0, 0, 0, "Unexpected any. Specify a different type.", "59"],
[0, 0, 0, "Unexpected any. Specify a different type.", "60"],
[0, 0, 0, "Unexpected any. Specify a different type.", "61"],
[0, 0, 0, "Unexpected any. Specify a different type.", "62"]
], ],
"public/app/plugins/datasource/graphite/gfunc.ts:5381": [ "public/app/plugins/datasource/graphite/gfunc.ts:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "0"], [0, 0, 0, "Unexpected any. Specify a different type.", "0"],
@@ -6030,11 +6022,7 @@ exports[`better eslint`] = {
[0, 0, 0, "Unexpected any. Specify a different type.", "7"], [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.", "8"],
[0, 0, 0, "Unexpected any. Specify a different type.", "9"], [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.", "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.", "14"]
], ],
"public/app/plugins/datasource/graphite/graphite_query.ts:5381": [ "public/app/plugins/datasource/graphite/graphite_query.ts:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "0"], [0, 0, 0, "Unexpected any. Specify a different type.", "0"],
@@ -6052,15 +6040,11 @@ exports[`better eslint`] = {
[0, 0, 0, "Unexpected any. Specify a different type.", "12"], [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.", "13"],
[0, 0, 0, "Unexpected any. Specify a different type.", "14"], [0, 0, 0, "Unexpected any. Specify a different type.", "14"],
[0, 0, 0, "Unexpected any. Specify a different type.", "15"], [0, 0, 0, "Do not use any type assertions.", "15"],
[0, 0, 0, "Unexpected any. Specify a different type.", "16"], [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.", "17"],
[0, 0, 0, "Unexpected any. Specify a different type.", "18"], [0, 0, 0, "Unexpected any. Specify a different type.", "18"],
[0, 0, 0, "Do not use any type assertions.", "19"], [0, 0, 0, "Unexpected any. Specify a different type.", "19"]
[0, 0, 0, "Unexpected any. Specify a different type.", "20"],
[0, 0, 0, "Unexpected any. Specify a different type.", "21"],
[0, 0, 0, "Unexpected any. Specify a different type.", "22"],
[0, 0, 0, "Unexpected any. Specify a different type.", "23"]
], ],
"public/app/plugins/datasource/graphite/lexer.ts:5381": [ "public/app/plugins/datasource/graphite/lexer.ts:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "0"], [0, 0, 0, "Unexpected any. Specify a different type.", "0"],
@@ -6074,11 +6058,6 @@ exports[`better eslint`] = {
"public/app/plugins/datasource/graphite/migrations.ts:5381": [ "public/app/plugins/datasource/graphite/migrations.ts:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "0"] [0, 0, 0, "Unexpected any. Specify a different type.", "0"]
], ],
"public/app/plugins/datasource/graphite/parser.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"]
],
"public/app/plugins/datasource/graphite/specs/graphite_query.test.ts:5381": [ "public/app/plugins/datasource/graphite/specs/graphite_query.test.ts:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "0"] [0, 0, 0, "Unexpected any. Specify a different type.", "0"]
], ],
@@ -6095,17 +6074,14 @@ exports[`better eslint`] = {
], ],
"public/app/plugins/datasource/graphite/state/store.ts:5381": [ "public/app/plugins/datasource/graphite/state/store.ts:5381": [
[0, 0, 0, "Do not use any type assertions.", "0"], [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.", "1"]
[0, 0, 0, "Do not use any type assertions.", "2"],
[0, 0, 0, "Do not use any type assertions.", "3"]
], ],
"public/app/plugins/datasource/graphite/types.ts:5381": [ "public/app/plugins/datasource/graphite/types.ts:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "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.", "1"]
], ],
"public/app/plugins/datasource/graphite/utils.ts:5381": [ "public/app/plugins/datasource/graphite/utils.ts:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "0"], [0, 0, 0, "Unexpected any. Specify a different type.", "0"]
[0, 0, 0, "Unexpected any. Specify a different type.", "1"]
], ],
"public/app/plugins/datasource/influxdb/components/editor/config/ConfigEditor.tsx:5381": [ "public/app/plugins/datasource/influxdb/components/editor/config/ConfigEditor.tsx:5381": [
[0, 0, 0, "Do not use any type assertions.", "0"] [0, 0, 0, "Do not use any type assertions.", "0"]
@@ -6138,9 +6114,7 @@ exports[`better eslint`] = {
[0, 0, 0, "Unexpected any. Specify a different type.", "12"], [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.", "13"],
[0, 0, 0, "Unexpected any. Specify a different type.", "14"], [0, 0, 0, "Unexpected any. Specify a different type.", "14"],
[0, 0, 0, "Unexpected any. Specify a different type.", "15"], [0, 0, 0, "Do not use any type assertions.", "15"]
[0, 0, 0, "Unexpected any. Specify a different type.", "16"],
[0, 0, 0, "Do not use any type assertions.", "17"]
], ],
"public/app/plugins/datasource/influxdb/influx_query_model.ts:5381": [ "public/app/plugins/datasource/influxdb/influx_query_model.ts:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "0"], [0, 0, 0, "Unexpected any. Specify a different type.", "0"],
@@ -6155,14 +6129,7 @@ exports[`better eslint`] = {
[0, 0, 0, "Unexpected any. Specify a different type.", "9"], [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.", "10"],
[0, 0, 0, "Unexpected any. Specify a different type.", "11"], [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.", "12"]
[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"],
[0, 0, 0, "Unexpected any. Specify a different type.", "18"],
[0, 0, 0, "Unexpected any. Specify a different type.", "19"]
], ],
"public/app/plugins/datasource/influxdb/influx_series.ts:5381": [ "public/app/plugins/datasource/influxdb/influx_series.ts:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "0"], [0, 0, 0, "Unexpected any. Specify a different type.", "0"],
@@ -6210,8 +6177,7 @@ exports[`better eslint`] = {
[0, 0, 0, "Unexpected any. Specify a different type.", "12"], [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.", "13"],
[0, 0, 0, "Unexpected any. Specify a different type.", "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.", "15"]
[0, 0, 0, "Unexpected any. Specify a different type.", "16"]
], ],
"public/app/plugins/datasource/influxdb/response_parser.ts:5381": [ "public/app/plugins/datasource/influxdb/response_parser.ts:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "0"], [0, 0, 0, "Unexpected any. Specify a different type.", "0"],
@@ -6232,14 +6198,8 @@ exports[`better eslint`] = {
[0, 0, 0, "Styles should be written using objects.", "1"] [0, 0, 0, "Styles should be written using objects.", "1"]
], ],
"public/app/plugins/datasource/jaeger/datasource.ts:5381": [ "public/app/plugins/datasource/jaeger/datasource.ts:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "0"], [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.", "1"]
[0, 0, 0, "Do not use any type assertions.", "2"],
[0, 0, 0, "Unexpected any. Specify a different type.", "3"],
[0, 0, 0, "Unexpected any. Specify a different type.", "4"],
[0, 0, 0, "Unexpected any. Specify a different type.", "5"],
[0, 0, 0, "Unexpected any. Specify a different type.", "6"],
[0, 0, 0, "Unexpected any. Specify a different type.", "7"]
], ],
"public/app/plugins/datasource/jaeger/testResponse.ts:5381": [ "public/app/plugins/datasource/jaeger/testResponse.ts:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "0"], [0, 0, 0, "Unexpected any. Specify a different type.", "0"],
@@ -6248,13 +6208,9 @@ exports[`better eslint`] = {
"public/app/plugins/datasource/jaeger/types.ts:5381": [ "public/app/plugins/datasource/jaeger/types.ts:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "0"] [0, 0, 0, "Unexpected any. Specify a different type.", "0"]
], ],
"public/app/plugins/datasource/jaeger/util.ts:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
],
"public/app/plugins/datasource/loki/LanguageProvider.ts:5381": [ "public/app/plugins/datasource/loki/LanguageProvider.ts:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "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.", "1"]
[0, 0, 0, "Unexpected any. Specify a different type.", "2"]
], ],
"public/app/plugins/datasource/loki/LiveStreams.ts:5381": [ "public/app/plugins/datasource/loki/LiveStreams.ts:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "0"] [0, 0, 0, "Unexpected any. Specify a different type.", "0"]
@@ -6364,8 +6320,7 @@ exports[`better eslint`] = {
], ],
"public/app/plugins/datasource/loki/streaming.ts:5381": [ "public/app/plugins/datasource/loki/streaming.ts:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "0"], [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.", "1"]
[0, 0, 0, "Unexpected any. Specify a different type.", "2"]
], ],
"public/app/plugins/datasource/opentsdb/components/OpenTsdbQueryEditor.tsx:5381": [ "public/app/plugins/datasource/opentsdb/components/OpenTsdbQueryEditor.tsx:5381": [
[0, 0, 0, "Styles should be written using objects.", "0"], [0, 0, 0, "Styles should be written using objects.", "0"],
@@ -6458,8 +6413,7 @@ exports[`better eslint`] = {
[0, 0, 0, "Unexpected any. Specify a different type.", "0"] [0, 0, 0, "Unexpected any. Specify a different type.", "0"]
], ],
"public/app/plugins/datasource/prometheus/components/PromQueryField.tsx:5381": [ "public/app/plugins/datasource/prometheus/components/PromQueryField.tsx:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "0"], [0, 0, 0, "Unexpected any. Specify a different type.", "0"]
[0, 0, 0, "Unexpected any. Specify a different type.", "1"]
], ],
"public/app/plugins/datasource/prometheus/components/PrometheusMetricsBrowser.tsx:5381": [ "public/app/plugins/datasource/prometheus/components/PrometheusMetricsBrowser.tsx:5381": [
[0, 0, 0, "Styles should be written using objects.", "0"], [0, 0, 0, "Styles should be written using objects.", "0"],
@@ -6473,9 +6427,7 @@ exports[`better eslint`] = {
[0, 0, 0, "Styles should be written using objects.", "8"], [0, 0, 0, "Styles should be written using objects.", "8"],
[0, 0, 0, "Styles should be written using objects.", "9"], [0, 0, 0, "Styles should be written using objects.", "9"],
[0, 0, 0, "Styles should be written using objects.", "10"], [0, 0, 0, "Styles should be written using objects.", "10"],
[0, 0, 0, "Styles should be written using objects.", "11"], [0, 0, 0, "Styles should be written using objects.", "11"]
[0, 0, 0, "Do not use any type assertions.", "12"],
[0, 0, 0, "Do not use any type assertions.", "13"]
], ],
"public/app/plugins/datasource/prometheus/components/monaco-query-field/MonacoQueryField.tsx:5381": [ "public/app/plugins/datasource/prometheus/components/monaco-query-field/MonacoQueryField.tsx:5381": [
[0, 0, 0, "Styles should be written using objects.", "0"], [0, 0, 0, "Styles should be written using objects.", "0"],
@@ -6532,9 +6484,6 @@ exports[`better eslint`] = {
[0, 0, 0, "Use data-testid for E2E selectors instead of aria-label", "0"], [0, 0, 0, "Use data-testid for E2E selectors instead of aria-label", "0"],
[0, 0, 0, "Styles should be written using objects.", "1"] [0, 0, 0, "Styles should be written using objects.", "1"]
], ],
"public/app/plugins/datasource/prometheus/configuration/PromSettings.tsx:5381": [
[0, 0, 0, "Do not use any type assertions.", "0"]
],
"public/app/plugins/datasource/prometheus/datasource.test.ts:5381": [ "public/app/plugins/datasource/prometheus/datasource.test.ts:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "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.", "1"],
@@ -6561,7 +6510,7 @@ exports[`better eslint`] = {
[0, 0, 0, "Unexpected any. Specify a different type.", "8"], [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.", "9"],
[0, 0, 0, "Unexpected any. Specify a different type.", "10"], [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.", "11"],
[0, 0, 0, "Unexpected any. Specify a different type.", "12"], [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.", "13"],
[0, 0, 0, "Unexpected any. Specify a different type.", "14"], [0, 0, 0, "Unexpected any. Specify a different type.", "14"],
@@ -6569,16 +6518,7 @@ exports[`better eslint`] = {
[0, 0, 0, "Unexpected any. Specify a different type.", "16"], [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.", "17"],
[0, 0, 0, "Unexpected any. Specify a different type.", "18"], [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.", "19"]
[0, 0, 0, "Unexpected any. Specify a different type.", "20"],
[0, 0, 0, "Unexpected any. Specify a different type.", "21"],
[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"]
], ],
"public/app/plugins/datasource/prometheus/language_provider.ts:5381": [ "public/app/plugins/datasource/prometheus/language_provider.ts:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "0"], [0, 0, 0, "Unexpected any. Specify a different type.", "0"],
@@ -6855,17 +6795,13 @@ exports[`better eslint`] = {
[0, 0, 0, "Do not use any type assertions.", "3"], [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.", "4"],
[0, 0, 0, "Unexpected any. Specify a different type.", "5"], [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.", "6"],
[0, 0, 0, "Unexpected any. Specify a different type.", "7"], [0, 0, 0, "Do not use any type assertions.", "7"],
[0, 0, 0, "Unexpected any. Specify a different type.", "8"], [0, 0, 0, "Do not use any type assertions.", "8"],
[0, 0, 0, "Do not use any type assertions.", "9"], [0, 0, 0, "Do not use any type assertions.", "9"],
[0, 0, 0, "Do not use any type assertions.", "10"], [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.", "11"],
[0, 0, 0, "Do not use any type assertions.", "12"], [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.", "14"],
[0, 0, 0, "Unexpected any. Specify a different type.", "15"],
[0, 0, 0, "Unexpected any. Specify a different type.", "16"]
], ],
"public/app/plugins/datasource/tempo/language_provider.ts:5381": [ "public/app/plugins/datasource/tempo/language_provider.ts:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "0"] [0, 0, 0, "Unexpected any. Specify a different type.", "0"]
@@ -7111,9 +7047,6 @@ exports[`better eslint`] = {
[0, 0, 0, "Unexpected any. Specify a different type.", "0"], [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.", "1"]
], ],
"public/app/plugins/panel/geomap/utils/selection.ts:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
],
"public/app/plugins/panel/geomap/utils/tooltip.ts:5381": [ "public/app/plugins/panel/geomap/utils/tooltip.ts:5381": [
[0, 0, 0, "Do not use any type assertions.", "0"] [0, 0, 0, "Do not use any type assertions.", "0"]
], ],
@@ -7196,11 +7129,9 @@ exports[`better eslint`] = {
[0, 0, 0, "Do not use any type assertions.", "16"] [0, 0, 0, "Do not use any type assertions.", "16"]
], ],
"public/app/plugins/panel/histogram/Histogram.tsx:5381": [ "public/app/plugins/panel/histogram/Histogram.tsx:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "0"], [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.", "1"],
[0, 0, 0, "Do not use any type assertions.", "2"], [0, 0, 0, "Unexpected any. Specify a different type.", "2"]
[0, 0, 0, "Do not use any type assertions.", "3"],
[0, 0, 0, "Unexpected any. Specify a different type.", "4"]
], ],
"public/app/plugins/panel/live/LiveChannelEditor.tsx:5381": [ "public/app/plugins/panel/live/LiveChannelEditor.tsx:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "0"], [0, 0, 0, "Unexpected any. Specify a different type.", "0"],
@@ -7296,9 +7227,7 @@ exports[`better eslint`] = {
], ],
"public/app/plugins/panel/nodeGraph/utils.ts:5381": [ "public/app/plugins/panel/nodeGraph/utils.ts:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "0"], [0, 0, 0, "Unexpected any. Specify a different type.", "0"],
[0, 0, 0, "Unexpected any. Specify a different type.", "1"], [0, 0, 0, "Unexpected any. Specify a different type.", "1"]
[0, 0, 0, "Unexpected any. Specify a different type.", "2"],
[0, 0, 0, "Unexpected any. Specify a different type.", "3"]
], ],
"public/app/plugins/panel/piechart/PieChart.tsx:5381": [ "public/app/plugins/panel/piechart/PieChart.tsx:5381": [
[0, 0, 0, "Use data-testid for E2E selectors instead of aria-label", "0"], [0, 0, 0, "Use data-testid for E2E selectors instead of aria-label", "0"],
@@ -7644,20 +7573,10 @@ exports[`better eslint`] = {
[0, 0, 0, "Unexpected any. Specify a different type.", "0"], [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.", "1"]
], ],
"public/app/types/templates.ts:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
],
"public/app/types/unified-alerting-dto.ts:5381": [ "public/app/types/unified-alerting-dto.ts:5381": [
[0, 0, 0, "Do not use any type assertions.", "0"], [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.", "1"]
], ],
"public/test/core/redux/mocks.ts:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
],
"public/test/core/redux/reducerTester.ts:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
[0, 0, 0, "Unexpected any. Specify a different type.", "1"]
],
"public/test/core/redux/reduxTester.ts:5381": [ "public/test/core/redux/reduxTester.ts:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "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.", "1"],
@@ -7674,15 +7593,11 @@ exports[`better eslint`] = {
[0, 0, 0, "Unexpected any. Specify a different type.", "4"], [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.", "5"],
[0, 0, 0, "Unexpected any. Specify a different type.", "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.", "7"]
[0, 0, 0, "Unexpected any. Specify a different type.", "8"]
], ],
"public/test/global-jquery-shim.ts:5381": [ "public/test/global-jquery-shim.ts:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "0"] [0, 0, 0, "Unexpected any. Specify a different type.", "0"]
], ],
"public/test/helpers/convertToStoreState.ts:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
],
"public/test/helpers/getDashboardModel.ts:5381": [ "public/test/helpers/getDashboardModel.ts:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "0"] [0, 0, 0, "Unexpected any. Specify a different type.", "0"]
], ],
@@ -7695,20 +7610,11 @@ exports[`better eslint`] = {
"public/test/lib/common.ts:5381": [ "public/test/lib/common.ts:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "0"] [0, 0, 0, "Unexpected any. Specify a different type.", "0"]
], ],
"public/test/matchers/index.ts:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
],
"public/test/matchers/toEmitValuesWith.ts:5381": [ "public/test/matchers/toEmitValuesWith.ts:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "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.", "1"],
[0, 0, 0, "Unexpected any. Specify a different type.", "2"] [0, 0, 0, "Unexpected any. Specify a different type.", "2"]
], ],
"public/test/matchers/utils.ts:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
],
"public/test/mocks/workers.ts:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
],
"public/test/specs/helpers.ts:5381": [ "public/test/specs/helpers.ts:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "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.", "1"],
@@ -7723,9 +7629,7 @@ exports[`better eslint`] = {
[0, 0, 0, "Unexpected any. Specify a different type.", "10"], [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.", "11"],
[0, 0, 0, "Unexpected any. Specify a different type.", "12"], [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.", "13"]
[0, 0, 0, "Unexpected any. Specify a different type.", "14"],
[0, 0, 0, "Unexpected any. Specify a different type.", "15"]
] ]
}` }`
}; };

View File

@@ -28,7 +28,7 @@ import { getRollupNotice, getRuntimeConsolidationNotice } from 'app/plugins/data
import { AnnotationEditor } from './components/AnnotationsEditor'; import { AnnotationEditor } from './components/AnnotationsEditor';
import { convertToGraphiteQueryObject } from './components/helpers'; import { convertToGraphiteQueryObject } from './components/helpers';
import gfunc, { FuncDefs, FuncInstance } from './gfunc'; import gfunc, { FuncDef, FuncDefs, FuncInstance } from './gfunc';
import GraphiteQueryModel from './graphite_query'; import GraphiteQueryModel from './graphite_query';
import { prepareAnnotation } from './migrations'; import { prepareAnnotation } from './migrations';
// Types // Types
@@ -78,7 +78,7 @@ export class GraphiteDatasource
cacheTimeout: any; cacheTimeout: any;
withCredentials: boolean; withCredentials: boolean;
funcDefs: FuncDefs | null = null; funcDefs: FuncDefs | null = null;
funcDefsPromise: Promise<any> | null = null; funcDefsPromise: Promise<FuncDefs> | null = null;
_seriesRefLetters: string; _seriesRefLetters: string;
requestCounter = 100; requestCounter = 100;
private readonly metricMappings: GraphiteLokiMapping[]; private readonly metricMappings: GraphiteLokiMapping[];
@@ -371,7 +371,7 @@ export class GraphiteDatasource
return lastValueFrom( return lastValueFrom(
this.query(graphiteQuery).pipe( this.query(graphiteQuery).pipe(
map((result: any) => { map((result) => {
const list = []; const list = [];
for (let i = 0; i < result.data.length; i++) { for (let i = 0; i < result.data.length; i++) {
@@ -400,7 +400,7 @@ export class GraphiteDatasource
} else { } else {
// Graphite event/tag as annotation // Graphite event/tag as annotation
const tags = this.templateSrv.replace(target.tags?.join(' ')); const tags = this.templateSrv.replace(target.tags?.join(' '));
return this.events({ range: range, tags: tags }).then((results: any) => { return this.events({ range: range, tags: tags }).then((results) => {
const list = []; const list = [];
if (!isArray(results.data)) { if (!isArray(results.data)) {
console.error(`Unable to get annotations from ${results.url}.`); console.error(`Unable to get annotations from ${results.url}.`);
@@ -827,7 +827,7 @@ export class GraphiteDatasource
); );
} }
createFuncInstance(funcDef: any, options?: any): FuncInstance { createFuncInstance(funcDef: string | FuncDef, options?: any): FuncInstance {
return gfunc.createFuncInstance(funcDef, options, this.funcDefs); return gfunc.createFuncInstance(funcDef, options, this.funcDefs);
} }
@@ -870,7 +870,7 @@ export class GraphiteDatasource
this.funcDefs = gfunc.parseFuncDefs(fixedData); this.funcDefs = gfunc.parseFuncDefs(fixedData);
return this.funcDefs; return this.funcDefs;
}), }),
catchError((error: any) => { catchError((error) => {
console.error('Fetching graphite functions error', error); console.error('Fetching graphite functions error', error);
this.funcDefs = gfunc.getFuncDefs(this.graphiteVersion); this.funcDefs = gfunc.getFuncDefs(this.graphiteVersion);
return of(this.funcDefs); return of(this.funcDefs);
@@ -924,7 +924,7 @@ export class GraphiteDatasource
return getBackendSrv() return getBackendSrv()
.fetch(options) .fetch(options)
.pipe( .pipe(
catchError((err: any) => { catchError((err) => {
return throwError(reduceError(err)); return throwError(reduceError(err));
}) })
); );
@@ -941,7 +941,7 @@ export class GraphiteDatasource
options['format'] = 'json'; options['format'] = 'json';
function fixIntervalFormat(match: any) { function fixIntervalFormat(match: string) {
return match.replace('m', 'min').replace('M', 'mon'); return match.replace('m', 'min').replace('M', 'mon');
} }
@@ -1007,7 +1007,7 @@ function supportsFunctionIndex(version: string): boolean {
function mapToTags(): OperatorFunction<any, Array<{ text: string }>> { function mapToTags(): OperatorFunction<any, Array<{ text: string }>> {
return pipe( return pipe(
map((results: any) => { map((results) => {
if (results.data) { if (results.data) {
return _map(results.data, (value) => { return _map(results.data, (value) => {
return { text: value }; return { text: value };

View File

@@ -1061,7 +1061,7 @@ export class FuncInstance {
return str + parameters.join(', ') + ')'; return str + parameters.join(', ') + ')';
} }
_hasMultipleParamsInString(strValue: any, index: number) { _hasMultipleParamsInString(strValue: string, index: number) {
if (strValue.indexOf(',') === -1) { if (strValue.indexOf(',') === -1) {
return false; return false;
} }
@@ -1077,7 +1077,7 @@ export class FuncInstance {
return false; return false;
} }
updateParam(strValue: any, index: any) { updateParam(strValue: string, index: number) {
// handle optional parameters // handle optional parameters
// if string contains ',' and next param is optional, split and update both // if string contains ',' and next param is optional, split and update both
if (this._hasMultipleParamsInString(strValue, index)) { if (this._hasMultipleParamsInString(strValue, index)) {
@@ -1109,7 +1109,7 @@ export class FuncInstance {
} }
} }
function createFuncInstance(funcDef: any, options?: { withDefaultParams: any }, idx?: any): FuncInstance { function createFuncInstance(funcDef: FuncDef | string, options?: { withDefaultParams: any }, idx?: any): FuncInstance {
if (isString(funcDef)) { if (isString(funcDef)) {
funcDef = getFuncDef(funcDef, idx); funcDef = getFuncDef(funcDef, idx);
} }

View File

@@ -159,11 +159,11 @@ export default class GraphiteQuery {
this.segments.push({ value: 'select metric' }); this.segments.push({ value: 'select metric' });
} }
addFunction(newFunc: any) { addFunction(newFunc: FuncInstance) {
this.functions.push(newFunc); this.functions.push(newFunc);
} }
addFunctionParameter(func: any, value: string) { addFunctionParameter(func: FuncInstance, value: string) {
if (func.params.length >= func.def.params.length && !get(last(func.def.params), 'multiple', false)) { if (func.params.length >= func.def.params.length && !get(last(func.def.params), 'multiple', false)) {
throw { message: 'too many parameters for function ' + func.def.name }; throw { message: 'too many parameters for function ' + func.def.name };
} }
@@ -174,13 +174,13 @@ export default class GraphiteQuery {
this.functions = without(this.functions, func); this.functions = without(this.functions, func);
} }
moveFunction(func: any, offset: number) { moveFunction(func: FuncInstance, offset: number) {
const index = this.functions.indexOf(func); const index = this.functions.indexOf(func);
arrayMove(this.functions, index, index + offset); arrayMove(this.functions, index, index + offset);
} }
updateModelTarget(targets: any) { updateModelTarget(targets: any) {
const wrapFunction = (target: string, func: any) => { const wrapFunction = (target: string, func: FuncInstance) => {
return func.render(target, (value: string) => { return func.render(target, (value: string) => {
return this.templateSrv.replace(value, this.scopedVars); return this.templateSrv.replace(value, this.scopedVars);
}); });

View File

@@ -276,12 +276,12 @@ export class Parser {
return this.tokens[this.index - 1]; return this.tokens[this.index - 1];
} }
matchToken(type: any, index: number) { matchToken(type: string, index: number) {
const token = this.tokens[this.index + index]; const token = this.tokens[this.index + index];
return (token === undefined && type === '') || (token && token.type === type); return (token === undefined && type === '') || (token && token.type === type);
} }
match(token1: any, token2?: any) { match(token1: string, token2?: string) {
return this.matchToken(token1, 0) && (!token2 || this.matchToken(token2, 1)); return this.matchToken(token1, 0) && (!token2 || this.matchToken(token2, 1));
} }
} }

View File

@@ -8,7 +8,7 @@ import { TemplateSrv } from '../../../../features/templating/template_srv';
import { GraphiteDatasource } from '../datasource'; import { GraphiteDatasource } from '../datasource';
import { FuncDefs } from '../gfunc'; import { FuncDefs } from '../gfunc';
import GraphiteQuery, { GraphiteTarget } from '../graphite_query'; import GraphiteQuery, { GraphiteTarget } from '../graphite_query';
import { GraphiteSegment, GraphiteTagOperator } from '../types'; import { GraphiteSegment } from '../types';
import { actions } from './actions'; import { actions } from './actions';
import { import {
@@ -91,7 +91,7 @@ const reducer = async (action: Action, state: GraphiteQueryEditorState): Promise
fake: false, fake: false,
}; };
} else { } else {
segment = segmentOrString as GraphiteSegment; segment = segmentOrString;
} }
state.error = null; state.error = null;
@@ -131,7 +131,7 @@ const reducer = async (action: Action, state: GraphiteQueryEditorState): Promise
if (actions.addNewTag.match(action)) { if (actions.addNewTag.match(action)) {
const segment = action.payload.segment; const segment = action.payload.segment;
const newTagKey = segment.value; const newTagKey = segment.value;
const newTag = { key: newTagKey, operator: '=' as GraphiteTagOperator, value: '' }; const newTag = { key: newTagKey, operator: '=' as const, value: '' };
state.queryModel.addTag(newTag); state.queryModel.addTag(newTag);
handleTargetChanged(state); handleTargetChanged(state);
} }

View File

@@ -8,7 +8,7 @@ import { GraphiteParserError } from './types';
* This function removes all HTML tags and keeps only the last line from the stack * This function removes all HTML tags and keeps only the last line from the stack
* trace which should be the most meaningful. * trace which should be the most meaningful.
*/ */
export function reduceError(error: any): any { export function reduceError(error: any) {
if (error && error.status === 500 && error.data?.message?.startsWith('<body')) { if (error && error.status === 500 && error.data?.message?.startsWith('<body')) {
// Remove all HTML tags and take the last line from the stack trace // Remove all HTML tags and take the last line from the stack trace
const newMessage = last<string>( const newMessage = last<string>(

View File

@@ -590,7 +590,7 @@ export default class InfluxDatasource extends DataSourceWithBackend<InfluxQuery,
allQueries = this.templateSrv.replace(allQueries, scopedVars); allQueries = this.templateSrv.replace(allQueries, scopedVars);
return this._seriesQuery(allQueries, options).pipe( return this._seriesQuery(allQueries, options).pipe(
map((data: any) => { map((data) => {
if (!data || !data.results) { if (!data || !data.results) {
return { data: [] }; return { data: [] };
} }
@@ -690,7 +690,7 @@ export default class InfluxDatasource extends DataSourceWithBackend<InfluxQuery,
let query = annotation.query.replace('$timeFilter', timeFilter); let query = annotation.query.replace('$timeFilter', timeFilter);
query = this.templateSrv.replace(query, undefined, this.interpolateQueryExpr); query = this.templateSrv.replace(query, undefined, this.interpolateQueryExpr);
return lastValueFrom(this._seriesQuery(query, options)).then((data: any) => { return lastValueFrom(this._seriesQuery(query, options)).then((data) => {
if (!data || !data.results || !data.results[0]) { if (!data || !data.results || !data.results[0]) {
throw { message: 'No results in response from InfluxDB' }; throw { message: 'No results in response from InfluxDB' };
} }

View File

@@ -39,7 +39,7 @@ export default class InfluxQueryModel {
} }
updateProjection() { updateProjection() {
this.selectModels = map(this.target.select, (parts: any) => { this.selectModels = map(this.target.select, (parts) => {
return map(parts, queryPart.create); return map(parts, queryPart.create);
}); });
this.groupByParts = map(this.target.groupBy, queryPart.create); this.groupByParts = map(this.target.groupBy, queryPart.create);
@@ -47,18 +47,18 @@ export default class InfluxQueryModel {
updatePersistedParts() { updatePersistedParts() {
this.target.select = map(this.selectModels, (selectParts) => { this.target.select = map(this.selectModels, (selectParts) => {
return map(selectParts, (part: any) => { return map(selectParts, (part) => {
return { type: part.def.type, params: part.params }; return { type: part.def.type, params: part.params };
}); });
}); });
} }
hasGroupByTime() { hasGroupByTime() {
return find(this.target.groupBy, (g: any) => g.type === 'time'); return find(this.target.groupBy, (g) => g.type === 'time');
} }
hasFill() { hasFill() {
return find(this.target.groupBy, (g: any) => g.type === 'fill'); return find(this.target.groupBy, (g) => g.type === 'fill');
} }
addGroupBy(value: string) { addGroupBy(value: string) {
@@ -95,10 +95,10 @@ export default class InfluxQueryModel {
if (part.def.type === 'time') { if (part.def.type === 'time') {
// remove fill // remove fill
this.target.groupBy = filter(this.target.groupBy, (g: any) => g.type !== 'fill'); this.target.groupBy = filter(this.target.groupBy, (g) => g.type !== 'fill');
// remove aggregations // remove aggregations
this.target.select = map(this.target.select, (s: any) => { this.target.select = map(this.target.select, (s) => {
return filter(s, (part: any) => { return filter(s, (part) => {
const partModel = queryPart.create(part); const partModel = queryPart.create(part);
if (partModel.def.category === categories.Aggregations) { if (partModel.def.category === categories.Aggregations) {
return false; return false;

View File

@@ -140,7 +140,7 @@ function addAliasStrategy(selectParts: any[], partModel: any) {
function addFieldStrategy(selectParts: any, partModel: any, query: { selectModels: any[][] }) { function addFieldStrategy(selectParts: any, partModel: any, query: { selectModels: any[][] }) {
// copy all parts // copy all parts
const parts = map(selectParts, (part: any) => { const parts = map(selectParts, (part) => {
return createPart({ type: part.def.type, params: clone(part.params) }); return createPart({ type: part.def.type, params: clone(part.params) });
}); });

View File

@@ -47,7 +47,7 @@ export class JaegerDatasource extends DataSourceApi<JaegerQuery, JaegerJsonData>
this.traceIdTimeParams = instanceSettings.jsonData.traceIdTimeParams; this.traceIdTimeParams = instanceSettings.jsonData.traceIdTimeParams;
} }
async metadataRequest(url: string, params?: Record<string, any>): Promise<any> { async metadataRequest(url: string, params?: Record<string, unknown>) {
const res = await lastValueFrom(this._request(url, params, { hideFromInspector: true })); const res = await lastValueFrom(this._request(url, params, { hideFromInspector: true }));
return res.data.data; return res.data.data;
} }
@@ -180,11 +180,11 @@ export class JaegerDatasource extends DataSourceApi<JaegerQuery, JaegerJsonData>
}; };
} }
async testDatasource(): Promise<any> { async testDatasource() {
return lastValueFrom( return lastValueFrom(
this._request('/api/services').pipe( this._request('/api/services').pipe(
map((res) => { map((res) => {
const values: any[] = res?.data?.data || []; const values = res?.data?.data || [];
const testResult = const testResult =
values.length > 0 values.length > 0
? { status: 'success', message: 'Data source connected and services found.' } ? { status: 'success', message: 'Data source connected and services found.' }
@@ -195,7 +195,7 @@ export class JaegerDatasource extends DataSourceApi<JaegerQuery, JaegerJsonData>
}; };
return testResult; return testResult;
}), }),
catchError((err: any) => { catchError((err) => {
let message = 'Jaeger: '; let message = 'Jaeger: ';
if (err.statusText) { if (err.statusText) {
message += err.statusText; message += err.statusText;
@@ -230,7 +230,11 @@ export class JaegerDatasource extends DataSourceApi<JaegerQuery, JaegerJsonData>
return query.query || ''; return query.query || '';
} }
private _request(apiUrl: string, data?: any, options?: Partial<BackendSrvRequest>): Observable<Record<string, any>> { private _request(
apiUrl: string,
data?: Record<string, unknown>,
options?: Partial<BackendSrvRequest>
): Observable<Record<string, any>> {
const params = data ? serializeParams(data) : ''; const params = data ? serializeParams(data) : '';
const url = `${this.instanceSettings.url}${apiUrl}${params.length ? `?${params}` : ''}`; const url = `${this.instanceSettings.url}${apiUrl}${params.length ? `?${params}` : ''}`;
const req = { const req = {

View File

@@ -4,7 +4,7 @@ export function convertTagsLogfmt(tags: string | undefined) {
if (!tags) { if (!tags) {
return ''; return '';
} }
const data: any = logfmt.parse(tags); const data = logfmt.parse(tags);
Object.keys(data).forEach((key) => { Object.keys(data).forEach((key) => {
const value = data[key]; const value = data[key];
if (typeof value !== 'string') { if (typeof value !== 'string') {

View File

@@ -37,7 +37,7 @@ export default class LokiLanguageProvider extends LanguageProvider {
Object.assign(this, initialValues); Object.assign(this, initialValues);
} }
request = async (url: string, params?: any): Promise<any> => { request = async (url: string, params?: any) => {
try { try {
return await this.datasource.metadataRequest(url, params); return await this.datasource.metadataRequest(url, params);
} catch (error) { } catch (error) {

View File

@@ -45,7 +45,7 @@ export function doLokiChannelStream(
let frame: StreamingDataFrame | undefined = undefined; let frame: StreamingDataFrame | undefined = undefined;
const updateFrame = (msg: any) => { const updateFrame = (msg: any) => {
if (msg?.message) { if (msg?.message) {
const p = msg.message as DataFrameJSON; const p: DataFrameJSON = msg.message;
if (!frame) { if (!frame) {
frame = StreamingDataFrame.fromDataFrameJSON(p, { frame = StreamingDataFrame.fromDataFrameJSON(p, {
maxLength, maxLength,

View File

@@ -50,8 +50,8 @@ interface PromQueryFieldState {
class PromQueryField extends React.PureComponent<PromQueryFieldProps, PromQueryFieldState> { class PromQueryField extends React.PureComponent<PromQueryFieldProps, PromQueryFieldState> {
declare languageProviderInitializationPromise: CancelablePromise<any>; declare languageProviderInitializationPromise: CancelablePromise<any>;
constructor(props: PromQueryFieldProps, context: React.Context<any>) { constructor(props: PromQueryFieldProps) {
super(props, context); super(props);
this.state = { this.state = {
labelBrowserVisible: false, labelBrowserVisible: false,

View File

@@ -500,7 +500,7 @@ export class UnthemedPrometheusMetricsBrowser extends React.Component<BrowserPro
height={Math.min(450, metricCount * LIST_ITEM_SIZE)} height={Math.min(450, metricCount * LIST_ITEM_SIZE)}
itemCount={metricCount} itemCount={metricCount}
itemSize={LIST_ITEM_SIZE} itemSize={LIST_ITEM_SIZE}
itemKey={(i) => (metrics!.values as FacettableValue[])[i].name} itemKey={(i) => metrics!.values![i].name}
width={300} width={300}
className={styles.valueList} className={styles.valueList}
> >
@@ -589,7 +589,7 @@ export class UnthemedPrometheusMetricsBrowser extends React.Component<BrowserPro
height={Math.min(200, LIST_ITEM_SIZE * (label.values?.length || 0))} height={Math.min(200, LIST_ITEM_SIZE * (label.values?.length || 0))}
itemCount={label.values?.length || 0} itemCount={label.values?.length || 0}
itemSize={28} itemSize={28}
itemKey={(i) => (label.values as FacettableValue[])[i].name} itemKey={(i) => label.values![i].name}
width={200} width={200}
className={styles.valueList} className={styles.valueList}
> >

View File

@@ -549,11 +549,11 @@ export const getValueFromEventItem = (eventItem: SyntheticEvent<HTMLInputElement
return ''; return '';
} }
if (eventItem.hasOwnProperty('currentTarget')) { if ('currentTarget' in eventItem) {
return eventItem.currentTarget.value; return eventItem.currentTarget.value;
} }
return (eventItem as SelectableValue<string>).value; return eventItem.value;
}; };
const onChangeHandler = const onChangeHandler =

View File

@@ -227,7 +227,7 @@ export class PrometheusDatasource
* request. Any processing done here needs to be also copied on the backend as this goes through data source proxy * request. Any processing done here needs to be also copied on the backend as this goes through data source proxy
* but not through the same code as alerting. * but not through the same code as alerting.
*/ */
_request<T = any>( _request<T = unknown>(
url: string, url: string,
data: Record<string, string> | null, data: Record<string, string> | null,
overrides: Partial<BackendSrvRequest> = {} overrides: Partial<BackendSrvRequest> = {}
@@ -369,7 +369,7 @@ export class PrometheusDatasource
delete instantTarget.maxDataPoints; delete instantTarget.maxDataPoints;
// Create range target // Create range target
const rangeTarget: any = cloneDeep(target); const rangeTarget = cloneDeep(target);
rangeTarget.format = 'time_series'; rangeTarget.format = 'time_series';
rangeTarget.instant = false; rangeTarget.instant = false;
instantTarget.range = true; instantTarget.range = true;
@@ -398,7 +398,7 @@ export class PrometheusDatasource
); );
// If running only instant query in Explore, format as table // If running only instant query in Explore, format as table
} else if (target.instant && options.app === CoreApp.Explore) { } else if (target.instant && options.app === CoreApp.Explore) {
const instantTarget: any = cloneDeep(target); const instantTarget = cloneDeep(target);
instantTarget.format = 'table'; instantTarget.format = 'table';
queries.push(this.createQuery(instantTarget, options, start, end)); queries.push(this.createQuery(instantTarget, options, start, end));
activeTargets.push(instantTarget); activeTargets.push(instantTarget);
@@ -536,18 +536,19 @@ export class PrometheusDatasource
// (should hold until there is some streaming requests involved). // (should hold until there is some streaming requests involved).
tap(() => runningQueriesCount--), tap(() => runningQueriesCount--),
filter((response: any) => (response.cancelled ? false : true)), filter((response: any) => (response.cancelled ? false : true)),
map((response: any) => { map((response) => {
const data = transform(response, { const data = transform(response, {
query, query,
target, target,
responseListLength: queries.length, responseListLength: queries.length,
exemplarTraceIdDestinations: this.exemplarTraceIdDestinations, exemplarTraceIdDestinations: this.exemplarTraceIdDestinations,
}); });
return { const result: DataQueryResponse = {
data, data,
key: query.requestId, key: query.requestId,
state: runningQueriesCount === 0 ? LoadingState.Done : LoadingState.Loading, state: runningQueriesCount === 0 ? LoadingState.Done : LoadingState.Loading,
} as DataQueryResponse; };
return result;
}) })
); );
@@ -569,7 +570,7 @@ export class PrometheusDatasource
const filterAndMapResponse = pipe( const filterAndMapResponse = pipe(
filter((response: any) => (response.cancelled ? false : true)), filter((response: any) => (response.cancelled ? false : true)),
map((response: any) => { map((response) => {
const data = transform(response, { const data = transform(response, {
query, query,
target, target,
@@ -1174,11 +1175,7 @@ export class PrometheusDatasource
} }
// Used when running queries through backend // Used when running queries through backend
applyTemplateVariables( applyTemplateVariables(target: PromQuery, scopedVars: ScopedVars, filters?: AdHocVariableFilter[]) {
target: PromQuery,
scopedVars: ScopedVars,
filters?: AdHocVariableFilter[]
): Record<string, any> {
const variables = cloneDeep(scopedVars); const variables = cloneDeep(scopedVars);
// We want to interpolate these variables on backend // We want to interpolate these variables on backend
@@ -1302,10 +1299,10 @@ export function extractRuleMappingFromGroups(groups: any[]) {
// NOTE: these two functions are very similar to the escapeLabelValueIn* functions // NOTE: these two functions are very similar to the escapeLabelValueIn* functions
// in language_utils.ts, but they are not exactly the same algorithm, and we found // in language_utils.ts, but they are not exactly the same algorithm, and we found
// no way to reuse one in the another or vice versa. // no way to reuse one in the another or vice versa.
export function prometheusRegularEscape(value: any) { export function prometheusRegularEscape(value: unknown) {
return typeof value === 'string' ? value.replace(/\\/g, '\\\\').replace(/'/g, "\\\\'") : value; return typeof value === 'string' ? value.replace(/\\/g, '\\\\').replace(/'/g, "\\\\'") : value;
} }
export function prometheusSpecialRegexEscape(value: any) { export function prometheusSpecialRegexEscape(value: unknown) {
return typeof value === 'string' ? value.replace(/\\/g, '\\\\\\\\').replace(/[$^*{}\[\]\'+?.()|]/g, '\\\\$&') : value; return typeof value === 'string' ? value.replace(/\\/g, '\\\\\\\\').replace(/[$^*{}\[\]\'+?.()|]/g, '\\\\$&') : value;
} }

View File

@@ -18,6 +18,7 @@ import {
LoadingState, LoadingState,
rangeUtil, rangeUtil,
ScopedVars, ScopedVars,
TestDataSourceResponse,
} from '@grafana/data'; } from '@grafana/data';
import { import {
BackendSrvRequest, BackendSrvRequest,
@@ -496,7 +497,7 @@ export class TempoDatasource extends DataSourceWithBackend<TempoQuery, TempoJson
return merge(...subQueries); return merge(...subQueries);
} }
applyTemplateVariables(query: TempoQuery, scopedVars: ScopedVars): Record<string, any> { applyTemplateVariables(query: TempoQuery, scopedVars: ScopedVars) {
return this.applyVariables(query, scopedVars); return this.applyVariables(query, scopedVars);
} }
@@ -685,7 +686,11 @@ export class TempoDatasource extends DataSourceWithBackend<TempoQuery, TempoJson
return await lastValueFrom(this._request(url, params, { method: 'GET', hideFromInspector: true })); return await lastValueFrom(this._request(url, params, { method: 'GET', hideFromInspector: true }));
} }
private _request(apiUrl: string, data?: any, options?: Partial<BackendSrvRequest>): Observable<Record<string, any>> { private _request(
apiUrl: string,
data?: unknown,
options?: Partial<BackendSrvRequest>
): Observable<Record<string, any>> {
const params = data ? serializeParams(data) : ''; const params = data ? serializeParams(data) : '';
const url = `${this.instanceSettings.url}${apiUrl}${params.length ? `?${params}` : ''}`; const url = `${this.instanceSettings.url}${apiUrl}${params.length ? `?${params}` : ''}`;
const req = { ...options, url }; const req = { ...options, url };
@@ -693,7 +698,7 @@ export class TempoDatasource extends DataSourceWithBackend<TempoQuery, TempoJson
return getBackendSrv().fetch(req); return getBackendSrv().fetch(req);
} }
async testDatasource(): Promise<any> { async testDatasource(): Promise<TestDataSourceResponse> {
const options: BackendSrvRequest = { const options: BackendSrvRequest = {
headers: {}, headers: {},
method: 'GET', method: 'GET',
@@ -1297,7 +1302,7 @@ export function getRateAlignedValues(
return values; return values;
} }
export function makeServiceGraphViewRequest(metrics: any[]) { export function makeServiceGraphViewRequest(metrics: string[]): PromQuery[] {
return metrics.map((metric) => { return metrics.map((metric) => {
return { return {
refId: metric, refId: metric,

View File

@@ -1,6 +1,6 @@
import { SelectableValue } from '@grafana/data'; import { SelectableValue } from '@grafana/data';
export interface SelectionInfo<T = any> { export interface SelectionInfo<T> {
options: Array<SelectableValue<T>>; options: Array<SelectableValue<T>>;
current?: SelectableValue<T>; current?: SelectableValue<T>;
} }

View File

@@ -157,8 +157,8 @@ const prepConfig = (frame: DataFrame, theme: GrafanaTheme2) => {
incrs: isOrdinalX ? [1] : useLogScale ? undefined : histogramBucketSizes, incrs: isOrdinalX ? [1] : useLogScale ? undefined : histogramBucketSizes,
splits: useLogScale || isOrdinalX ? undefined : xSplits, splits: useLogScale || isOrdinalX ? undefined : xSplits,
values: isOrdinalX values: isOrdinalX
? (u: uPlot, splits: any[]) => splits ? (u, splits) => splits
: (u: uPlot, splits: any[]) => { : (u, splits) => {
const tickLabels = splits.map(xAxisFormatter); const tickLabels = splits.map(xAxisFormatter);
const maxWidth = tickLabels.reduce( const maxWidth = tickLabels.reduce(

View File

@@ -251,8 +251,8 @@ function computableField(field?: Field) {
* @param edgeFields * @param edgeFields
*/ */
function normalizeStatsForNodes(nodesMap: { [id: string]: NodeDatumFromEdge }, edgeFields: EdgeFields): NodeDatum[] { function normalizeStatsForNodes(nodesMap: { [id: string]: NodeDatumFromEdge }, edgeFields: EdgeFields): NodeDatum[] {
const secondaryStatValues: any[] = []; const secondaryStatValues: Array<number | undefined> = [];
const mainStatValues: any[] = []; const mainStatValues: Array<number | undefined> = [];
const secondaryStatField = computableField(edgeFields.secondaryStat) const secondaryStatField = computableField(edgeFields.secondaryStat)
? { ? {
...edgeFields.secondaryStat!, ...edgeFields.secondaryStat!,

View File

@@ -1,5 +1,5 @@
export interface Variable { export interface Variable {
name: string; name: string;
type: string; type: string;
current: any; current: unknown;
} }

View File

@@ -1,6 +1,6 @@
import { ActionCreatorWithoutPayload, PayloadActionCreator } from '@reduxjs/toolkit'; import { ActionCreatorWithoutPayload, PayloadActionCreator } from '@reduxjs/toolkit';
export const mockToolkitActionCreator = <T extends string>(creator: PayloadActionCreator<any, T>) => { export const mockToolkitActionCreator = <P = void, T extends string = string>(creator: PayloadActionCreator<P, T>) => {
return Object.assign(jest.fn(), creator); return Object.assign(jest.fn(), creator);
}; };

View File

@@ -2,7 +2,9 @@ import { AnyAction } from '@reduxjs/toolkit';
import { cloneDeep } from 'lodash'; import { cloneDeep } from 'lodash';
import { Action } from 'redux'; import { Action } from 'redux';
type GrafanaReducer<S = any, A extends Action = AnyAction> = (state: S, action: A) => S; import { StoreState } from 'app/types';
type GrafanaReducer<S = StoreState, A extends Action = AnyAction> = (state: S, action: A) => S;
export interface Given<State> { export interface Given<State> {
givenReducer: ( givenReducer: (
@@ -23,10 +25,6 @@ export interface Then<State> {
whenActionIsDispatched: (action: AnyAction) => Then<State>; whenActionIsDispatched: (action: AnyAction) => Then<State>;
} }
interface ObjectType extends Object {
[key: string]: any;
}
export const deepFreeze = <T>(obj: T): T => { export const deepFreeze = <T>(obj: T): T => {
Object.freeze(obj); Object.freeze(obj);
@@ -37,7 +35,7 @@ export const deepFreeze = <T>(obj: T): T => {
const hasOwnProp = Object.prototype.hasOwnProperty; const hasOwnProp = Object.prototype.hasOwnProperty;
if (obj && obj instanceof Object) { if (obj && obj instanceof Object) {
const object: ObjectType = obj; const object: Record<string, unknown> = obj;
Object.getOwnPropertyNames(object).forEach((propertyName) => { Object.getOwnPropertyNames(object).forEach((propertyName) => {
const objectProperty = object[propertyName]; const objectProperty = object[propertyName];
if ( if (

View File

@@ -1,4 +1,3 @@
// @ts-ignore
import { PayloadAction } from '@reduxjs/toolkit'; import { PayloadAction } from '@reduxjs/toolkit';
import configureMockStore from 'redux-mock-store'; import configureMockStore from 'redux-mock-store';
import thunk from 'redux-thunk'; import thunk from 'redux-thunk';
@@ -13,7 +12,7 @@ export interface ThunkWhen {
whenThunkIsDispatched: (...args: any) => Promise<Array<PayloadAction<any>>>; whenThunkIsDispatched: (...args: any) => Promise<Array<PayloadAction<any>>>;
} }
export const thunkTester = (initialState: any, debug?: boolean): ThunkGiven => { export const thunkTester = (initialState: unknown, debug?: boolean): ThunkGiven => {
const store = mockStore(initialState); const store = mockStore(initialState);
let thunkUnderTest: any = null; let thunkUnderTest: any = null;
let dispatchedActions: Array<PayloadAction<any>> = []; let dispatchedActions: Array<PayloadAction<any>> = [];

View File

@@ -1,8 +1,11 @@
import { TypedVariableModel } from '@grafana/data';
import { getPreloadedState } from '../../app/features/variables/state/helpers'; import { getPreloadedState } from '../../app/features/variables/state/helpers';
import { VariablesState } from '../../app/features/variables/state/types';
import { StoreState } from '../../app/types'; import { StoreState } from '../../app/types';
export const convertToStoreState = (key: string, models: any[]): StoreState => { export const convertToStoreState = (key: string, models: TypedVariableModel[]): StoreState => {
const variables = models.reduce((byName, variable) => { const variables = models.reduce<VariablesState>((byName, variable) => {
byName[variable.name] = variable; byName[variable.name] = variable;
return byName; return byName;
}, {}); }, {});

View File

@@ -4,7 +4,7 @@ import { toEmitValues } from './toEmitValues';
import { toEmitValuesWith } from './toEmitValuesWith'; import { toEmitValuesWith } from './toEmitValuesWith';
import { ObservableMatchers } from './types'; import { ObservableMatchers } from './types';
export const matchers: ObservableMatchers<void, Observable<any>> = { export const matchers: ObservableMatchers<void, Observable<unknown>> = {
toEmitValues, toEmitValues,
toEmitValuesWith, toEmitValuesWith,
}; };

View File

@@ -3,7 +3,10 @@ import { asapScheduler, Subscription, timer, isObservable } from 'rxjs';
import { OBSERVABLE_TEST_TIMEOUT_IN_MS } from './types'; import { OBSERVABLE_TEST_TIMEOUT_IN_MS } from './types';
export function forceObservableCompletion(subscription: Subscription, resolve: (args: any) => void) { export function forceObservableCompletion(
subscription: Subscription,
resolve: (args: jest.CustomMatcherResult | PromiseLike<jest.CustomMatcherResult>) => void
) {
const timeoutObservable = timer(OBSERVABLE_TEST_TIMEOUT_IN_MS, asapScheduler); const timeoutObservable = timer(OBSERVABLE_TEST_TIMEOUT_IN_MS, asapScheduler);
subscription.add( subscription.add(

View File

@@ -1,9 +1,12 @@
import { Config } from 'app/plugins/panel/nodeGraph/layout';
import { EdgeDatum, NodeDatum } from 'app/plugins/panel/nodeGraph/types';
const { layout } = jest.requireActual('../../app/plugins/panel/nodeGraph/layout.worker.js'); const { layout } = jest.requireActual('../../app/plugins/panel/nodeGraph/layout.worker.js');
class LayoutMockWorker { class LayoutMockWorker {
timeout: number | undefined; timeout: number | undefined;
constructor() {} constructor() {}
postMessage(data: any) { postMessage(data: { nodes: NodeDatum[]; edges: EdgeDatum[]; config: Config }) {
const { nodes, edges, config } = data; const { nodes, edges, config } = data;
this.timeout = window.setTimeout(() => { this.timeout = window.setTimeout(() => {
this.timeout = undefined; this.timeout = undefined;

View File

@@ -129,7 +129,7 @@ export class TimeSrvStub {
}; };
} }
setTime(time: any) { setTime(time: RawTimeRange) {
this.time = time; this.time = time;
} }
} }
@@ -161,7 +161,7 @@ export function TemplateSrvStub(this: any) {
return template(text, this.templateSettings)(this.data); return template(text, this.templateSettings)(this.data);
}; };
this.init = () => {}; this.init = () => {};
this.getAdhocFilters = (): any => { this.getAdhocFilters = () => {
return []; return [];
}; };
this.fillVariableValuesForUrl = () => {}; this.fillVariableValuesForUrl = () => {};