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
This commit is contained in:
Ashley Harrison 2023-10-06 11:48:15 +01:00 committed by GitHub
parent d8357342a3
commit 171e2c1adb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
32 changed files with 137 additions and 562 deletions

View File

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

View File

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

View File

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

View File

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

View File

@ -17,7 +17,7 @@ export function LabelParamEditor({
datasource,
}: QueryBuilderOperationParamEditorProps) {
const [state, setState] = useState<{
options?: Array<SelectableValue<any>>;
options?: SelectableValue[];
isLoading?: boolean;
}>({});
@ -42,10 +42,7 @@ export function LabelParamEditor({
);
}
async function loadGroupByLabels(
query: PromVisualQuery,
datasource: DataSourceApi
): Promise<Array<SelectableValue<any>>> {
async function loadGroupByLabels(query: PromVisualQuery, datasource: DataSourceApi): Promise<SelectableValue[]> {
let labels: QueryBuilderLabelFilter[] = query.labels;
// This function is used by both Prometheus and Loki and this the only difference.

View File

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

View File

@ -53,7 +53,7 @@ function BoolInputParamEditor(props: QueryBuilderOperationParamEditorProps) {
return (
<Checkbox
id={getOperationParamId(props.operationId, props.index)}
value={props.value as boolean}
value={Boolean(props.value)}
onChange={(evt) => 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<SelectableValue<any>>;
let selectOptions = paramDef.options as SelectableValue[];
if (!selectOptions[0]?.label) {
selectOptions = paramDef.options!.map((option) => ({
label: option.toString(),
value: option as string,
value: option,
}));
}

View File

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

View File

@ -164,7 +164,7 @@ export class TempoDatasource extends DataSourceWithBackend<TempoQuery, TempoJson
async labelNamesQuery(): Promise<Array<{ text: string }>> {
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<Array<{ text: string }>> {

View File

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

View File

@ -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<T>(key: string, value: T): TraceKeyValuePair<T> | undefined {

View File

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

View File

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

View File

@ -37,7 +37,7 @@ export function InlineEditBody() {
return new OptionsPaneCategoryDescriptor({ id: 'root', title: 'root' });
}
const supplier = (builder: PanelOptionsEditorBuilder<any>, context: StandardEditorContext<any>) => {
const supplier = (builder: PanelOptionsEditorBuilder<any>) => {
if (activeTab === InlineEditTabs.ElementManagement) {
builder.addNestedOptions(getLayerEditor(instanceState));
}

View File

@ -22,7 +22,7 @@ export function getLayerEditor(opts: InstanceState): NestedPanelOptions<LayerEdi
const { selected, scene } = opts;
if (!scene.currentLayer) {
scene.currentLayer = scene.root as FrameState;
scene.currentLayer = scene.root;
}
if (selected) {
@ -47,10 +47,10 @@ export function getLayerEditor(opts: InstanceState): NestedPanelOptions<LayerEdi
// Note that canvas editor writes things to the scene!
values: (parent: NestedValueAccess) => ({
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;

View File

@ -174,21 +174,19 @@ export class MeasureVectorLayer extends VectorLayer<VectorSource> {
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<VectorSource> {
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);

View File

@ -163,7 +163,7 @@ export const dayNightLayer: MapLayerRegistryItem<DayNightConfig> = {
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');

View File

@ -50,7 +50,7 @@ export const heatmapLayer: MapLayerRegistryItem<HeatmapConfig> = {
*/
create: async (map: Map, options: MapLayerOptions<HeatmapConfig>, eventBus: EventBus, theme: GrafanaTheme2) => {
const config = { ...defaultOptions, ...options.config };
const location = await getLocationMatchers(options.location);
const source = new FrameVectorSource<Point>(location);
const WEIGHT_KEY = "_weight";
@ -77,7 +77,7 @@ export const heatmapLayer: MapLayerRegistryItem<HeatmapConfig> = {
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));
}

View File

@ -89,7 +89,7 @@ export const markersLayer: MapLayerRegistryItem<MarkersConfig> = {
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);

View File

@ -96,7 +96,7 @@ export const photosLayer: MapLayerRegistryItem<PhotoConfig> = {
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({

View File

@ -98,7 +98,7 @@ export const routeLayer: MapLayerRegistryItem<RouteConfig> = {
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<RouteConfig> = {
.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) {

View File

@ -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<number | undefined> = [];
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,

View File

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

View File

@ -13,7 +13,7 @@ import { config } from 'app/core/config';
import { LivePanelOptions } from './types';
type Props = StandardEditorProps<LiveChannelAddress, any, LivePanelOptions>;
type Props = StandardEditorProps<Partial<LiveChannelAddress>, any, LivePanelOptions>;
const scopes: Array<SelectableValue<LiveChannelScope>> = [
{ label: 'Grafana', value: LiveChannelScope.Grafana, description: 'Core grafana live features' },
@ -53,34 +53,27 @@ export class LiveChannelEditor extends PureComponent<Props, State> {
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<string>) => {
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<string>) => {
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() {

View File

@ -28,10 +28,10 @@ import { LivePanelOptions, MessageDisplayMode } from './types';
interface Props extends PanelProps<LivePanelOptions> {}
interface State {
error?: any;
error?: unknown;
addr?: LiveChannelAddress;
status?: LiveChannelStatusEvent;
message?: any;
message?: unknown;
changed: number;
}

View File

@ -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<Vi
if (!nodes.length) {
return [];
}
const fields = [nodes[0].mainStat, nodes[0].secondaryStat].filter(identity) as Field[];
const fields = [nodes[0].mainStat, nodes[0].secondaryStat].filter((item): item is NonNullable<typeof item> =>
Boolean(item)
);
const node = nodes.find((n) => n.arcSections.length > 0);
if (node) {

View File

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

View File

@ -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<PanelProps<any>>);
export const plugin = new PanelPlugin(null);
plugin.angularPanelCtrl = TablePanelCtrl;
plugin.setNoPadding();

View File

@ -21,7 +21,7 @@ import { ColumnRender, TableRenderModel, ColumnStyle } from './types';
export class TableRenderer {
formatters: any[] = [];
colorState: any;
colorState: Record<string, string | null> = {};
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;
}

View File

@ -175,7 +175,7 @@ transformers['table'] = {
const filteredData = tableDataFormatFilterer(data);
// Track column indexes: name -> index
const columnNames: any = {};
const columnNames: Record<string, number> = {};
// 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<string, boolean> = {};
for (let i = 0; i < data.length; i++) {
const series = data[i];
if (series.type !== 'docs') {

View File

@ -21,7 +21,7 @@ import { Options } from './panelcfg.gen';
*/
export const tableMigrationHandler = (panel: PanelModel<Options>): Partial<Options> => {
// 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);
}

View File

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