From 171e2c1adb878127f6b7c9c94420f3552442a546 Mon Sep 17 00:00:00 2001 From: Ashley Harrison Date: Fri, 6 Oct 2023 11:48:15 +0100 Subject: [PATCH] Chore: Improve typings and ignore `Graph` (#75742) * fix some types, ignore graph plugin as it'll be gone soon * update comments * more more more * undo renderer change * use Partial in the editor --- .betterer.results | 509 ++---------------- .betterer.ts | 10 +- .../unified/components/Expression.test.tsx | 2 +- .../datasource/prometheus/query_hints.ts | 6 +- .../components/LabelParamEditor.tsx | 7 +- .../components/PromQueryBuilderContainer.tsx | 6 +- .../shared/OperationParamEditor.tsx | 6 +- .../prometheus/result_transformer.ts | 3 +- .../plugins/datasource/tempo/datasource.ts | 2 +- .../datasource/tempo/resultTransformer.ts | 4 +- .../datasource/zipkin/utils/transforms.ts | 4 +- public/app/plugins/panel/barchart/bars.ts | 5 +- .../canvas/editor/element/elementEditor.tsx | 4 +- .../canvas/editor/inline/InlineEditBody.tsx | 2 +- .../panel/canvas/editor/layer/layerEditor.tsx | 6 +- .../geomap/components/MeasureVectorLayer.ts | 21 +- .../geomap/layers/data/dayNightLayer.tsx | 2 +- .../panel/geomap/layers/data/heatMap.tsx | 4 +- .../panel/geomap/layers/data/markersLayer.tsx | 2 +- .../panel/geomap/layers/data/photosLayer.tsx | 2 +- .../panel/geomap/layers/data/routeLayer.tsx | 6 +- .../plugins/panel/heatmap/HeatmapPanel.tsx | 11 +- .../app/plugins/panel/heatmap/migrations.ts | 4 +- .../plugins/panel/live/LiveChannelEditor.tsx | 29 +- public/app/plugins/panel/live/LivePanel.tsx | 4 +- public/app/plugins/panel/nodeGraph/Legend.tsx | 5 +- public/app/plugins/panel/table-old/editor.ts | 4 +- public/app/plugins/panel/table-old/module.ts | 9 +- .../app/plugins/panel/table-old/renderer.ts | 8 +- .../plugins/panel/table-old/transformers.ts | 4 +- public/app/plugins/panel/table/migrations.ts | 2 +- .../plugins/panel/timeseries/migrations.ts | 6 +- 32 files changed, 137 insertions(+), 562 deletions(-) diff --git a/.betterer.results b/.betterer.results index 927ce516602..87fcd91574d 100644 --- a/.betterer.results +++ b/.betterer.results @@ -6782,11 +6782,7 @@ exports[`better eslint`] = { [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.", "1"], - [0, 0, 0, "Do not use any type assertions.", "2"], - [0, 0, 0, "Do not use any type assertions.", "3"], - [0, 0, 0, "Do not use any type assertions.", "4"] + [0, 0, 0, "Unexpected any. Specify a different type.", "0"] ], "public/app/plugins/datasource/prometheus/querybuilder/QueryPattern.tsx:5381": [ [0, 0, 0, "Styles should be written using objects.", "0"], @@ -6814,9 +6810,7 @@ exports[`better eslint`] = { [0, 0, 0, "Styles should be written using objects.", "0"] ], "public/app/plugins/datasource/prometheus/querybuilder/components/LabelParamEditor.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, "Unexpected any. Specify a different type.", "2"] + [0, 0, 0, "Do not use any type assertions.", "0"] ], "public/app/plugins/datasource/prometheus/querybuilder/components/MetricSelect.tsx:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"], @@ -6836,9 +6830,6 @@ exports[`better eslint`] = { "public/app/plugins/datasource/prometheus/querybuilder/components/PromQueryBuilder.tsx:5381": [ [0, 0, 0, "Do not use any type assertions.", "0"] ], - "public/app/plugins/datasource/prometheus/querybuilder/components/PromQueryBuilderContainer.tsx:5381": [ - [0, 0, 0, "Do not use any type assertions.", "0"] - ], "public/app/plugins/datasource/prometheus/querybuilder/components/PromQueryCodeEditor.tsx:5381": [ [0, 0, 0, "Styles should be written using objects.", "0"] ], @@ -6908,10 +6899,7 @@ exports[`better eslint`] = { ], "public/app/plugins/datasource/prometheus/querybuilder/shared/OperationParamEditor.tsx:5381": [ [0, 0, 0, "Do not use any type assertions.", "0"], - [0, 0, 0, "Do not use any type assertions.", "1"], - [0, 0, 0, "Unexpected any. Specify a different type.", "2"], - [0, 0, 0, "Do not use any type assertions.", "3"], - [0, 0, 0, "Do not use any type assertions.", "4"] + [0, 0, 0, "Do not use any type assertions.", "1"] ], "public/app/plugins/datasource/prometheus/querybuilder/shared/QueryBuilderHints.tsx:5381": [ [0, 0, 0, "Styles should be written using objects.", "0"], @@ -6962,9 +6950,6 @@ exports[`better eslint`] = { [0, 0, 0, "Unexpected any. Specify a different type.", "30"], [0, 0, 0, "Unexpected any. Specify a different type.", "31"] ], - "public/app/plugins/datasource/prometheus/result_transformer.ts:5381": [ - [0, 0, 0, "Do not use any type assertions.", "0"] - ], "public/app/plugins/datasource/prometheus/types.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"], [0, 0, 0, "Unexpected any. Specify a different type.", "1"], @@ -7037,38 +7022,35 @@ exports[`better eslint`] = { "public/app/plugins/datasource/tempo/datasource.ts:5381": [ [0, 0, 0, "Do not use any type assertions.", "0"], [0, 0, 0, "Do not use any type assertions.", "1"], - [0, 0, 0, "Do not use any type assertions.", "2"], - [0, 0, 0, "Unexpected any. Specify a different type.", "3"], + [0, 0, 0, "Unexpected any. Specify a different type.", "2"], + [0, 0, 0, "Do not use any type assertions.", "3"], [0, 0, 0, "Do not use any type assertions.", "4"], - [0, 0, 0, "Do not use any type assertions.", "5"], + [0, 0, 0, "Unexpected any. Specify a different type.", "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, "Do not use any type assertions.", "9"], [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.", "12"], [0, 0, 0, "Do not use any type assertions.", "13"], - [0, 0, 0, "Do not use any type assertions.", "14"], + [0, 0, 0, "Unexpected any. Specify a different type.", "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.", "17"] ], "public/app/plugins/datasource/tempo/language_provider.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"] ], "public/app/plugins/datasource/tempo/resultTransformer.ts:5381": [ - [0, 0, 0, "Do not use any type assertions.", "0"], - [0, 0, 0, "Unexpected any. Specify a different type.", "1"], - [0, 0, 0, "Do not use any type assertions.", "2"], - [0, 0, 0, "Unexpected any. Specify a different type.", "3"], - [0, 0, 0, "Do not use any type assertions.", "4"], - [0, 0, 0, "Unexpected any. Specify a different type.", "5"], + [0, 0, 0, "Unexpected any. Specify a different type.", "0"], + [0, 0, 0, "Do not use any type assertions.", "1"], + [0, 0, 0, "Unexpected any. Specify a different type.", "2"], + [0, 0, 0, "Do not use any type assertions.", "3"], + [0, 0, 0, "Unexpected any. Specify a different type.", "4"], + [0, 0, 0, "Do not use any type assertions.", "5"], [0, 0, 0, "Do not use any type assertions.", "6"], - [0, 0, 0, "Do not use any type assertions.", "7"], - [0, 0, 0, "Do not use any type assertions.", "8"], - [0, 0, 0, "Unexpected any. Specify a different type.", "9"] + [0, 0, 0, "Unexpected any. Specify a different type.", "7"] ], "public/app/plugins/datasource/tempo/traceql/QueryEditor.tsx:5381": [ [0, 0, 0, "Styles should be written using objects.", "0"] @@ -7101,8 +7083,7 @@ exports[`better eslint`] = { [0, 0, 0, "Unexpected any. Specify a different type.", "1"] ], "public/app/plugins/datasource/zipkin/utils/transforms.ts:5381": [ - [0, 0, 0, "Do not use any type assertions.", "0"], - [0, 0, 0, "Unexpected any. Specify a different type.", "1"] + [0, 0, 0, "Unexpected any. Specify a different type.", "0"] ], "public/app/plugins/panel/alertGroups/AlertGroup.tsx:5381": [ [0, 0, 0, "Styles should be written using objects.", "0"], @@ -7185,11 +7166,7 @@ exports[`better eslint`] = { [0, 0, 0, "Do not use any type assertions.", "1"] ], "public/app/plugins/panel/barchart/bars.ts:5381": [ - [0, 0, 0, "Do not use any type assertions.", "0"], - [0, 0, 0, "Unexpected any. Specify a different type.", "1"], - [0, 0, 0, "Do not use any type assertions.", "2"], - [0, 0, 0, "Unexpected any. Specify a different type.", "3"], - [0, 0, 0, "Do not use any type assertions.", "4"] + [0, 0, 0, "Do not use any type assertions.", "0"] ], "public/app/plugins/panel/barchart/module.tsx:5381": [ [0, 0, 0, "Do not use any type assertions.", "0"] @@ -7244,9 +7221,8 @@ exports[`better eslint`] = { [0, 0, 0, "Styles should be written using objects.", "1"] ], "public/app/plugins/panel/canvas/editor/element/elementEditor.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, "Unexpected any. Specify a different type.", "2"] + [0, 0, 0, "Do not use any type assertions.", "0"], + [0, 0, 0, "Unexpected any. Specify a different type.", "1"] ], "public/app/plugins/panel/canvas/editor/inline/InlineEdit.tsx:5381": [ [0, 0, 0, "Styles should be written using objects.", "0"], @@ -7260,10 +7236,9 @@ 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, "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"], - [0, 0, 0, "Styles should be written using objects.", "5"] + [0, 0, 0, "Do not use any type assertions.", "2"], + [0, 0, 0, "Unexpected any. Specify a different type.", "3"], + [0, 0, 0, "Styles should be written using objects.", "4"] ], "public/app/plugins/panel/canvas/editor/layer/TreeNavigationEditor.tsx:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"], @@ -7279,9 +7254,7 @@ exports[`better eslint`] = { [0, 0, 0, "Do not use any type assertions.", "0"], [0, 0, 0, "Unexpected any. Specify a different type.", "1"], [0, 0, 0, "Do not use any type assertions.", "2"], - [0, 0, 0, "Unexpected any. Specify a different type.", "3"], - [0, 0, 0, "Do not use any type assertions.", "4"], - [0, 0, 0, "Unexpected any. Specify a different type.", "5"] + [0, 0, 0, "Unexpected any. Specify a different type.", "3"] ], "public/app/plugins/panel/canvas/globalStyles.ts:5381": [ [0, 0, 0, "Styles should be written using objects.", "0"] @@ -7349,11 +7322,6 @@ exports[`better eslint`] = { [0, 0, 0, "Styles should be written using objects.", "4"], [0, 0, 0, "Styles should be written using objects.", "5"] ], - "public/app/plugins/panel/geomap/components/MeasureVectorLayer.ts:5381": [ - [0, 0, 0, "Do not use any type assertions.", "0"], - [0, 0, 0, "Do not use any type assertions.", "1"], - [0, 0, 0, "Do not use any type assertions.", "2"] - ], "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"] @@ -7387,26 +7355,9 @@ exports[`better eslint`] = { "public/app/plugins/panel/geomap/layers/basemaps/esri.ts:5381": [ [0, 0, 0, "Do not use any type assertions.", "0"] ], - "public/app/plugins/panel/geomap/layers/data/dayNightLayer.tsx:5381": [ - [0, 0, 0, "Do not use any type assertions.", "0"] - ], "public/app/plugins/panel/geomap/layers/data/geojsonDynamic.ts:5381": [ [0, 0, 0, "Do not use any type assertions.", "0"] ], - "public/app/plugins/panel/geomap/layers/data/heatMap.tsx:5381": [ - [0, 0, 0, "Do not use any type assertions.", "0"] - ], - "public/app/plugins/panel/geomap/layers/data/markersLayer.tsx:5381": [ - [0, 0, 0, "Do not use any type assertions.", "0"] - ], - "public/app/plugins/panel/geomap/layers/data/photosLayer.tsx:5381": [ - [0, 0, 0, "Do not use any type assertions.", "0"] - ], - "public/app/plugins/panel/geomap/layers/data/routeLayer.tsx:5381": [ - [0, 0, 0, "Do not use any type assertions.", "0"], - [0, 0, 0, "Do not use any type assertions.", "1"], - [0, 0, 0, "Do not use any type assertions.", "2"] - ], "public/app/plugins/panel/geomap/layers/registry.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"], [0, 0, 0, "Unexpected any. Specify a different type.", "1"] @@ -7463,356 +7414,13 @@ exports[`better eslint`] = { [0, 0, 0, "Styles should be written using objects.", "0"], [0, 0, 0, "Styles should be written using objects.", "1"] ], - "public/app/plugins/panel/graph/GraphContextMenuCtrl.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/panel/graph/GraphMigrations.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/panel/graph/Legend/Legend.tsx:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"], - [0, 0, 0, "Unexpected any. Specify a different type.", "1"], - [0, 0, 0, "Unexpected any. Specify a different type.", "2"], - [0, 0, 0, "Unexpected any. Specify a different type.", "3"], - [0, 0, 0, "Unexpected any. Specify a different type.", "4"], - [0, 0, 0, "Unexpected any. Specify a different type.", "5"], - [0, 0, 0, "Do not use any type assertions.", "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"] - ], - "public/app/plugins/panel/graph/Legend/LegendSeriesItem.tsx:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"], - [0, 0, 0, "Unexpected any. Specify a different type.", "1"], - [0, 0, 0, "Unexpected any. Specify a different type.", "2"], - [0, 0, 0, "Unexpected any. Specify a different type.", "3"], - [0, 0, 0, "Unexpected any. Specify a different type.", "4"], - [0, 0, 0, "Unexpected any. Specify a different type.", "5"], - [0, 0, 0, "Use data-testid for E2E selectors instead of aria-label", "6"], - [0, 0, 0, "Unexpected any. Specify a different type.", "7"] - ], - "public/app/plugins/panel/graph/align_yaxes.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"] - ], - "public/app/plugins/panel/graph/annotation_tooltip.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/panel/graph/axes_editor.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, "Do not use any type assertions.", "6"], - [0, 0, 0, "Unexpected any. Specify a different type.", "7"] - ], - "public/app/plugins/panel/graph/data_processor.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/panel/graph/event_editor.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/panel/graph/event_manager.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"] - ], - "public/app/plugins/panel/graph/graph.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.", "8"], - [0, 0, 0, "Unexpected any. Specify a different type.", "9"], - [0, 0, 0, "Unexpected any. Specify a different type.", "10"], - [0, 0, 0, "Unexpected any. Specify a different type.", "11"], - [0, 0, 0, "Unexpected any. Specify a different type.", "12"], - [0, 0, 0, "Unexpected any. Specify a different type.", "13"], - [0, 0, 0, "Do not use any type assertions.", "14"], - [0, 0, 0, "Unexpected any. Specify a different type.", "15"], - [0, 0, 0, "Unexpected any. Specify a different type.", "16"], - [0, 0, 0, "Unexpected any. Specify a different type.", "17"], - [0, 0, 0, "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"], - [0, 0, 0, "Unexpected any. Specify a different type.", "22"], - [0, 0, 0, "Unexpected any. Specify a different type.", "23"], - [0, 0, 0, "Unexpected any. Specify a different type.", "24"], - [0, 0, 0, "Unexpected any. Specify a different type.", "25"], - [0, 0, 0, "Unexpected any. Specify a different type.", "26"], - [0, 0, 0, "Unexpected any. Specify a different type.", "27"], - [0, 0, 0, "Unexpected any. Specify a different type.", "28"], - [0, 0, 0, "Unexpected any. Specify a different type.", "29"], - [0, 0, 0, "Unexpected any. Specify a different type.", "30"], - [0, 0, 0, "Unexpected any. Specify a different type.", "31"], - [0, 0, 0, "Unexpected any. Specify a different type.", "32"], - [0, 0, 0, "Unexpected any. Specify a different type.", "33"], - [0, 0, 0, "Unexpected any. Specify a different type.", "34"], - [0, 0, 0, "Unexpected any. Specify a different type.", "35"], - [0, 0, 0, "Unexpected any. Specify a different type.", "36"], - [0, 0, 0, "Unexpected any. Specify a different type.", "37"], - [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, "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"] - ], - "public/app/plugins/panel/graph/graph_tooltip.d.ts:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"] - ], - "public/app/plugins/panel/graph/graph_tooltip.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.", "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, "Do not use any type assertions.", "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/panel/graph/histogram.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/panel/graph/jquery.flot.events.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.", "8"], - [0, 0, 0, "Unexpected any. Specify a different type.", "9"], - [0, 0, 0, "Unexpected any. Specify a different type.", "10"], - [0, 0, 0, "Unexpected any. Specify a different type.", "11"], - [0, 0, 0, "Unexpected any. Specify a different type.", "12"], - [0, 0, 0, "Unexpected any. Specify a different type.", "13"], - [0, 0, 0, "Unexpected any. Specify a different type.", "14"], - [0, 0, 0, "Unexpected any. Specify a different type.", "15"], - [0, 0, 0, "Unexpected any. Specify a different type.", "16"], - [0, 0, 0, "Unexpected any. Specify a different type.", "17"], - [0, 0, 0, "Unexpected any. Specify a different type.", "18"], - [0, 0, 0, "Unexpected any. Specify a different type.", "19"], - [0, 0, 0, "Unexpected any. Specify a different type.", "20"], - [0, 0, 0, "Unexpected any. Specify a different type.", "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"], - [0, 0, 0, "Unexpected any. Specify a different type.", "29"], - [0, 0, 0, "Unexpected any. Specify a different type.", "30"], - [0, 0, 0, "Unexpected any. Specify a different type.", "31"], - [0, 0, 0, "Unexpected any. Specify a different type.", "32"], - [0, 0, 0, "Unexpected any. Specify a different type.", "33"], - [0, 0, 0, "Unexpected any. Specify a different type.", "34"], - [0, 0, 0, "Unexpected any. Specify a different type.", "35"], - [0, 0, 0, "Unexpected any. Specify a different type.", "36"], - [0, 0, 0, "Unexpected any. Specify a different type.", "37"], - [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, "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"] - ], - "public/app/plugins/panel/graph/module.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.", "8"], - [0, 0, 0, "Do not use any type assertions.", "9"], - [0, 0, 0, "Unexpected any. Specify a different type.", "10"], - [0, 0, 0, "Do not use any type assertions.", "11"], - [0, 0, 0, "Unexpected any. Specify a different type.", "12"], - [0, 0, 0, "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"], - [0, 0, 0, "Unexpected any. Specify a different type.", "20"], - [0, 0, 0, "Unexpected any. Specify a different type.", "21"] - ], - "public/app/plugins/panel/graph/series_overrides_ctrl.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/panel/graph/specs/data_processor.test.ts:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"] - ], - "public/app/plugins/panel/graph/specs/graph.test.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.", "8"], - [0, 0, 0, "Unexpected any. Specify a different type.", "9"], - [0, 0, 0, "Unexpected any. Specify a different type.", "10"] - ], - "public/app/plugins/panel/graph/specs/graph_ctrl.test.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"] - ], - "public/app/plugins/panel/graph/specs/graph_tooltip.test.ts:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"] - ], - "public/app/plugins/panel/graph/specs/histogram.test.ts:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"] - ], - "public/app/plugins/panel/graph/specs/series_override_ctrl.test.ts:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"] - ], - "public/app/plugins/panel/graph/specs/threshold_manager.test.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.", "8"] - ], - "public/app/plugins/panel/graph/specs/time_region_manager.test.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.", "8"], - [0, 0, 0, "Unexpected any. Specify a different type.", "9"], - [0, 0, 0, "Unexpected any. Specify a different type.", "10"], - [0, 0, 0, "Unexpected any. Specify a different type.", "11"], - [0, 0, 0, "Unexpected any. Specify a different type.", "12"], - [0, 0, 0, "Unexpected any. Specify a different type.", "13"], - [0, 0, 0, "Unexpected any. Specify a different type.", "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/panel/graph/threshold_manager.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.", "8"], - [0, 0, 0, "Do not use any type assertions.", "9"], - [0, 0, 0, "Unexpected any. Specify a different type.", "10"], - [0, 0, 0, "Unexpected any. Specify a different type.", "11"], - [0, 0, 0, "Unexpected any. Specify a different type.", "12"], - [0, 0, 0, "Unexpected any. Specify a different type.", "13"], - [0, 0, 0, "Unexpected any. Specify a different type.", "14"] - ], - "public/app/plugins/panel/graph/thresholds_form.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/panel/graph/time_region_manager.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"] - ], - "public/app/plugins/panel/graph/time_regions_form.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"] - ], "public/app/plugins/panel/heatmap/HeatmapPanel.tsx:5381": [ [0, 0, 0, "Do not use any type assertions.", "0"], - [0, 0, 0, "Do not use any type assertions.", "1"], - [0, 0, 0, "Do not use any type assertions.", "2"], - [0, 0, 0, "Do not use any type assertions.", "3"], - [0, 0, 0, "Unexpected any. Specify a different type.", "4"], - [0, 0, 0, "Styles should be written using objects.", "5"] + [0, 0, 0, "Unexpected any. Specify a different type.", "1"], + [0, 0, 0, "Styles should be written using objects.", "2"] ], "public/app/plugins/panel/heatmap/migrations.ts:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"], - [0, 0, 0, "Do not use any type assertions.", "1"], - [0, 0, 0, "Unexpected any. Specify a different type.", "2"] + [0, 0, 0, "Unexpected any. Specify a different type.", "0"] ], "public/app/plugins/panel/heatmap/module.tsx:5381": [ [0, 0, 0, "Do not use any type assertions.", "0"], @@ -7854,28 +7462,17 @@ exports[`better eslint`] = { ], "public/app/plugins/panel/live/LiveChannelEditor.tsx:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"], - [0, 0, 0, "Do not use any type assertions.", "1"], - [0, 0, 0, "Do not use any type assertions.", "2"], - [0, 0, 0, "Do not use any type assertions.", "3"], - [0, 0, 0, "Do not use any type assertions.", "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, "Do not use any type assertions.", "8"], - [0, 0, 0, "Do not use any type assertions.", "9"], - [0, 0, 0, "Styles should be written using objects.", "10"] + [0, 0, 0, "Styles should be written using objects.", "1"] ], "public/app/plugins/panel/live/LivePanel.tsx:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"], - [0, 0, 0, "Unexpected any. Specify a different type.", "1"], - [0, 0, 0, "Do not use any type assertions.", "2"], + [0, 0, 0, "Do not use any type assertions.", "0"], + [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.", "7"] ], "public/app/plugins/panel/live/types.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"] @@ -7906,8 +7503,7 @@ exports[`better eslint`] = { ], "public/app/plugins/panel/nodeGraph/Legend.tsx:5381": [ [0, 0, 0, "Styles should be written using objects.", "0"], - [0, 0, 0, "Styles should be written using objects.", "1"], - [0, 0, 0, "Do not use any type assertions.", "2"] + [0, 0, 0, "Styles should be written using objects.", "1"] ], "public/app/plugins/panel/nodeGraph/Marker.tsx:5381": [ [0, 0, 0, "Styles should be written using objects.", "0"], @@ -8014,9 +7610,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.", "8"] ], "public/app/plugins/panel/table-old/module.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"], @@ -8037,12 +7631,7 @@ exports[`better eslint`] = { [0, 0, 0, "Unexpected any. Specify a different type.", "15"], [0, 0, 0, "Unexpected any. Specify a different type.", "16"], [0, 0, 0, "Unexpected any. Specify a different type.", "17"], - [0, 0, 0, "Unexpected any. Specify a different type.", "18"], - [0, 0, 0, "Unexpected any. Specify a different type.", "19"], - [0, 0, 0, "Unexpected any. Specify a different type.", "20"], - [0, 0, 0, "Do not use any type assertions.", "21"], - [0, 0, 0, "Do not use any type assertions.", "22"], - [0, 0, 0, "Unexpected any. Specify a different type.", "23"] + [0, 0, 0, "Unexpected any. Specify a different type.", "18"] ], "public/app/plugins/panel/table-old/renderer.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"], @@ -8051,17 +7640,13 @@ exports[`better eslint`] = { [0, 0, 0, "Unexpected any. Specify a different type.", "3"], [0, 0, 0, "Unexpected any. Specify a different type.", "4"], [0, 0, 0, "Unexpected any. Specify a different type.", "5"], - [0, 0, 0, "Unexpected any. Specify a different type.", "6"], - [0, 0, 0, "Do not use any type assertions.", "7"], + [0, 0, 0, "Do not use any type assertions.", "6"], + [0, 0, 0, "Unexpected any. Specify a different type.", "7"], [0, 0, 0, "Unexpected any. Specify a different type.", "8"], [0, 0, 0, "Unexpected any. Specify a different type.", "9"], [0, 0, 0, "Unexpected any. Specify a different type.", "10"], [0, 0, 0, "Unexpected any. Specify a different type.", "11"], - [0, 0, 0, "Unexpected any. Specify a different type.", "12"], - [0, 0, 0, "Unexpected any. Specify a different type.", "13"], - [0, 0, 0, "Unexpected any. Specify a different type.", "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.", "12"] ], "public/app/plugins/panel/table-old/transformers.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"], @@ -8072,9 +7657,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.", "8"] ], "public/app/plugins/panel/table-old/types.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"], @@ -8099,14 +7682,12 @@ exports[`better eslint`] = { [0, 0, 0, "Styles should be written using objects.", "0"] ], "public/app/plugins/panel/table/migrations.ts:5381": [ - [0, 0, 0, "Do not use any type assertions.", "0"], + [0, 0, 0, "Unexpected any. Specify a different type.", "0"], [0, 0, 0, "Unexpected any. Specify a different type.", "1"], [0, 0, 0, "Unexpected any. Specify a different type.", "2"], [0, 0, 0, "Unexpected any. Specify a different type.", "3"], [0, 0, 0, "Unexpected any. Specify a different type.", "4"], - [0, 0, 0, "Unexpected any. Specify a different type.", "5"], - [0, 0, 0, "Unexpected any. Specify a different type.", "6"], - [0, 0, 0, "Unexpected any. Specify a different type.", "7"] + [0, 0, 0, "Unexpected any. Specify a different type.", "5"] ], "public/app/plugins/panel/text/TextPanel.tsx:5381": [ [0, 0, 0, "Styles should be written using objects.", "0"], @@ -8134,12 +7715,8 @@ exports[`better eslint`] = { [0, 0, 0, "Unexpected any. Specify a different type.", "7"], [0, 0, 0, "Do not use any type assertions.", "8"], [0, 0, 0, "Unexpected any. Specify a different type.", "9"], - [0, 0, 0, "Do not use any type assertions.", "10"], - [0, 0, 0, "Unexpected any. Specify a different type.", "11"], - [0, 0, 0, "Do not use any type assertions.", "12"], - [0, 0, 0, "Unexpected any. Specify a different type.", "13"], - [0, 0, 0, "Unexpected any. Specify a different type.", "14"], - [0, 0, 0, "Unexpected any. Specify a different type.", "15"] + [0, 0, 0, "Unexpected any. Specify a different type.", "10"], + [0, 0, 0, "Unexpected any. Specify a different type.", "11"] ], "public/app/plugins/panel/timeseries/plugins/ExemplarMarker.tsx:5381": [ [0, 0, 0, "Use data-testid for E2E selectors instead of aria-label", "0"], diff --git a/.betterer.ts b/.betterer.ts index 85499ca3419..4b57b973e4d 100644 --- a/.betterer.ts +++ b/.betterer.ts @@ -4,11 +4,19 @@ import { ESLint, Linter } from 'eslint'; import path from 'path'; import { glob } from 'glob'; +// Why are we ignoring these? +// They're all deprecated/being removed soon so doesn't make sense to fix types +const eslintPathsToIgnore = [ + 'packages/grafana-e2e', // deprecated. + 'public/app/angular', // will be removed in Grafana 11 + 'public/app/plugins/panel/graph', // will be removed alongside angular +]; + export default { 'better eslint': () => countEslintErrors() .include('**/*.{ts,tsx}') - .exclude(/public\/app\/angular|packages\/grafana-e2e/), + .exclude(new RegExp(eslintPathsToIgnore.join('|'))), 'no undocumented stories': () => countUndocumentedStories().include('**/!(*.internal).story.tsx'), }; diff --git a/public/app/features/alerting/unified/components/Expression.test.tsx b/public/app/features/alerting/unified/components/Expression.test.tsx index e35fe163176..a1bfebc72b2 100644 --- a/public/app/features/alerting/unified/components/Expression.test.tsx +++ b/public/app/features/alerting/unified/components/Expression.test.tsx @@ -43,7 +43,7 @@ const rulesSource = { baseUrl: 'public/app/plugins/datasource/prometheus', }, url: '/api/datasources/proxy/5', - access: 'proxy' as 'proxy', + access: 'proxy' as const, jsonData: { manageAlerts: true, }, diff --git a/public/app/plugins/datasource/prometheus/query_hints.ts b/public/app/plugins/datasource/prometheus/query_hints.ts index b895a25df64..82498f7f4c7 100644 --- a/public/app/plugins/datasource/prometheus/query_hints.ts +++ b/public/app/plugins/datasource/prometheus/query_hints.ts @@ -25,7 +25,7 @@ export function getQueryHints(query: string, series?: any[], datasource?: Promet type: 'ADD_HISTOGRAM_QUANTILE', query, }, - } as QueryFix, + }, }); } @@ -110,7 +110,7 @@ export function getQueryHints(query: string, series?: any[], datasource?: Promet query, options: mappingForQuery, }, - } as unknown as QueryFix, + }, }); } } @@ -128,7 +128,7 @@ export function getQueryHints(query: string, series?: any[], datasource?: Promet query: query, preventSubmit: true, }, - } as QueryFix, + }, }); } } diff --git a/public/app/plugins/datasource/prometheus/querybuilder/components/LabelParamEditor.tsx b/public/app/plugins/datasource/prometheus/querybuilder/components/LabelParamEditor.tsx index bca29531682..5256fcd4e07 100644 --- a/public/app/plugins/datasource/prometheus/querybuilder/components/LabelParamEditor.tsx +++ b/public/app/plugins/datasource/prometheus/querybuilder/components/LabelParamEditor.tsx @@ -17,7 +17,7 @@ export function LabelParamEditor({ datasource, }: QueryBuilderOperationParamEditorProps) { const [state, setState] = useState<{ - options?: Array>; + options?: SelectableValue[]; isLoading?: boolean; }>({}); @@ -42,10 +42,7 @@ export function LabelParamEditor({ ); } -async function loadGroupByLabels( - query: PromVisualQuery, - datasource: DataSourceApi -): Promise>> { +async function loadGroupByLabels(query: PromVisualQuery, datasource: DataSourceApi): Promise { let labels: QueryBuilderLabelFilter[] = query.labels; // This function is used by both Prometheus and Loki and this the only difference. diff --git a/public/app/plugins/datasource/prometheus/querybuilder/components/PromQueryBuilderContainer.tsx b/public/app/plugins/datasource/prometheus/querybuilder/components/PromQueryBuilderContainer.tsx index b33058f8263..70786203ead 100644 --- a/public/app/plugins/datasource/prometheus/querybuilder/components/PromQueryBuilderContainer.tsx +++ b/public/app/plugins/datasource/prometheus/querybuilder/components/PromQueryBuilderContainer.tsx @@ -82,9 +82,13 @@ export function PromQueryBuilderContainer(props: Props) { ); } +const initialState: State = { + expr: '', +}; + const stateSlice = createSlice({ name: 'prom-builder-container', - initialState: { expr: '' } as State, + initialState, reducers: { visualQueryChange: (state, action: PayloadAction<{ visQuery: PromVisualQuery; expr: string }>) => { state.expr = action.payload.expr; diff --git a/public/app/plugins/datasource/prometheus/querybuilder/shared/OperationParamEditor.tsx b/public/app/plugins/datasource/prometheus/querybuilder/shared/OperationParamEditor.tsx index e0e8673670b..0a30ea0bff1 100644 --- a/public/app/plugins/datasource/prometheus/querybuilder/shared/OperationParamEditor.tsx +++ b/public/app/plugins/datasource/prometheus/querybuilder/shared/OperationParamEditor.tsx @@ -53,7 +53,7 @@ function BoolInputParamEditor(props: QueryBuilderOperationParamEditorProps) { return ( props.onChange(props.index, evt.currentTarget.checked)} /> ); @@ -67,12 +67,12 @@ function SelectInputParamEditor({ onChange, }: QueryBuilderOperationParamEditorProps) { const styles = useStyles2(getStyles); - let selectOptions = paramDef.options as Array>; + let selectOptions = paramDef.options as SelectableValue[]; if (!selectOptions[0]?.label) { selectOptions = paramDef.options!.map((option) => ({ label: option.toString(), - value: option as string, + value: option, })); } diff --git a/public/app/plugins/datasource/prometheus/result_transformer.ts b/public/app/plugins/datasource/prometheus/result_transformer.ts index 1a87a0f6124..94ce874ba23 100644 --- a/public/app/plugins/datasource/prometheus/result_transformer.ts +++ b/public/app/plugins/datasource/prometheus/result_transformer.ts @@ -15,7 +15,6 @@ import { formatLabels, getDisplayProcessor, Labels, - PreferredVisualisationType, ScopedVars, TIME_SERIES_TIME_FIELD_NAME, TIME_SERIES_VALUE_FIELD_NAME, @@ -249,7 +248,7 @@ export function transformDFToTable(dfs: DataFrame[]): DataFrame[] { // Prometheus specific UI for instant queries meta: { ...dataFramesByRefId[refId][0].meta, - preferredVisualisationType: 'rawPrometheus' as PreferredVisualisationType, + preferredVisualisationType: 'rawPrometheus' as const, }, length: timeField.values.length, }; diff --git a/public/app/plugins/datasource/tempo/datasource.ts b/public/app/plugins/datasource/tempo/datasource.ts index 2f9b63fae36..9019cca45d1 100644 --- a/public/app/plugins/datasource/tempo/datasource.ts +++ b/public/app/plugins/datasource/tempo/datasource.ts @@ -164,7 +164,7 @@ export class TempoDatasource extends DataSourceWithBackend> { await this.languageProvider.fetchTags(); const tags = this.languageProvider.getAutocompleteTags(); - return tags.filter((tag) => tag !== undefined).map((tag) => ({ text: tag })) as Array<{ text: string }>; + return tags.filter((tag) => tag !== undefined).map((tag) => ({ text: tag })); } async labelValuesQuery(labelName?: string): Promise> { diff --git a/public/app/plugins/datasource/tempo/resultTransformer.ts b/public/app/plugins/datasource/tempo/resultTransformer.ts index 6f78a049c8c..08c86e59cdc 100644 --- a/public/app/plugins/datasource/tempo/resultTransformer.ts +++ b/public/app/plugins/datasource/tempo/resultTransformer.ts @@ -85,7 +85,7 @@ export function createTableFrame( const line = values[i]; if (line) { for (let traceRegex of traceRegexs) { - const match = (line as string).match(traceRegex); + const match = line.match(traceRegex); if (match) { const traceId = match[1]; const time = timeField ? timeField.values[i] : null; @@ -274,7 +274,7 @@ export function transformFromOTLP( tags: getSpanTags(span), logs: getLogs(span), references: getReferences(span), - } as TraceSpanRow); + }); } } } diff --git a/public/app/plugins/datasource/zipkin/utils/transforms.ts b/public/app/plugins/datasource/zipkin/utils/transforms.ts index 81e40508e3f..0ecc391a39f 100644 --- a/public/app/plugins/datasource/zipkin/utils/transforms.ts +++ b/public/app/plugins/datasource/zipkin/utils/transforms.ts @@ -1,5 +1,3 @@ -import { identity } from 'lodash'; - import { DataFrame, FieldType, MutableDataFrame, TraceKeyValuePair, TraceLog, TraceSpanRow } from '@grafana/data'; import { ZipkinAnnotation, ZipkinEndpoint, ZipkinSpan } from '../types'; @@ -116,7 +114,7 @@ function serviceTags(span: ZipkinSpan): TraceKeyValuePair[] { valueToTag('ipv6', endpoint.ipv6), valueToTag('port', endpoint.port), valueToTag('endpointType', span.localEndpoint ? 'local' : 'remote'), - ].filter(identity) as TraceKeyValuePair[]; + ].filter((item): item is TraceKeyValuePair => Boolean(item)); } function valueToTag(key: string, value: T): TraceKeyValuePair | undefined { diff --git a/public/app/plugins/panel/barchart/bars.ts b/public/app/plugins/panel/barchart/bars.ts index 5d270cd0651..be528a04794 100644 --- a/public/app/plugins/panel/barchart/bars.ts +++ b/public/app/plugins/panel/barchart/bars.ts @@ -526,10 +526,9 @@ export function getConfig(opts: BarsOptions, theme: GrafanaTheme2) { }); if (isStacked) { - //barsPctLayout = [null as any].concat(distrOne(u.data.length - 1, u.data[0].length)); - barsPctLayout = [null as any].concat(distrOne(u.data[0].length, u.data.length - 1)); + barsPctLayout = [null, ...distrOne(u.data[0].length, u.data.length - 1)]; } else { - barsPctLayout = [null as any].concat(distrTwo(u.data[0].length, u.data.length - 1)); + barsPctLayout = [null, ...distrTwo(u.data[0].length, u.data.length - 1)]; } if (useMappedColors) { diff --git a/public/app/plugins/panel/canvas/editor/element/elementEditor.tsx b/public/app/plugins/panel/canvas/editor/element/elementEditor.tsx index 9f5070708b3..a78e6ac0fae 100644 --- a/public/app/plugins/panel/canvas/editor/element/elementEditor.tsx +++ b/public/app/plugins/panel/canvas/editor/element/elementEditor.tsx @@ -36,10 +36,10 @@ export function getElementEditor(opts: CanvasEditorOptions): NestedPanelOptions< // Note that canvas editor writes things to the scene! values: (parent: NestedValueAccess) => ({ - getValue: (path: string) => { + getValue: (path) => { return lodashGet(opts.element.options, path); }, - onChange: (path: string, value: any) => { + onChange: (path, value) => { let options = opts.element.options; if (path === 'type' && value) { const layer = canvasElementRegistry.getIfExists(value); diff --git a/public/app/plugins/panel/canvas/editor/inline/InlineEditBody.tsx b/public/app/plugins/panel/canvas/editor/inline/InlineEditBody.tsx index d805996cc6b..44d4954ad18 100644 --- a/public/app/plugins/panel/canvas/editor/inline/InlineEditBody.tsx +++ b/public/app/plugins/panel/canvas/editor/inline/InlineEditBody.tsx @@ -37,7 +37,7 @@ export function InlineEditBody() { return new OptionsPaneCategoryDescriptor({ id: 'root', title: 'root' }); } - const supplier = (builder: PanelOptionsEditorBuilder, context: StandardEditorContext) => { + const supplier = (builder: PanelOptionsEditorBuilder) => { if (activeTab === InlineEditTabs.ElementManagement) { builder.addNestedOptions(getLayerEditor(instanceState)); } diff --git a/public/app/plugins/panel/canvas/editor/layer/layerEditor.tsx b/public/app/plugins/panel/canvas/editor/layer/layerEditor.tsx index f98c03c3818..5a8bc1257c2 100644 --- a/public/app/plugins/panel/canvas/editor/layer/layerEditor.tsx +++ b/public/app/plugins/panel/canvas/editor/layer/layerEditor.tsx @@ -22,7 +22,7 @@ export function getLayerEditor(opts: InstanceState): NestedPanelOptions ({ - getValue: (path: string) => { + getValue: (path) => { return lodashGet(options, path); }, - onChange: (path: string, value: any) => { + onChange: (path, value) => { if (path === 'type' && value) { console.warn('unable to change layer type'); return; diff --git a/public/app/plugins/panel/geomap/components/MeasureVectorLayer.ts b/public/app/plugins/panel/geomap/components/MeasureVectorLayer.ts index 402282d3c94..0c6dc3ea15f 100644 --- a/public/app/plugins/panel/geomap/components/MeasureVectorLayer.ts +++ b/public/app/plugins/panel/geomap/components/MeasureVectorLayer.ts @@ -174,21 +174,19 @@ export class MeasureVectorLayer extends VectorLayer { styleFunction(feature: FeatureLike, segments: boolean, drawType?: string, tip?: string): Style[] { const styles = [...this.shapeStyle]; - const geometry = feature.getGeometry() as Geometry; + const geometry = feature.getGeometry(); if (geometry) { const type = geometry.getType(); let point: Point; let label: string; let line: LineString; if (!drawType || drawType === type) { - if (type === 'Polygon') { - const poly = geometry as Polygon; - point = poly.getInteriorPoint(); + if (type === 'Polygon' && geometry instanceof Polygon) { + point = geometry.getInteriorPoint(); label = this.getMapMeasurement(geometry); - line = new LineString(poly.getCoordinates()[0]); - } else if (type === 'LineString') { - line = geometry as LineString; - point = new Point(line.getLastCoordinate()); + line = new LineString(geometry.getCoordinates()[0]); + } else if (type === 'LineString' && geometry instanceof LineString) { + point = new Point(geometry.getLastCoordinate()); label = this.getMapMeasurement(geometry); } } @@ -212,7 +210,12 @@ export class MeasureVectorLayer extends VectorLayer { this.labelStyle.getText().setText(label); styles.push(this.labelStyle); } - if (tip && type === 'Point' && !this.modify.getOverlay().getSource().getFeatures().length) { + if ( + tip && + type === 'Point' && + geometry instanceof Point && + !this.modify.getOverlay().getSource().getFeatures().length + ) { this.tipPoint = geometry; this.tipStyle.getText().setText(tip); styles.push(this.tipStyle); diff --git a/public/app/plugins/panel/geomap/layers/data/dayNightLayer.tsx b/public/app/plugins/panel/geomap/layers/data/dayNightLayer.tsx index ae937a62911..fe50748812d 100644 --- a/public/app/plugins/panel/geomap/layers/data/dayNightLayer.tsx +++ b/public/app/plugins/panel/geomap/layers/data/dayNightLayer.tsx @@ -163,7 +163,7 @@ export const dayNightLayer: MapLayerRegistryItem = { if (false) { subscriptions.add( eventBus.subscribe(DataHoverEvent, (event) => { - const time = event.payload?.point?.time as number; + const time: number = event.payload?.point?.time; if (time) { const lineTime = new Date(time); const nightLinePoints = sourceLine.getCoordinates(lineTime.toString(), 'line'); diff --git a/public/app/plugins/panel/geomap/layers/data/heatMap.tsx b/public/app/plugins/panel/geomap/layers/data/heatMap.tsx index 96bb66e2377..9ac42690507 100644 --- a/public/app/plugins/panel/geomap/layers/data/heatMap.tsx +++ b/public/app/plugins/panel/geomap/layers/data/heatMap.tsx @@ -50,7 +50,7 @@ export const heatmapLayer: MapLayerRegistryItem = { */ create: async (map: Map, options: MapLayerOptions, eventBus: EventBus, theme: GrafanaTheme2) => { const config = { ...defaultOptions, ...options.config }; - + const location = await getLocationMatchers(options.location); const source = new FrameVectorSource(location); const WEIGHT_KEY = "_weight"; @@ -77,7 +77,7 @@ export const heatmapLayer: MapLayerRegistryItem = { const weightDim = getScaledDimension(frame, config.weight); source.forEachFeature( (f) => { - const idx = f.get('rowIndex') as number; + const idx: number = f.get('rowIndex'); if(idx != null) { f.set(WEIGHT_KEY, weightDim.get(idx)); } diff --git a/public/app/plugins/panel/geomap/layers/data/markersLayer.tsx b/public/app/plugins/panel/geomap/layers/data/markersLayer.tsx index 8d128ab4880..fa838bbd810 100644 --- a/public/app/plugins/panel/geomap/layers/data/markersLayer.tsx +++ b/public/app/plugins/panel/geomap/layers/data/markersLayer.tsx @@ -89,7 +89,7 @@ export const markersLayer: MapLayerRegistryItem = { vectorLayer.setStyle(style.maker(style.base)); } else { vectorLayer.setStyle((feature: FeatureLike) => { - const idx = feature.get('rowIndex') as number; + const idx: number = feature.get('rowIndex'); const dims = style.dims; if (!dims || !isNumber(idx)) { return style.maker(style.base); diff --git a/public/app/plugins/panel/geomap/layers/data/photosLayer.tsx b/public/app/plugins/panel/geomap/layers/data/photosLayer.tsx index b545aea88e7..014f77b2b61 100644 --- a/public/app/plugins/panel/geomap/layers/data/photosLayer.tsx +++ b/public/app/plugins/panel/geomap/layers/data/photosLayer.tsx @@ -96,7 +96,7 @@ export const photosLayer: MapLayerRegistryItem = { let src = unknownImage; let idx = Infinity; if (images.length > 0) { - idx = feature.get('rowIndex') as number; + idx = feature.get('rowIndex'); src = images[idx] ?? unknownImage; } const photoStyle = new Style({ diff --git a/public/app/plugins/panel/geomap/layers/data/routeLayer.tsx b/public/app/plugins/panel/geomap/layers/data/routeLayer.tsx index 29f698b48c5..e52dd28a272 100644 --- a/public/app/plugins/panel/geomap/layers/data/routeLayer.tsx +++ b/public/app/plugins/panel/geomap/layers/data/routeLayer.tsx @@ -98,7 +98,7 @@ export const routeLayer: MapLayerRegistryItem = { vectorLayer.setStyle(styleBase); } else { vectorLayer.setStyle((feature: FeatureLike) => { - const idx = feature.get('rowIndex') as number; + const idx: number = feature.get('rowIndex'); const dims = style.dims; if (!dims || !isNumber(idx)) { return routeStyle(style.base); @@ -223,8 +223,8 @@ export const routeLayer: MapLayerRegistryItem = { .subscribe({ next: (event) => { const feature = source.getFeatures()[0]; - const frame = feature?.get('frame') as DataFrame; - const time = event.payload?.point?.time as number; + const frame: DataFrame = feature?.get('frame'); + const time: number = event.payload?.point?.time; if (frame && time) { const timeField = frame.fields.find((f) => f.name === TIME_SERIES_TIME_FIELD_NAME); if (timeField) { diff --git a/public/app/plugins/panel/heatmap/HeatmapPanel.tsx b/public/app/plugins/panel/heatmap/HeatmapPanel.tsx index 174733c64a8..281ddd19f91 100644 --- a/public/app/plugins/panel/heatmap/HeatmapPanel.tsx +++ b/public/app/plugins/panel/heatmap/HeatmapPanel.tsx @@ -83,8 +83,8 @@ export const HeatmapPanel = ({ }, [data.series, data.annotations, options, palette, theme, getFieldLinksSupplier, replaceVariables]); const facets = useMemo(() => { - let exemplarsXFacet: number[] = []; // "Time" field - let exemplarsyFacet: number[] = []; + let exemplarsXFacet: number[] | undefined = []; // "Time" field + let exemplarsyFacet: Array = []; const meta = readHeatmapRowsCustomMeta(info.heatmap); if (info.exemplars?.length && meta.yMatchWithLabel) { @@ -95,9 +95,9 @@ export const HeatmapPanel = ({ if (hasLabeledY) { let matchExemplarsBy = info.exemplars?.fields.find((field) => field.name === meta.yMatchWithLabel)!.values; - exemplarsyFacet = matchExemplarsBy.map((label) => meta.yOrdinalLabel?.indexOf(label)) as number[]; + exemplarsyFacet = matchExemplarsBy.map((label) => meta.yOrdinalLabel?.indexOf(label)); } else { - exemplarsyFacet = info.exemplars?.fields[1].values as number[]; // "Value" field + exemplarsyFacet = info.exemplars?.fields[1].values; // "Value" field } } @@ -134,8 +134,7 @@ export const HeatmapPanel = ({ dataRef.current = info; const builder = useMemo(() => { - const scaleConfig = dataRef.current?.heatmap?.fields[1].config?.custom - ?.scaleDistribution as ScaleDistributionConfig; + const scaleConfig: ScaleDistributionConfig = dataRef.current?.heatmap?.fields[1].config?.custom?.scaleDistribution; return prepConfig({ dataRef, diff --git a/public/app/plugins/panel/heatmap/migrations.ts b/public/app/plugins/panel/heatmap/migrations.ts index c11035db4f0..4771f7850fa 100644 --- a/public/app/plugins/panel/heatmap/migrations.ts +++ b/public/app/plugins/panel/heatmap/migrations.ts @@ -129,7 +129,7 @@ export function angularToReactHeatmap(angular: any): { fieldConfig: FieldConfigS case 'spectrum': { options.color.mode = HeatmapColorMode.Scheme; - const current = color.colorScheme as string; + const current: string = color.colorScheme; let scheme = colorSchemes.find((v) => v.name === current); if (!scheme) { scheme = colorSchemes.find((v) => current.indexOf(v.name) >= 0); @@ -168,7 +168,7 @@ function getHeatmapCellLayout(v?: string): HeatmapCellLayout { return HeatmapCellLayout.auto; } -function asNumber(v: any, defaultValue?: number): number | undefined { +function asNumber(v: unknown, defaultValue?: number): number | undefined { if (v == null || v === '') { return defaultValue; } diff --git a/public/app/plugins/panel/live/LiveChannelEditor.tsx b/public/app/plugins/panel/live/LiveChannelEditor.tsx index ff7176dd66c..02a49f6974d 100644 --- a/public/app/plugins/panel/live/LiveChannelEditor.tsx +++ b/public/app/plugins/panel/live/LiveChannelEditor.tsx @@ -13,7 +13,7 @@ import { config } from 'app/core/config'; import { LivePanelOptions } from './types'; -type Props = StandardEditorProps; +type Props = StandardEditorProps, any, LivePanelOptions>; const scopes: Array> = [ { label: 'Grafana', value: LiveChannelScope.Grafana, description: 'Core grafana live features' }, @@ -53,34 +53,27 @@ export class LiveChannelEditor extends PureComponent { if (v.value) { this.props.onChange({ scope: v.value, - namespace: undefined as unknown as string, - path: undefined as unknown as string, - } as LiveChannelAddress); + namespace: undefined, + path: undefined, + }); } }; onNamespaceChanged = (v: SelectableValue) => { - const update = { + this.props.onChange({ scope: this.props.value?.scope, - path: undefined as unknown as string, - } as LiveChannelAddress; - - if (v.value) { - update.namespace = v.value; - } - this.props.onChange(update); + namespace: v.value, + path: undefined, + }); }; onPathChanged = (v: SelectableValue) => { const { value, onChange } = this.props; - const update = { + onChange({ scope: value.scope, namespace: value.namespace, - } as LiveChannelAddress; - if (v.value) { - update.path = v.value; - } - onChange(update); + path: v.value, + }); }; render() { diff --git a/public/app/plugins/panel/live/LivePanel.tsx b/public/app/plugins/panel/live/LivePanel.tsx index 1c42227c33c..ed9f0b48ecb 100644 --- a/public/app/plugins/panel/live/LivePanel.tsx +++ b/public/app/plugins/panel/live/LivePanel.tsx @@ -28,10 +28,10 @@ import { LivePanelOptions, MessageDisplayMode } from './types'; interface Props extends PanelProps {} interface State { - error?: any; + error?: unknown; addr?: LiveChannelAddress; status?: LiveChannelStatusEvent; - message?: any; + message?: unknown; changed: number; } diff --git a/public/app/plugins/panel/nodeGraph/Legend.tsx b/public/app/plugins/panel/nodeGraph/Legend.tsx index 98c9f03d815..75984b1c102 100644 --- a/public/app/plugins/panel/nodeGraph/Legend.tsx +++ b/public/app/plugins/panel/nodeGraph/Legend.tsx @@ -1,5 +1,4 @@ import { css } from '@emotion/css'; -import { identity } from 'lodash'; import React, { useCallback } from 'react'; import { Field, FieldColorModeId, GrafanaTheme2 } from '@grafana/data'; @@ -74,7 +73,9 @@ function getColorLegendItems(nodes: NodeDatum[], theme: GrafanaTheme2): Array => + Boolean(item) + ); const node = nodes.find((n) => n.arcSections.length > 0); if (node) { diff --git a/public/app/plugins/panel/table-old/editor.ts b/public/app/plugins/panel/table-old/editor.ts index e6cb416ee54..c8e5e1d9686 100644 --- a/public/app/plugins/panel/table-old/editor.ts +++ b/public/app/plugins/panel/table-old/editor.ts @@ -58,7 +58,7 @@ export class TablePanelEditorCtrl { addColumn() { const columns = transformers[this.panel.transform].getColumns(this.panelCtrl.dataRaw); - const column: any = find(columns, { text: this.addColumnSegment.value }); + const column = find(columns, { text: this.addColumnSegment.value }); if (column) { this.panel.columns.push(column); @@ -94,7 +94,7 @@ export class TablePanelEditorCtrl { } } -export function tablePanelEditor(uiSegmentSrv: any) { +export function tablePanelEditor() { 'use strict'; return { restrict: 'E', diff --git a/public/app/plugins/panel/table-old/module.ts b/public/app/plugins/panel/table-old/module.ts index 71bf0cf2db3..e6fa9c8ca75 100644 --- a/public/app/plugins/panel/table-old/module.ts +++ b/public/app/plugins/panel/table-old/module.ts @@ -1,8 +1,7 @@ import $ from 'jquery'; import { defaults } from 'lodash'; -import { ComponentType } from 'react'; -import { isTableData, PanelEvents, PanelPlugin, PanelProps } from '@grafana/data'; +import { isTableData, PanelEvents, PanelPlugin } from '@grafana/data'; import config from 'app/core/config'; import { applyFilterFromTable } from 'app/features/variables/adhoc/actions'; import { MetricsPanelCtrl } from 'app/plugins/sdk'; @@ -23,7 +22,7 @@ export class TablePanelCtrl extends MetricsPanelCtrl { panelHasRowColorMode: boolean; panelHasLinks: boolean; - panelDefaults: any = { + panelDefaults = { targets: [{}], transform: 'timeseries_to_columns', pageSize: null, @@ -243,7 +242,7 @@ export class TablePanelCtrl extends MetricsPanelCtrl { selector: '[data-link-tooltip]', }); - function addFilterClicked(e: any) { + function addFilterClicked(e: JQueryEventObject) { const filterData = $(e.currentTarget).data(); const options = { datasource: panel.datasource, @@ -274,6 +273,6 @@ export class TablePanelCtrl extends MetricsPanelCtrl { } } -export const plugin = new PanelPlugin(null as unknown as ComponentType>); +export const plugin = new PanelPlugin(null); plugin.angularPanelCtrl = TablePanelCtrl; plugin.setNoPadding(); diff --git a/public/app/plugins/panel/table-old/renderer.ts b/public/app/plugins/panel/table-old/renderer.ts index e769862b1b9..01bcc409e74 100644 --- a/public/app/plugins/panel/table-old/renderer.ts +++ b/public/app/plugins/panel/table-old/renderer.ts @@ -21,7 +21,7 @@ import { ColumnRender, TableRenderModel, ColumnStyle } from './types'; export class TableRenderer { formatters: any[] = []; - colorState: any; + colorState: Record = {}; constructor( private panel: { styles: ColumnStyle[]; pageSize: number }, @@ -136,7 +136,7 @@ export class TableRenderer { } if (column.style.type === 'string') { - return (v: any): any => { + return (v: any) => { if (isArray(v)) { v = v.join(', '); } @@ -192,7 +192,7 @@ export class TableRenderer { if (column.style.type === 'number') { const valueFormatter = getValueFormat(column.unit || column.style.unit); - return (v: any): any => { + return (v: any) => { if (v === null || v === void 0) { return '-'; } @@ -211,7 +211,7 @@ export class TableRenderer { }; } - setColorState(value: any, style: ColumnStyle) { + setColorState(value: unknown, style: ColumnStyle) { if (!style.colorMode) { return; } diff --git a/public/app/plugins/panel/table-old/transformers.ts b/public/app/plugins/panel/table-old/transformers.ts index 5411ce4705d..0c8b0c61a0c 100644 --- a/public/app/plugins/panel/table-old/transformers.ts +++ b/public/app/plugins/panel/table-old/transformers.ts @@ -175,7 +175,7 @@ transformers['table'] = { const filteredData = tableDataFormatFilterer(data); // Track column indexes: name -> index - const columnNames: any = {}; + const columnNames: Record = {}; // Union of all columns const columns = filteredData.reduce((acc: Column[], series: TableData) => { @@ -216,7 +216,7 @@ transformers['json'] = { return []; } - const names: any = {}; + const names: Record = {}; for (let i = 0; i < data.length; i++) { const series = data[i]; if (series.type !== 'docs') { diff --git a/public/app/plugins/panel/table/migrations.ts b/public/app/plugins/panel/table/migrations.ts index fa3fefaa063..f05ec19e051 100644 --- a/public/app/plugins/panel/table/migrations.ts +++ b/public/app/plugins/panel/table/migrations.ts @@ -21,7 +21,7 @@ import { Options } from './panelcfg.gen'; */ export const tableMigrationHandler = (panel: PanelModel): Partial => { // Table was saved as an angular table, lets just swap to the 'table-old' panel - if (!panel.pluginVersion && (panel as any).columns) { + if (!panel.pluginVersion && 'columns' in panel) { console.log('Was angular table', panel); } diff --git a/public/app/plugins/panel/timeseries/migrations.ts b/public/app/plugins/panel/timeseries/migrations.ts index 792851b7502..fa138cd89a7 100644 --- a/public/app/plugins/panel/timeseries/migrations.ts +++ b/public/app/plugins/panel/timeseries/migrations.ts @@ -649,8 +649,7 @@ function fillY2DynamicValues( props: DynamicConfigValue[] ) { // The standard properties - for (const key of Object.keys(y2)) { - const value = (y2 as any)[key]; + for (const [key, value] of Object.entries(y2)) { if (key !== 'custom' && value !== (y1 as any)[key]) { props.push({ id: key, @@ -662,8 +661,7 @@ function fillY2DynamicValues( // Add any custom property const y1G = y1.custom ?? {}; const y2G = y2.custom ?? {}; - for (const key of Object.keys(y2G)) { - const value = (y2G as any)[key]; + for (const [key, value] of Object.entries(y2G)) { if (value !== (y1G as any)[key]) { props.push({ id: `custom.${key}`,