Chore: Improve types (#85659)

* fixing some types

* more type fixes

* few more

* last couple

* tiny tweak
This commit is contained in:
Ashley Harrison 2024-04-08 09:56:21 +01:00 committed by GitHub
parent 46ee87a0fc
commit b3cff22db3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
49 changed files with 152 additions and 283 deletions

View File

@ -1,5 +1,5 @@
// BETTERER RESULTS V2.
//
//
// If this file contains merge conflicts, use `betterer merge` to automatically resolve them:
// https://phenomnomnominal.github.io/betterer/docs/results-file/#merge
//
@ -569,11 +569,7 @@ exports[`better eslint`] = {
[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.", "8"]
],
"packages/grafana-prometheus/src/gcopypaste/app/features/live/data/amendTimeSeries.ts:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
@ -599,24 +595,10 @@ exports[`better eslint`] = {
"packages/grafana-prometheus/src/language_provider.ts:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
[0, 0, 0, "Unexpected any. Specify a different type.", "1"],
[0, 0, 0, "Unexpected any. Specify a different type.", "2"],
[0, 0, 0, "Unexpected any. Specify a different type.", "3"],
[0, 0, 0, "Unexpected any. Specify a different type.", "4"]
[0, 0, 0, "Unexpected any. Specify a different type.", "2"]
],
"packages/grafana-prometheus/src/language_utils.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"]
],
"packages/grafana-prometheus/src/metric_find_query.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"]
],
"packages/grafana-prometheus/src/query_hints.ts:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
[0, 0, 0, "Do not use any type assertions.", "0"]
],
"packages/grafana-prometheus/src/querybuilder/QueryPattern.tsx:5381": [
[0, 0, 0, "Styles should be written using objects.", "0"],
@ -628,9 +610,6 @@ exports[`better eslint`] = {
[0, 0, 0, "Styles should be written using objects.", "0"],
[0, 0, 0, "Styles should be written using objects.", "1"]
],
"packages/grafana-prometheus/src/querybuilder/binaryScalarOperations.ts:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
],
"packages/grafana-prometheus/src/querybuilder/components/LabelFilterItem.tsx:5381": [
[0, 0, 0, "Do not use any type assertions.", "0"],
[0, 0, 0, "Do not use any type assertions.", "1"],
@ -645,18 +624,15 @@ exports[`better eslint`] = {
],
"packages/grafana-prometheus/src/querybuilder/components/MetricSelect.tsx:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
[0, 0, 0, "Unexpected any. Specify a different type.", "1"],
[0, 0, 0, "Unexpected any. Specify a different type.", "2"],
[0, 0, 0, "Unexpected any. Specify a different type.", "3"],
[0, 0, 0, "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.", "7"],
[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.", "10"],
[0, 0, 0, "Styles should be written using objects.", "11"],
[0, 0, 0, "Styles should be written using objects.", "12"]
[0, 0, 0, "Styles should be written using objects.", "9"]
],
"packages/grafana-prometheus/src/querybuilder/components/PromQueryBuilder.tsx:5381": [
[0, 0, 0, "Do not use any type assertions.", "0"]
@ -839,13 +815,7 @@ exports[`better eslint`] = {
],
"packages/grafana-ui/src/components/DataSourceSettings/types.ts:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
[0, 0, 0, "Unexpected any. Specify a different type.", "1"],
[0, 0, 0, "Unexpected any. Specify a different type.", "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.", "1"]
],
"packages/grafana-ui/src/components/Dropdown/Dropdown.story.tsx:5381": [
[0, 0, 0, "\'VerticalGroup\' import from \'../Layout/Layout\' is restricted from being used by a pattern. Use Stack component instead.", "0"]
@ -4746,10 +4716,6 @@ exports[`better eslint`] = {
[0, 0, 0, "Unexpected any. Specify a different type.", "1"],
[0, 0, 0, "Unexpected any. Specify a different type.", "2"]
],
"public/app/plugins/datasource/cloudwatch/memoizedDebounce.ts:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
[0, 0, 0, "Unexpected any. Specify a different type.", "1"]
],
"public/app/plugins/datasource/cloudwatch/types.ts:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
[0, 0, 0, "Unexpected any. Specify a different type.", "1"],
@ -4779,17 +4745,17 @@ exports[`better eslint`] = {
[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, "Do not use any type assertions.", "8"],
[0, 0, 0, "Unexpected any. Specify a different type.", "9"],
[0, 0, 0, "Do not use any type assertions.", "10"],
[0, 0, 0, "Unexpected any. Specify a different type.", "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"],
[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.", "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.", "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.", "21"],
@ -4802,9 +4768,7 @@ exports[`better eslint`] = {
[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"],
[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.", "31"]
],
"public/app/plugins/datasource/elasticsearch/LanguageProvider.ts:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
@ -4814,9 +4778,8 @@ exports[`better eslint`] = {
],
"public/app/plugins/datasource/elasticsearch/LegacyQueryRunner.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.", "1"],
[0, 0, 0, "Unexpected any. Specify a different type.", "2"]
],
"public/app/plugins/datasource/elasticsearch/QueryBuilder.ts:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
@ -4967,8 +4930,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, "Do not use any type assertions.", "3"],
[0, 0, 0, "Styles should be written using objects.", "4"]
[0, 0, 0, "Styles should be written using objects.", "3"]
],
"public/app/plugins/datasource/grafana/components/TimePickerInput.tsx:5381": [
[0, 0, 0, "Styles should be written using objects.", "0"],
@ -4982,16 +4944,15 @@ exports[`better eslint`] = {
[0, 0, 0, "Styles should be written using objects.", "2"]
],
"public/app/plugins/datasource/grafana/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, "Do not use any type assertions.", "1"],
[0, 0, 0, "Do not use any type assertions.", "2"],
[0, 0, 0, "Do not use any type assertions.", "3"],
[0, 0, 0, "Unexpected any. Specify a different type.", "4"],
[0, 0, 0, "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, "Do not use any type assertions.", "6"],
[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.", "9"]
[0, 0, 0, "Unexpected any. Specify a different type.", "7"],
[0, 0, 0, "Do not use any type assertions.", "8"]
],
"public/app/plugins/datasource/graphite/components/AddGraphiteFunction.tsx:5381": [
[0, 0, 0, "Styles should be written using objects.", "0"]
@ -5085,9 +5046,7 @@ exports[`better eslint`] = {
[0, 0, 0, "Unexpected any. Specify a different type.", "49"],
[0, 0, 0, "Unexpected any. Specify a different type.", "50"],
[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.", "53"],
[0, 0, 0, "Unexpected any. Specify a different type.", "54"]
[0, 0, 0, "Unexpected any. Specify a different type.", "52"]
],
"public/app/plugins/datasource/graphite/gfunc.ts:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
@ -5147,9 +5106,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/graphite/state/helpers.ts:5381": [
[0, 0, 0, "Do not use any type assertions.", "0"]
],
"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.", "1"]
@ -5193,9 +5149,7 @@ exports[`better eslint`] = {
[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"],
[0, 0, 0, "Do not use any type assertions.", "15"]
[0, 0, 0, "Do not use any type assertions.", "13"]
],
"public/app/plugins/datasource/influxdb/influx_query_model.ts:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
@ -5209,8 +5163,7 @@ exports[`better eslint`] = {
[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.", "11"]
],
"public/app/plugins/datasource/influxdb/influx_series.ts:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
@ -5257,8 +5210,7 @@ exports[`better eslint`] = {
[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"],
[0, 0, 0, "Unexpected any. Specify a different type.", "15"]
[0, 0, 0, "Unexpected any. Specify a different type.", "14"]
],
"public/app/plugins/datasource/influxdb/response_parser.ts:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
@ -5288,22 +5240,10 @@ exports[`better eslint`] = {
[0, 0, 0, "Do not use any type assertions.", "0"],
[0, 0, 0, "Unexpected any. Specify a different type.", "1"]
],
"public/app/plugins/datasource/jaeger/helpers/createFetchResponse.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/jaeger/testResponse.ts:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
[0, 0, 0, "Unexpected any. Specify a different type.", "1"]
],
"public/app/plugins/datasource/jaeger/types.ts:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
],
"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.", "1"]
],
"public/app/plugins/datasource/loki/LiveStreams.ts:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
],
"public/app/plugins/datasource/loki/components/LokiContextUi.tsx:5381": [
@ -5362,16 +5302,7 @@ exports[`better eslint`] = {
"public/app/plugins/datasource/loki/datasource.ts:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
[0, 0, 0, "Unexpected any. Specify a different type.", "1"],
[0, 0, 0, "Unexpected any. Specify a different type.", "2"],
[0, 0, 0, "Unexpected any. Specify a different type.", "3"],
[0, 0, 0, "Unexpected any. Specify a different type.", "4"],
[0, 0, 0, "Unexpected any. Specify a different type.", "5"]
],
"public/app/plugins/datasource/loki/queryUtils.ts:5381": [
[0, 0, 0, "Do not use any type assertions.", "0"]
],
"public/app/plugins/datasource/loki/querybuilder/binaryScalarOperations.ts:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
[0, 0, 0, "Unexpected any. Specify a different type.", "2"]
],
"public/app/plugins/datasource/loki/querybuilder/components/LabelBrowserModal.tsx:5381": [
[0, 0, 0, "Styles should be written using objects.", "0"]
@ -5397,8 +5328,7 @@ exports[`better eslint`] = {
[0, 0, 0, "Styles should be written using objects.", "2"]
],
"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.", "1"]
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
],
"public/app/plugins/datasource/opentsdb/components/OpenTsdbQueryEditor.tsx:5381": [
[0, 0, 0, "Styles should be written using objects.", "0"],
@ -5449,23 +5379,10 @@ exports[`better eslint`] = {
[0, 0, 0, "Unexpected any. Specify a different type.", "38"],
[0, 0, 0, "Unexpected any. Specify a different type.", "39"],
[0, 0, 0, "Unexpected any. Specify a different type.", "40"],
[0, 0, 0, "Unexpected any. Specify a different type.", "41"],
[0, 0, 0, "Do not use any type assertions.", "41"],
[0, 0, 0, "Unexpected any. Specify a different type.", "42"],
[0, 0, 0, "Unexpected any. Specify a different type.", "43"],
[0, 0, 0, "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.", "48"],
[0, 0, 0, "Unexpected any. Specify a different type.", "49"],
[0, 0, 0, "Unexpected any. Specify a different type.", "50"],
[0, 0, 0, "Unexpected any. Specify a different type.", "51"],
[0, 0, 0, "Do not use any type assertions.", "52"],
[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.", "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.", "44"]
],
"public/app/plugins/datasource/opentsdb/migrations.ts:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
@ -5530,10 +5447,10 @@ exports[`better eslint`] = {
[0, 0, 0, "Unexpected any. Specify a different type.", "18"]
],
"public/app/plugins/datasource/prometheus/configuration/ConfigEditor.tsx:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
[0, 0, 0, "Unexpected any. Specify a different type.", "1"],
[0, 0, 0, "Unexpected any. Specify a different type.", "2"],
[0, 0, 0, "Unexpected any. Specify a different type.", "3"],
[0, 0, 0, "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"],
@ -5545,17 +5462,7 @@ exports[`better eslint`] = {
[0, 0, 0, "Styles should be written using objects.", "12"],
[0, 0, 0, "Styles should be written using objects.", "13"],
[0, 0, 0, "Styles should be written using objects.", "14"],
[0, 0, 0, "Styles should be written using objects.", "15"],
[0, 0, 0, "Styles should be written using objects.", "16"],
[0, 0, 0, "Styles should be written using objects.", "17"],
[0, 0, 0, "Styles should be written using objects.", "18"],
[0, 0, 0, "Styles should be written using objects.", "19"]
],
"public/app/plugins/datasource/prometheus/configuration/ConfigEditorPackage.tsx:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
[0, 0, 0, "Unexpected any. Specify a different type.", "1"],
[0, 0, 0, "Unexpected any. Specify a different type.", "2"],
[0, 0, 0, "Unexpected any. Specify a different type.", "3"]
[0, 0, 0, "Styles should be written using objects.", "15"]
],
"public/app/plugins/datasource/prometheus/configuration/ExemplarsSettings.tsx:5381": [
[0, 0, 0, "Styles should be written using objects.", "0"]
@ -5569,33 +5476,15 @@ exports[`better eslint`] = {
[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.", "8"]
],
"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.", "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.", "2"]
],
"public/app/plugins/datasource/prometheus/language_utils.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"]
],
"public/app/plugins/datasource/prometheus/metric_find_query.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"]
],
"public/app/plugins/datasource/prometheus/query_hints.ts:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
[0, 0, 0, "Do not use any type assertions.", "0"]
],
"public/app/plugins/datasource/prometheus/querybuilder/QueryPattern.tsx:5381": [
[0, 0, 0, "Styles should be written using objects.", "0"],
@ -5624,18 +5513,15 @@ exports[`better eslint`] = {
],
"public/app/plugins/datasource/prometheus/querybuilder/components/MetricSelect.tsx:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
[0, 0, 0, "Unexpected any. Specify a different type.", "1"],
[0, 0, 0, "Unexpected any. Specify a different type.", "2"],
[0, 0, 0, "Unexpected any. Specify a different type.", "3"],
[0, 0, 0, "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.", "7"],
[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.", "10"],
[0, 0, 0, "Styles should be written using objects.", "11"],
[0, 0, 0, "Styles should be written using objects.", "12"]
[0, 0, 0, "Styles should be written using objects.", "9"]
],
"public/app/plugins/datasource/prometheus/querybuilder/components/PromQueryBuilder.tsx:5381": [
[0, 0, 0, "Do not use any type assertions.", "0"]
@ -5751,10 +5637,6 @@ exports[`better eslint`] = {
[0, 0, 0, "Unexpected any. Specify a different type.", "1"],
[0, 0, 0, "Unexpected any. Specify a different type.", "2"]
],
"public/app/plugins/datasource/tempo/_importedDependencies/test/helpers/createFetchResponse.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/tempo/configuration/TraceQLSearchSettings.tsx:5381": [
[0, 0, 0, "Do not use any type assertions.", "0"]
],
@ -5790,10 +5672,6 @@ exports[`better eslint`] = {
[0, 0, 0, "Do not use any type assertions.", "0"],
[0, 0, 0, "Unexpected any. Specify a different type.", "1"]
],
"public/app/plugins/datasource/zipkin/utils/testResponse.ts:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
[0, 0, 0, "Unexpected any. Specify a different type.", "1"]
],
"public/app/plugins/datasource/zipkin/utils/transforms.ts:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
],
@ -5865,8 +5743,7 @@ exports[`better eslint`] = {
],
"public/app/plugins/panel/canvas/editor/element/PlacementEditor.tsx:5381": [
[0, 0, 0, "\'HorizontalGroup\' import from \'@grafana/ui\' is restricted from being used by a pattern. Use Stack component instead.", "0"],
[0, 0, 0, "\'VerticalGroup\' import from \'@grafana/ui\' is restricted from being used by a pattern. Use Stack component instead.", "1"],
[0, 0, 0, "Unexpected any. Specify a different type.", "2"]
[0, 0, 0, "\'VerticalGroup\' import from \'@grafana/ui\' is restricted from being used by a pattern. Use Stack component instead.", "1"]
],
"public/app/plugins/panel/canvas/editor/element/elementEditor.tsx:5381": [
[0, 0, 0, "Do not use any type assertions.", "0"],
@ -5874,13 +5751,11 @@ exports[`better eslint`] = {
],
"public/app/plugins/panel/canvas/editor/inline/InlineEditBody.tsx:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
[0, 0, 0, "Unexpected any. Specify a different type.", "1"],
[0, 0, 0, "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.", "1"],
[0, 0, 0, "Unexpected any. Specify a different type.", "2"]
],
"public/app/plugins/panel/canvas/editor/layer/TreeNavigationEditor.tsx:5381": [
[0, 0, 0, "\'HorizontalGroup\' import from \'@grafana/ui\' is restricted from being used by a pattern. Use Stack component instead.", "0"],
[0, 0, 0, "Unexpected any. Specify a different type.", "1"]
[0, 0, 0, "\'HorizontalGroup\' import from \'@grafana/ui\' is restricted from being used by a pattern. Use Stack component instead.", "0"]
],
"public/app/plugins/panel/canvas/editor/layer/layerEditor.tsx:5381": [
[0, 0, 0, "Do not use any type assertions.", "0"],
@ -5926,8 +5801,7 @@ exports[`better eslint`] = {
[0, 0, 0, "Unexpected any. Specify a different type.", "2"]
],
"public/app/plugins/panel/geomap/editor/GeomapStyleRulesEditor.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.", "0"]
],
"public/app/plugins/panel/geomap/editor/MapViewEditor.tsx:5381": [
[0, 0, 0, "\'VerticalGroup\' import from \'@grafana/ui\' is restricted from being used by a pattern. Use Stack component instead.", "0"]
@ -5948,8 +5822,7 @@ exports[`better eslint`] = {
[0, 0, 0, "Do not use any type assertions.", "12"]
],
"public/app/plugins/panel/geomap/editor/StyleRuleEditor.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.", "0"]
],
"public/app/plugins/panel/geomap/layers/basemaps/esri.ts:5381": [
[0, 0, 0, "Do not use any type assertions.", "0"]

View File

@ -745,7 +745,7 @@ export class PrometheusDatasource
return expandedQueries;
}
getQueryHints(query: PromQuery, result: any[]) {
getQueryHints(query: PromQuery, result: unknown[]) {
return getQueryHints(query.expr ?? '', result, this);
}
@ -865,7 +865,7 @@ export class PrometheusDatasource
return expr;
}
const finalQuery = filters.reduce((acc: string, filter: { key?: any; operator?: any; value?: any }) => {
const finalQuery = filters.reduce((acc, filter) => {
const { key, operator } = filter;
let { value } = filter;
if (operator === '=~' || operator === '!~') {
@ -1014,10 +1014,10 @@ export function extractRuleMappingFromGroups(groups: any[]) {
// 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
// no way to reuse one in the another or vice versa.
export function prometheusRegularEscape(value: unknown) {
export function prometheusRegularEscape<T>(value: T) {
return typeof value === 'string' ? value.replace(/\\/g, '\\\\').replace(/'/g, "\\\\'") : value;
}
export function prometheusSpecialRegexEscape(value: unknown) {
export function prometheusSpecialRegexEscape<T>(value: T) {
return typeof value === 'string' ? value.replace(/\\/g, '\\\\\\\\').replace(/[$^*{}\[\]\'+?.()|]/g, '\\\\$&') : value;
}

View File

@ -101,7 +101,7 @@ export default class PromQlLanguageProvider extends LanguageProvider {
return PromqlSyntax;
}
request = async (url: string, defaultValue: any, params = {}, options?: Partial<BackendSrvRequest>): Promise<any> => {
request = async (url: string, defaultValue: any, params = {}, options?: Partial<BackendSrvRequest>) => {
try {
const res = await this.datasource.metadataRequest(url, params, options);
return res.data.data;
@ -365,7 +365,7 @@ export default class PromQlLanguageProvider extends LanguageProvider {
});
}
function getNameLabelValue(promQuery: string, tokens: any): string {
function getNameLabelValue(promQuery: string, tokens: Array<string | Prism.Token>): string {
let nameLabelValue = '';
for (const token of tokens) {

View File

@ -74,7 +74,7 @@ export const selectorRegexp = /\{[^}]*?(\}|$)/;
// comma and space is useful for addLabelsToExpression function
export const labelRegexp = /\b(\w+)(!?=~?)("[^"\n]*?")(,)?(\s*)?/g;
export function parseSelector(query: string, cursorOffset = 1): { labelKeys: any[]; selector: string } {
export function parseSelector(query: string, cursorOffset = 1): { labelKeys: string[]; selector: string } {
if (!query.match(selectorRegexp)) {
// Special matcher for metrics
if (query.match(/^[A-Za-z:][\w:]*$/)) {
@ -345,7 +345,7 @@ export function limitSuggestions(items: string[]) {
return items.slice(0, SUGGESTIONS_LIMIT);
}
export function addLimitInfo(items: any[] | undefined): string {
export function addLimitInfo(items: unknown[] | undefined): string {
return items && items.length >= SUGGESTIONS_LIMIT ? `, limited to the first ${SUGGESTIONS_LIMIT} received items` : '';
}

View File

@ -85,7 +85,7 @@ export class PrometheusMetricFindQuery {
if (!metric || this.datasource.hasLabelsMatchAPISupport()) {
const url = `/api/v1/label/${label}/values`;
return this.datasource.metadataRequest(url, params).then((result: any) => {
return this.datasource.metadataRequest(url, params).then((result) => {
return _map(result.data.data, (value) => {
return { text: value };
});
@ -93,7 +93,7 @@ export class PrometheusMetricFindQuery {
} else {
const url = `/api/v1/series`;
return this.datasource.metadataRequest(url, params).then((result: any) => {
return this.datasource.metadataRequest(url, params).then((result) => {
const _labels = _map(result.data.data, (metric) => {
return metric[label] || '';
}).filter((label) => {
@ -119,7 +119,7 @@ export class PrometheusMetricFindQuery {
};
const url = `/api/v1/label/__name__/values`;
return this.datasource.metadataRequest(url, params).then((result: any) => {
return this.datasource.metadataRequest(url, params).then((result) => {
return chain(result.data.data)
.filter((metricName) => {
const r = new RegExp(metricFilterPattern);
@ -141,7 +141,7 @@ export class PrometheusMetricFindQuery {
query,
time: getPrometheusTime(this.range.to, true).toString(),
};
return this.datasource.metadataRequest(url, params).then((result: any) => {
return this.datasource.metadataRequest(url, params).then((result) => {
switch (result.data.data.resultType) {
case 'scalar': // [ <unix_time>, "<scalar_value>" ]
case 'string': // [ <unix_time>, "<string_value>" ]
@ -186,7 +186,7 @@ export class PrometheusMetricFindQuery {
const url = `/api/v1/series`;
const self = this;
return this.datasource.metadataRequest(url, params).then((result: any) => {
return this.datasource.metadataRequest(url, params).then((result) => {
return _map(result.data.data, (metric: { [key: string]: string }) => {
return {
text: self.datasource.getOriginalMetricName(metric),

View File

@ -9,7 +9,7 @@ import { PrometheusDatasource } from './datasource';
*/
export const SUM_HINT_THRESHOLD_COUNT = 20;
export function getQueryHints(query: string, series?: any[], datasource?: PrometheusDatasource): QueryHint[] {
export function getQueryHints(query: string, series?: unknown[], datasource?: PrometheusDatasource): QueryHint[] {
const hints = [];
// ..._bucket metric needs a histogram_quantile()

View File

@ -85,14 +85,14 @@ export const binaryScalarOperatorToOperatorName = binaryScalarDefs.reduce<
// both the operator and the operand in a single input
export const binaryScalarOperations: QueryBuilderOperationDef[] = binaryScalarDefs.map((opDef) => {
const params: QueryBuilderOperationParamDef[] = [{ name: 'Value', type: 'number' }];
const defaultParams: any[] = [2];
let defaultParams: [number] | [number, boolean] = [2];
if (opDef.comparison) {
params.push({
name: 'Bool',
type: 'boolean',
description: 'If checked comparison will return 0 or 1 for the value rather than filtering.',
});
defaultParams.push(false);
defaultParams = [2, false];
}
return {

View File

@ -58,7 +58,7 @@ export function MetricSelect({
}: MetricSelectProps) {
const styles = useStyles2(getStyles);
const [state, setState] = useState<{
metrics?: Array<SelectableValue<any>>;
metrics?: SelectableValue[];
isLoading?: boolean;
metricsModalOpen?: boolean;
initialMetrics?: string[];
@ -76,7 +76,7 @@ export function MetricSelect({
];
const customFilterOption = useCallback(
(option: SelectableValue<any>, searchQuery: string) => {
(option: SelectableValue, searchQuery: string) => {
const label = option.label ?? option.value;
if (!label) {
return false;
@ -104,7 +104,7 @@ export function MetricSelect({
);
const formatOptionLabel = useCallback(
(option: SelectableValue<any>, meta: FormatOptionLabelMeta<any>) => {
(option: SelectableValue, meta: FormatOptionLabelMeta<any>) => {
// For newly created custom value we don't want to add highlight
if (option['__isNew__']) {
return option.label;

View File

@ -7,13 +7,10 @@ export interface AzureAuthSettings {
readonly azureAuthSupported: boolean;
/** Gets whether the Azure authentication currently enabled for the datasource */
readonly getAzureAuthEnabled: (config: DataSourceSettings<any, any>) => boolean;
readonly getAzureAuthEnabled: (config: DataSourceSettings) => boolean;
/** Enables/disables the Azure authentication from the datasource */
readonly setAzureAuthEnabled: (
config: DataSourceSettings<any, any>,
enabled: boolean
) => Partial<DataSourceSettings<any, any>>;
readonly setAzureAuthEnabled: (config: DataSourceSettings, enabled: boolean) => Partial<DataSourceSettings>;
/** Optional React component of additional Azure settings UI if authentication is enabled */
readonly azureSettingsUI?: React.ComponentType<HttpSettingsBaseProps>;

View File

@ -15,7 +15,7 @@ export function createFetchCorrelationsResponse<T>(overrides?: DeepPartial<Fetch
type: 'basic',
statusText: 'Ok',
redirected: false,
headers: {} as unknown as Headers,
headers: new Headers(),
ok: true,
},
overrides

View File

@ -1,6 +1,6 @@
import { debounce, memoize } from 'lodash';
export default (func: (...args: any[]) => void, wait = 7000) => {
export default <T>(func: (...args: T[]) => void, wait = 7000) => {
const mem = memoize(
(...args) =>
debounce(func, wait, {
@ -9,5 +9,5 @@ export default (func: (...args: any[]) => void, wait = 7000) => {
(...args) => JSON.stringify(args)
);
return (...args: any[]) => mem(...args)(...args);
return (...args: T[]) => mem(...args)(...args);
};

View File

@ -186,7 +186,7 @@ export class ElasticResponse {
}
// helper func to add values to value array
const addMetricValue = (values: any[], metricName: string, value: any) => {
const addMetricValue = (values: unknown[], metricName: string, value: unknown) => {
table.addColumn({ text: metricName });
values.push(value);
};

View File

@ -30,12 +30,7 @@ export class LegacyQueryRunner {
this.templateSrv = templateSrv;
}
request(
method: string,
url: string,
data?: BackendSrvRequest['data'],
headers?: BackendSrvRequest['headers']
): Observable<any> {
request(method: string, url: string, data?: BackendSrvRequest['data'], headers?: BackendSrvRequest['headers']) {
if (!this.datasource.isProxyAccess) {
const error = new Error(
'Browser access mode in the Elasticsearch datasource is no longer available. Switch to server access mode.'

View File

@ -75,7 +75,7 @@ function createFetchResponse<T>(data: T): FetchResponse<T> {
type: 'basic',
statusText: 'Ok',
redirected: false,
headers: {} as unknown as Headers,
headers: new Headers(),
ok: true,
};
}
@ -475,7 +475,7 @@ describe('ElasticDatasource', () => {
type: 'basic',
statusText: 'Bad Request',
redirected: false,
headers: {} as unknown as Headers,
headers: new Headers(),
ok: false,
};

View File

@ -812,6 +812,6 @@ const createFetchResponse = <T>(data: T): FetchResponse<T> => ({
type: 'basic',
statusText: 'Ok',
redirected: false,
headers: {} as unknown as Headers,
headers: new Headers(),
ok: true,
});

View File

@ -8,12 +8,12 @@ import {
SelectableValue,
rangeUtil,
DataQueryRequest,
DataFrame,
DataFrameJSON,
dataFrameToJSON,
GrafanaTheme2,
getValueFormat,
formattedValueToString,
Field,
} from '@grafana/data';
import { config, getDataSourceSrv, reportInteraction } from '@grafana/runtime';
import {
@ -108,7 +108,7 @@ export class UnthemedQueryEditor extends PureComponent<Props, State> {
gds.query(query).subscribe({
next: (rsp) => {
if (rsp.data.length) {
const names = (rsp.data[0] as DataFrame).fields[0];
const names: Field = rsp.data[0].fields[0];
const folders = names.values.map((v) => ({
value: v,
label: v,

View File

@ -41,7 +41,7 @@ export class GrafanaDatasource extends DataSourceWithBackend<GrafanaQuery> {
super(instanceSettings);
this.annotations = {
QueryEditor: AnnotationQueryEditor,
prepareAnnotation(json: any): AnnotationQuery<GrafanaAnnotationQuery> {
prepareAnnotation(json): AnnotationQuery<GrafanaAnnotationQuery> {
// Previously, these properties lived outside of target
// This should handle migrating them
json.target = json.target ?? {

View File

@ -434,7 +434,7 @@ export class GraphiteDatasource
}
}
events(options: { range: TimeRange; tags: any; timezone?: any }) {
events(options: { range: TimeRange; tags: any; timezone?: TimeZone }) {
try {
let tags = '';
if (options.tags) {
@ -460,7 +460,7 @@ export class GraphiteDatasource
return this.templateSrv.containsTemplate(target.target ?? '');
}
translateTime(date: any, roundUp: any, timezone: TimeZone) {
translateTime(date: any, roundUp?: boolean, timezone?: TimeZone) {
if (isString(date)) {
if (date === 'now') {
return 'now';

View File

@ -4,7 +4,7 @@ import { createErrorNotification } from '../../../../core/copy/appNotification';
import { notifyApp } from '../../../../core/reducers/appNotification';
import { dispatch } from '../../../../store/store';
import { FuncInstance } from '../gfunc';
import { GraphiteQuery, GraphiteTagOperator } from '../types';
import { GraphiteTagOperator } from '../types';
import { GraphiteQueryEditorState } from './store';
@ -164,7 +164,7 @@ export function handleTargetChanged(state: GraphiteQueryEditorState): void {
// is used for interpolation we should check required properties are passed though in theory it allows to interpolate
// with queries that contain "target" property as well.
state.queryModel.updateModelTarget(
(state.queries || []).filter((query) => 'target' in query && typeof (query as GraphiteQuery).target === 'string')
(state.queries || []).filter((query) => 'target' in query && typeof query.target === 'string')
);
// remove spaces from old and new targets

View File

@ -580,7 +580,7 @@ export default class InfluxDatasource extends DataSourceWithBackend<InfluxQuery,
return 'time >= ' + from + ' and time <= ' + until;
}
getInfluxTime(date: DateTime | string, roundUp: any, timezone: any) {
getInfluxTime(date: DateTime | string, roundUp: boolean, timezone: string) {
let outPutDate;
if (isString(date)) {
if (date === 'now') {

View File

@ -1,6 +1,6 @@
import { filter, find, indexOf, map } from 'lodash';
import { escapeRegex, ScopedVars } from '@grafana/data';
import { AdHocVariableFilter, escapeRegex, ScopedVars } from '@grafana/data';
import { TemplateSrv } from '@grafana/runtime';
import { removeRegexWrapper } from './queryUtils';
@ -333,7 +333,7 @@ export default class InfluxQueryModel {
return query;
}
renderAdhocFilters(filters: any[]) {
renderAdhocFilters(filters: AdHocVariableFilter[]) {
const conditions = map(filters, (tag, index) => {
return this.renderTagCondition(tag, index, true);
});

View File

@ -13,7 +13,7 @@ const categories: any = {
Fields: [],
};
function createPart(part: any): any {
function createPart(part: any) {
const def = index[part.type];
if (!def) {
throw { message: 'Could not find query part ' + part.type };

View File

@ -9,7 +9,7 @@ export function createFetchResponse<T>(data: T): FetchResponse<T> {
type: 'basic',
statusText: 'Ok',
redirected: false,
headers: {} as unknown as Headers,
headers: new Headers(),
ok: true,
};
}

View File

@ -108,7 +108,7 @@ export const testResponseEdgesFields = toEdgesFrame([
['3fa414edcef6ad90'],
]);
export function toNodesFrame(values: any[]) {
export function toNodesFrame(values: unknown[][]) {
return toVectors([
{ name: 'id', values: values[0] },
{ name: 'title', values: values[1] },
@ -127,7 +127,7 @@ export function toNodesFrame(values: any[]) {
]);
}
export function toEdgesFrame(values: any[]) {
export function toEdgesFrame(values: unknown[][]) {
return toVectors([
{ name: 'id', values: values[0] },
{ name: 'target', values: values[1] },

View File

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

View File

@ -43,7 +43,7 @@ export class LiveStreams {
appendResponseToBufferedData(response, data);
return [data];
}),
retryWhen((attempts: Observable<any>) =>
retryWhen((attempts) =>
attempts.pipe(
mergeMap((error, i) => {
const retryAttempt = i + 1;

View File

@ -107,7 +107,7 @@ const testLogsResponse: FetchResponse = {
},
},
ok: true,
headers: {} as unknown as Headers,
headers: new Headers(),
redirected: false,
status: 200,
statusText: 'Success',

View File

@ -412,7 +412,7 @@ export class LokiDatasource
key: `loki-${liveTarget.refId}`,
state: LoadingState.Streaming,
})),
catchError((err: any) => {
catchError((err) => {
return throwError(() => `Live tailing was stopped due to following error: ${err.reason}`);
})
);
@ -1151,14 +1151,14 @@ export class LokiDatasource
// 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
// no way to reuse one in the another or vice versa.
export function lokiRegularEscape(value: any) {
export function lokiRegularEscape<T>(value: T) {
if (typeof value === 'string') {
return value.replace(/'/g, "\\\\'");
}
return value;
}
export function lokiSpecialRegexEscape(value: any) {
export function lokiSpecialRegexEscape<T>(value: T) {
if (typeof value === 'string') {
return lokiRegularEscape(value.replace(/\\/g, '\\\\\\\\').replace(/[$^*{}\[\]+?.()|]/g, '\\\\$&'));
}

View File

@ -310,8 +310,7 @@ export const isLokiQuery = (query: DataQuery): query is LokiQuery => {
return false;
}
const lokiQuery = query as LokiQuery;
return lokiQuery.expr !== undefined;
return 'expr' in query && query.expr !== undefined;
};
export const getLokiQueryFromDataQuery = (query?: DataQuery): LokiQuery | undefined => {

View File

@ -80,14 +80,14 @@ export const binaryScalarDefs = [
// both the operator and the operand in a single input
export const binaryScalarOperations: QueryBuilderOperationDefinition[] = binaryScalarDefs.map((opDef) => {
const params: QueryBuilderOperationParamDef[] = [{ name: 'Value', type: 'number' }];
const defaultParams: any[] = [2];
let defaultParams: [number] | [number, boolean] = [2];
if (opDef.comparison) {
params.push({
name: 'Bool',
type: 'boolean',
description: 'If checked comparison will return 0 or 1 for the value rather than filtering.',
});
defaultParams.push(false);
defaultParams = [2, false];
}
return {

View File

@ -62,7 +62,7 @@ export function doLokiChannelStream(
return defer(() => getLiveStreamKey(query)).pipe(
mergeMap((key) => {
return getGrafanaLiveSrv()
.getStream<any>({
.getStream({
scope: LiveChannelScope.DataSource,
namespace: ds.uid,
path: `tail/${key}`,

View File

@ -527,6 +527,6 @@ const createFetchResponse = <T>(data: T): FetchResponse<T> => ({
type: 'basic',
statusText: 'Ok',
redirected: false,
headers: {} as unknown as Headers,
headers: new Headers(),
ok: true,
});

View File

@ -115,7 +115,7 @@ export default class OpenTsDatasource extends DataSourceApi<OpenTsdbQuery, OpenT
return of({ data: [] });
}
const groupByTags: any = {};
const groupByTags: Record<string, boolean> = {};
each(queries, (query) => {
if (query.filters && query.filters.length > 0) {
each(query.filters, (val) => {
@ -139,7 +139,7 @@ export default class OpenTsDatasource extends DataSourceApi<OpenTsdbQuery, OpenT
}),
map((response) => {
const metricToTargetMapping = this.mapMetricsToTargets(response.data, options, this.tsdbVersion);
const result = _map(response.data, (metricData: any, index: number) => {
const result = _map(response.data, (metricData, index: number) => {
index = metricToTargetMapping[index];
if (index === -1) {
index = 0;
@ -259,15 +259,15 @@ export default class OpenTsDatasource extends DataSourceApi<OpenTsdbQuery, OpenT
this.tagKeys[metricData.metric] = tagKeys;
}
_performSuggestQuery(query: string, type: string): Observable<any> {
_performSuggestQuery(query: string, type: string) {
return this._get('/api/suggest', { type, q: query, max: this.lookupLimit }).pipe(
map((result: any) => {
map((result) => {
return result.data;
})
);
}
_performMetricKeyValueLookup(metric: string, keys: any): Observable<any[]> {
_performMetricKeyValueLookup(metric: string, keys: any) {
if (!metric || !keys) {
return of([]);
}
@ -285,7 +285,7 @@ export default class OpenTsDatasource extends DataSourceApi<OpenTsdbQuery, OpenT
const m = metric + '{' + keysQuery + '}';
return this._get('/api/search/lookup', { m: m, limit: this.lookupLimit }).pipe(
map((result: any) => {
map((result) => {
result = result.data.results;
const tagvs: any[] = [];
each(result, (r) => {
@ -298,13 +298,13 @@ export default class OpenTsDatasource extends DataSourceApi<OpenTsdbQuery, OpenT
);
}
_performMetricKeyLookup(metric: any): Observable<any[]> {
_performMetricKeyLookup(metric: any) {
if (!metric) {
return of([]);
}
return this._get('/api/search/lookup', { m: metric, limit: 1000 }).pipe(
map((result: any) => {
map((result) => {
result = result.data.results;
const tagks: any[] = [];
each(result, (r) => {
@ -414,7 +414,7 @@ export default class OpenTsDatasource extends DataSourceApi<OpenTsdbQuery, OpenT
this.aggregatorsPromise = lastValueFrom(
this._get('/api/aggregators').pipe(
map((result: any) => {
map((result) => {
if (result.data && isArray(result.data)) {
return result.data.sort();
}
@ -432,7 +432,7 @@ export default class OpenTsDatasource extends DataSourceApi<OpenTsdbQuery, OpenT
this.filterTypesPromise = lastValueFrom(
this._get('/api/config/filters').pipe(
map((result: any) => {
map((result) => {
if (result.data) {
return Object.keys(result.data).sort();
}
@ -449,7 +449,7 @@ export default class OpenTsDatasource extends DataSourceApi<OpenTsdbQuery, OpenT
// TSDB returns datapoints has a hash of ts => value.
// Can't use pairs(invert()) because it stringifies keys/values
each(md.dps, (v: any, k: number) => {
each(md.dps, (v, k: number) => {
if (tsdbResolution === 2) {
dps.push([v, k * 1]);
} else {
@ -609,7 +609,7 @@ export default class OpenTsDatasource extends DataSourceApi<OpenTsdbQuery, OpenT
return query;
}
convertToTSDBTime(date: any, roundUp: any, timezone: any) {
convertToTSDBTime(date: any, roundUp: boolean, timezone: string) {
if (date === 'now') {
return null;
}

View File

@ -30,8 +30,8 @@ export const ConfigEditor = (props: Props) => {
const azureAuthSettings = {
azureAuthSupported: config.azureAuthEnabled,
getAzureAuthEnabled: (config: DataSourceSettings<any, any>): boolean => hasCredentials(config),
setAzureAuthEnabled: (config: DataSourceSettings<any, any>, enabled: boolean) =>
getAzureAuthEnabled: (config: DataSourceSettings): boolean => hasCredentials(config),
setAzureAuthEnabled: (config: DataSourceSettings, enabled: boolean) =>
enabled ? setDefaultCredentials(config) : resetCredentials(config),
azureSettingsUI: AzureAuthSettings,
};

View File

@ -21,8 +21,8 @@ export const ConfigEditor = (props: Props) => {
const azureAuthSettings = {
azureAuthSupported: config.azureAuthEnabled,
getAzureAuthEnabled: (config: DataSourceSettings<any, any>): boolean => hasCredentials(config),
setAzureAuthEnabled: (config: DataSourceSettings<any, any>, enabled: boolean) =>
getAzureAuthEnabled: (config: DataSourceSettings): boolean => hasCredentials(config),
setAzureAuthEnabled: (config: DataSourceSettings, enabled: boolean) =>
enabled ? setDefaultCredentials(config) : resetCredentials(config),
azureSettingsUI: AzureAuthSettings,
};

View File

@ -745,7 +745,7 @@ export class PrometheusDatasource
return expandedQueries;
}
getQueryHints(query: PromQuery, result: any[]) {
getQueryHints(query: PromQuery, result: unknown[]) {
return getQueryHints(query.expr ?? '', result, this);
}
@ -865,7 +865,7 @@ export class PrometheusDatasource
return expr;
}
const finalQuery = filters.reduce((acc: string, filter: { key?: any; operator?: any; value?: any }) => {
const finalQuery = filters.reduce((acc, filter) => {
const { key, operator } = filter;
let { value } = filter;
if (operator === '=~' || operator === '!~') {
@ -1014,10 +1014,10 @@ export function extractRuleMappingFromGroups(groups: any[]) {
// 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
// no way to reuse one in the another or vice versa.
export function prometheusRegularEscape(value: unknown) {
export function prometheusRegularEscape<T>(value: T) {
return typeof value === 'string' ? value.replace(/\\/g, '\\\\').replace(/'/g, "\\\\'") : value;
}
export function prometheusSpecialRegexEscape(value: unknown) {
export function prometheusSpecialRegexEscape<T>(value: T) {
return typeof value === 'string' ? value.replace(/\\/g, '\\\\\\\\').replace(/[$^*{}\[\]\'+?.()|]/g, '\\\\$&') : value;
}

View File

@ -101,7 +101,7 @@ export default class PromQlLanguageProvider extends LanguageProvider {
return PromqlSyntax;
}
request = async (url: string, defaultValue: any, params = {}, options?: Partial<BackendSrvRequest>): Promise<any> => {
request = async (url: string, defaultValue: any, params = {}, options?: Partial<BackendSrvRequest>) => {
try {
const res = await this.datasource.metadataRequest(url, params, options);
return res.data.data;
@ -365,7 +365,7 @@ export default class PromQlLanguageProvider extends LanguageProvider {
});
}
function getNameLabelValue(promQuery: string, tokens: any): string {
function getNameLabelValue(promQuery: string, tokens: Array<string | Prism.Token>): string {
let nameLabelValue = '';
for (const token of tokens) {

View File

@ -74,7 +74,7 @@ export const selectorRegexp = /\{[^}]*?(\}|$)/;
// comma and space is useful for addLabelsToExpression function
export const labelRegexp = /\b(\w+)(!?=~?)("[^"\n]*?")(,)?(\s*)?/g;
export function parseSelector(query: string, cursorOffset = 1): { labelKeys: any[]; selector: string } {
export function parseSelector(query: string, cursorOffset = 1): { labelKeys: string[]; selector: string } {
if (!query.match(selectorRegexp)) {
// Special matcher for metrics
if (query.match(/^[A-Za-z:][\w:]*$/)) {
@ -345,7 +345,7 @@ export function limitSuggestions(items: string[]) {
return items.slice(0, SUGGESTIONS_LIMIT);
}
export function addLimitInfo(items: any[] | undefined): string {
export function addLimitInfo(items: unknown[] | undefined): string {
return items && items.length >= SUGGESTIONS_LIMIT ? `, limited to the first ${SUGGESTIONS_LIMIT} received items` : '';
}

View File

@ -85,7 +85,7 @@ export default class PrometheusMetricFindQuery {
if (!metric || this.datasource.hasLabelsMatchAPISupport()) {
const url = `/api/v1/label/${label}/values`;
return this.datasource.metadataRequest(url, params).then((result: any) => {
return this.datasource.metadataRequest(url, params).then((result) => {
return _map(result.data.data, (value) => {
return { text: value };
});
@ -93,7 +93,7 @@ export default class PrometheusMetricFindQuery {
} else {
const url = `/api/v1/series`;
return this.datasource.metadataRequest(url, params).then((result: any) => {
return this.datasource.metadataRequest(url, params).then((result) => {
const _labels = _map(result.data.data, (metric) => {
return metric[label] || '';
}).filter((label) => {
@ -119,7 +119,7 @@ export default class PrometheusMetricFindQuery {
};
const url = `/api/v1/label/__name__/values`;
return this.datasource.metadataRequest(url, params).then((result: any) => {
return this.datasource.metadataRequest(url, params).then((result) => {
return chain(result.data.data)
.filter((metricName) => {
const r = new RegExp(metricFilterPattern);
@ -141,7 +141,7 @@ export default class PrometheusMetricFindQuery {
query,
time: getPrometheusTime(this.range.to, true).toString(),
};
return this.datasource.metadataRequest(url, params).then((result: any) => {
return this.datasource.metadataRequest(url, params).then((result) => {
switch (result.data.data.resultType) {
case 'scalar': // [ <unix_time>, "<scalar_value>" ]
case 'string': // [ <unix_time>, "<string_value>" ]
@ -186,7 +186,7 @@ export default class PrometheusMetricFindQuery {
const url = `/api/v1/series`;
const self = this;
return this.datasource.metadataRequest(url, params).then((result: any) => {
return this.datasource.metadataRequest(url, params).then((result) => {
return _map(result.data.data, (metric: { [key: string]: string }) => {
return {
text: self.datasource.getOriginalMetricName(metric),

View File

@ -9,7 +9,7 @@ import { PrometheusDatasource } from './datasource';
*/
export const SUM_HINT_THRESHOLD_COUNT = 20;
export function getQueryHints(query: string, series?: any[], datasource?: PrometheusDatasource): QueryHint[] {
export function getQueryHints(query: string, series?: unknown[], datasource?: PrometheusDatasource): QueryHint[] {
const hints = [];
// ..._bucket metric needs a histogram_quantile()

View File

@ -58,7 +58,7 @@ export function MetricSelect({
}: Props) {
const styles = useStyles2(getStyles);
const [state, setState] = useState<{
metrics?: Array<SelectableValue<any>>;
metrics?: SelectableValue[];
isLoading?: boolean;
metricsModalOpen?: boolean;
initialMetrics?: string[];
@ -76,7 +76,7 @@ export function MetricSelect({
];
const customFilterOption = useCallback(
(option: SelectableValue<any>, searchQuery: string) => {
(option: SelectableValue, searchQuery: string) => {
const label = option.label ?? option.value;
if (!label) {
return false;
@ -104,7 +104,7 @@ export function MetricSelect({
);
const formatOptionLabel = useCallback(
(option: SelectableValue<any>, meta: FormatOptionLabelMeta<any>) => {
(option: SelectableValue, meta: FormatOptionLabelMeta<any>) => {
// For newly created custom value we don't want to add highlight
if (option['__isNew__']) {
return option.label;

View File

@ -9,7 +9,7 @@ export function createFetchResponse<T>(data: T): FetchResponse<T> {
type: 'basic',
statusText: 'Ok',
redirected: false,
headers: {} as unknown as Headers,
headers: new Headers(),
ok: true,
};
}

View File

@ -92,7 +92,7 @@ export const testResponseEdgesFields = toEdgesFrame([
['3fa414edcef6ad90'],
]);
export function toNodesFrame(values: any[]) {
export function toNodesFrame(values: unknown[][]) {
return toVectors([
{ name: 'id', values: values[0] },
{ name: 'title', values: values[1] },
@ -111,7 +111,7 @@ export function toNodesFrame(values: any[]) {
]);
}
export function toEdgesFrame(values: any[]) {
export function toEdgesFrame(values: unknown[][]) {
return toVectors([
{ name: 'id', values: values[0] },
{ name: 'target', values: values[1] },

View File

@ -31,7 +31,7 @@ const verticalOptions: Array<SelectableValue<VerticalConstraint>> = [
{ label: 'Scale', value: VerticalConstraint.Scale },
];
type Props = StandardEditorProps<any, CanvasEditorOptions, Options>;
type Props = StandardEditorProps<unknown, CanvasEditorOptions, Options>;
export function PlacementEditor({ item }: Props) {
const settings = item.settings;

View File

@ -16,6 +16,7 @@ import { setOptionImmutably } from 'app/features/dashboard/components/PanelEdito
import { activePanelSubject, InstanceState } from '../../CanvasPanel';
import { addStandardCanvasEditorOptions } from '../../module';
import { Options } from '../../panelcfg.gen';
import { InlineEditTabs } from '../../types';
import { getElementTypes, onAddItem } from '../../utils';
import { getConnectionEditor } from '../connectionEditor';
@ -38,7 +39,7 @@ export function InlineEditBody() {
return new OptionsPaneCategoryDescriptor({ id: 'root', title: 'root' });
}
const supplier = (builder: PanelOptionsEditorBuilder<any>) => {
const supplier = (builder: PanelOptionsEditorBuilder<Options>) => {
if (activeTab === InlineEditTabs.ElementManagement) {
builder.addNestedOptions(getLayerEditor(instanceState));
}

View File

@ -20,7 +20,7 @@ import { getTreeData, onNodeDrop, TreeElement } from './tree';
let allowSelection = true;
export const TreeNavigationEditor = ({ item }: StandardEditorProps<any, TreeViewEditorProps, Options>) => {
export const TreeNavigationEditor = ({ item }: StandardEditorProps<unknown, TreeViewEditorProps, Options>) => {
const [treeData, setTreeData] = useState(getTreeData(item?.settings?.scene.root));
const [autoExpandParent, setAutoExpandParent] = useState(true);
const [expandedKeys, setExpandedKeys] = useState<Key[]>([]);

View File

@ -9,7 +9,7 @@ import { FeatureStyleConfig } from '../types';
import { StyleRuleEditor, StyleRuleEditorSettings } from './StyleRuleEditor';
type Props = StandardEditorProps<FeatureStyleConfig[], unknown, unknown>;
type Props = StandardEditorProps<FeatureStyleConfig[], StyleRuleEditorSettings, unknown>;
export const GeomapStyleRulesEditor = ({ value, onChange, context, item }: Props) => {
const theme = useTheme2();
@ -43,9 +43,9 @@ export const GeomapStyleRulesEditor = ({ value, onChange, context, item }: Props
const styleOptions =
value &&
value.map((style, idx: number) => {
const itemSettings: StandardEditorsRegistryItem<any, StyleRuleEditorSettings> = {
const itemSettings = {
settings,
} as StandardEditorsRegistryItem;
} as StandardEditorsRegistryItem<FeatureStyleConfig, StyleRuleEditorSettings>;
return (
<StyleRuleEditor

View File

@ -23,10 +23,14 @@ export interface StyleRuleEditorSettings {
layerInfo: Observable<LayerContentInfo>;
}
type Props = StandardEditorProps<FeatureStyleConfig, any, unknown, StyleRuleEditorSettings>;
type Props = StandardEditorProps<FeatureStyleConfig, StyleRuleEditorSettings, unknown>;
export const StyleRuleEditor = ({ value, onChange, item, context }: Props) => {
const settings: StyleRuleEditorSettings = item.settings;
const settings = item.settings;
if (!settings) {
// Shouldn't be possible to hit this block, but just in case
throw Error('Settings not found');
}
const { features, layerInfo } = settings;
const propertyOptions = useObservable(layerInfo);

View File

@ -9,7 +9,7 @@ export function createFetchResponse<T>(data: T): FetchResponse<T> {
type: 'basic',
statusText: 'Ok',
redirected: false,
headers: {} as unknown as Headers,
headers: new Headers(),
ok: true,
};
}