diff --git a/.betterer.results b/.betterer.results index 9cbe7c612b7..fcfce0cf94b 100644 --- a/.betterer.results +++ b/.betterer.results @@ -44,9 +44,6 @@ exports[`better eslint`] = { [0, 0, 0, "Do not use any type assertions.", "3"], [0, 0, 0, "Do not use any type assertions.", "4"] ], - "packages/grafana-data/src/dataframe/dimensions.ts:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"] - ], "packages/grafana-data/src/dataframe/processDataFrame.test.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"] ], @@ -73,9 +70,7 @@ exports[`better eslint`] = { [0, 0, 0, "Do not use any type assertions.", "19"] ], "packages/grafana-data/src/datetime/datemath.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, "Do not use any type assertions.", "0"] ], "packages/grafana-data/src/datetime/durationutil.ts:5381": [ [0, 0, 0, "Do not use any type assertions.", "0"] @@ -91,32 +86,22 @@ exports[`better eslint`] = { [0, 0, 0, "Do not use any type assertions.", "7"], [0, 0, 0, "Do not use any type assertions.", "8"] ], - "packages/grafana-data/src/events/EventBus.ts:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"], - [0, 0, 0, "Unexpected any. Specify a different type.", "1"] - ], "packages/grafana-data/src/events/types.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"], [0, 0, 0, "Unexpected any. Specify a different type.", "1"], - [0, 0, 0, "Unexpected any. Specify a different type.", "2"], - [0, 0, 0, "Unexpected any. Specify a different type.", "3"], - [0, 0, 0, "Unexpected any. Specify a different type.", "4"] + [0, 0, 0, "Unexpected any. Specify a different type.", "2"] ], "packages/grafana-data/src/field/displayProcessor.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"] ], - "packages/grafana-data/src/field/fieldState.ts:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"] - ], "packages/grafana-data/src/field/overrides/processors.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.", "4"] ], "packages/grafana-data/src/field/standardFieldConfigEditorRegistry.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"], @@ -128,8 +113,7 @@ exports[`better eslint`] = { [0, 0, 0, "Unexpected any. Specify a different type.", "6"] ], "packages/grafana-data/src/geo/layer.ts:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"], - [0, 0, 0, "Unexpected any. Specify a different type.", "1"] + [0, 0, 0, "Unexpected any. Specify a different type.", "0"] ], "packages/grafana-data/src/panel/PanelPlugin.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"], @@ -159,9 +143,6 @@ exports[`better eslint`] = { "packages/grafana-data/src/themes/createColors.ts:5381": [ [0, 0, 0, "Do not use any type assertions.", "0"] ], - "packages/grafana-data/src/transformations/fieldReducer.ts:5381": [ - [0, 0, 0, "Do not use any type assertions.", "0"] - ], "packages/grafana-data/src/transformations/matchers/valueMatchers/types.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"], [0, 0, 0, "Unexpected any. Specify a different type.", "1"] @@ -172,9 +153,6 @@ exports[`better eslint`] = { "packages/grafana-data/src/transformations/transformDataFrame.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"] ], - "packages/grafana-data/src/transformations/transformers/joinDataFrames.ts:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"] - ], "packages/grafana-data/src/transformations/transformers/nulls/nullInsertThreshold.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"], [0, 0, 0, "Unexpected any. Specify a different type.", "1"] @@ -959,48 +937,6 @@ exports[`better eslint`] = { [0, 0, 0, "Do not use any type assertions.", "0"], [0, 0, 0, "Unexpected any. Specify a different type.", "1"] ], - "packages/grafana-ui/src/graveyard/Graph/Graph.tsx:5381": [ - [0, 0, 0, "No untranslated strings. Wrap text with ", "0"] - ], - "packages/grafana-ui/src/graveyard/Graph/GraphContextMenu.tsx:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"] - ], - "packages/grafana-ui/src/graveyard/Graph/utils.ts:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"] - ], - "packages/grafana-ui/src/graveyard/GraphNG/GraphNG.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, "Do not use any type assertions.", "5"], - [0, 0, 0, "Do not use any type assertions.", "6"], - [0, 0, 0, "Do not use any type assertions.", "7"], - [0, 0, 0, "Unexpected any. Specify a different type.", "8"], - [0, 0, 0, "Do not use any type assertions.", "9"], - [0, 0, 0, "Do not use any type assertions.", "10"], - [0, 0, 0, "Do not use any type assertions.", "11"] - ], - "packages/grafana-ui/src/graveyard/GraphNG/hooks.ts:5381": [ - [0, 0, 0, "Do not use any type assertions.", "0"] - ], - "packages/grafana-ui/src/graveyard/GraphNG/nullInsertThreshold.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.", "2"], - [0, 0, 0, "Unexpected any. Specify a different type.", "3"] - ], - "packages/grafana-ui/src/graveyard/GraphNG/nullToUndefThreshold.ts:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"], - [0, 0, 0, "Unexpected any. Specify a different type.", "1"], - [0, 0, 0, "Do not use any type assertions.", "2"] - ], - "packages/grafana-ui/src/graveyard/TimeSeries/utils.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"] - ], "packages/grafana-ui/src/options/builder/hideSeries.tsx:5381": [ [0, 0, 0, "Do not use any type assertions.", "0"] ], @@ -1225,10 +1161,7 @@ exports[`better eslint`] = { ], "public/app/core/components/TagFilter/TagFilter.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, "No untranslated strings. Wrap text with ", "4"] + [0, 0, 0, "No untranslated strings. Wrap text with ", "1"] ], "public/app/core/components/TimeSeries/utils.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"], @@ -2784,10 +2717,6 @@ exports[`better eslint`] = { [0, 0, 0, "No untranslated strings. Wrap text with ", "2"], [0, 0, 0, "No untranslated strings. Wrap text with ", "3"] ], - "public/app/features/dashboard-scene/saving/DashboardSceneChangeTracker.test.ts:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"], - [0, 0, 0, "Unexpected any. Specify a different type.", "1"] - ], "public/app/features/dashboard-scene/saving/SaveDashboardAsForm.tsx:5381": [ [0, 0, 0, "No untranslated strings. Wrap text with ", "0"], [0, 0, 0, "No untranslated strings. Wrap text with ", "1"], @@ -2824,9 +2753,6 @@ exports[`better eslint`] = { "public/app/features/dashboard-scene/scene/DashboardControls.tsx:5381": [ [0, 0, 0, "Do not use any type assertions.", "0"] ], - "public/app/features/dashboard-scene/scene/NavToolbarActions.test.tsx:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"] - ], "public/app/features/dashboard-scene/scene/NavToolbarActions.tsx:5381": [ [0, 0, 0, "No untranslated strings. Wrap text with ", "0"], [0, 0, 0, "No untranslated strings. Wrap text with ", "1"], @@ -2863,28 +2789,10 @@ exports[`better eslint`] = { "public/app/features/dashboard-scene/serialization/buildNewDashboardSaveModel.ts:5381": [ [0, 0, 0, "Do not use any type assertions.", "0"] ], - "public/app/features/dashboard-scene/serialization/transformSaveModelToScene.test.ts:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"], - [0, 0, 0, "Unexpected any. Specify a different type.", "1"], - [0, 0, 0, "Unexpected any. Specify a different type.", "2"], - [0, 0, 0, "Unexpected any. Specify a different type.", "3"] - ], "public/app/features/dashboard-scene/serialization/transformSceneToSaveModel.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.", "2"] ], "public/app/features/dashboard-scene/serialization/transformSceneToSaveModel.ts:5381": [ [0, 0, 0, "Do not use any type assertions.", "0"], @@ -3196,16 +3104,14 @@ exports[`better eslint`] = { ], "public/app/features/dashboard/components/PanelEditor/getVisualizationOptions.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.", "1"] ], "public/app/features/dashboard/components/PanelEditor/utils.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"], - [0, 0, 0, "Unexpected any. Specify a different type.", "1"], - [0, 0, 0, "Do not use any type assertions.", "2"], - [0, 0, 0, "Unexpected any. Specify a different type.", "3"], - [0, 0, 0, "Do not use any type assertions.", "4"], - [0, 0, 0, "Unexpected any. Specify a different type.", "5"] + [0, 0, 0, "Do not use any type assertions.", "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"] ], "public/app/features/dashboard/components/PublicDashboardNotAvailable/PublicDashboardNotAvailable.tsx:5381": [ [0, 0, 0, "No untranslated strings. Wrap text with ", "0"] @@ -3244,21 +3150,17 @@ exports[`better eslint`] = { [0, 0, 0, "No untranslated strings. Wrap text with ", "1"], [0, 0, 0, "No untranslated strings. Wrap text with ", "2"] ], - "public/app/features/dashboard/components/SaveDashboard/forms/SaveDashboardAsForm.test.tsx:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"] - ], "public/app/features/dashboard/components/SaveDashboard/forms/SaveDashboardAsForm.tsx:5381": [ [0, 0, 0, "No untranslated strings. Wrap text with ", "0"], [0, 0, 0, "No untranslated strings. Wrap text with ", "1"], [0, 0, 0, "No untranslated strings. Wrap text with ", "2"] ], "public/app/features/dashboard/components/SaveDashboard/forms/SaveDashboardForm.tsx:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"], + [0, 0, 0, "Use data-testid for E2E selectors instead of aria-label", "0"], [0, 0, 0, "Use data-testid for E2E selectors instead of aria-label", "1"], - [0, 0, 0, "Use data-testid for E2E selectors instead of aria-label", "2"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "3"], - [0, 0, 0, "Use data-testid for E2E selectors instead of aria-label", "4"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "5"] + [0, 0, 0, "No untranslated strings. Wrap text with ", "2"], + [0, 0, 0, "Use data-testid for E2E selectors instead of aria-label", "3"], + [0, 0, 0, "No untranslated strings. Wrap text with ", "4"] ], "public/app/features/dashboard/components/SaveDashboard/forms/SaveProvisionedDashboardForm.tsx:5381": [ [0, 0, 0, "\'HorizontalGroup\' import from \'@grafana/ui\' is restricted from being used by a pattern. Use Stack component instead.", "0"], @@ -3271,9 +3173,6 @@ exports[`better eslint`] = { [0, 0, 0, "No untranslated strings. Wrap text with ", "7"], [0, 0, 0, "No untranslated strings. Wrap text with ", "8"] ], - "public/app/features/dashboard/components/SaveDashboard/types.ts:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"] - ], "public/app/features/dashboard/components/SaveDashboard/useDashboardSave.tsx:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"] ], @@ -3365,9 +3264,6 @@ exports[`better eslint`] = { "public/app/features/dashboard/containers/SoloPanelPage.tsx:5381": [ [0, 0, 0, "No untranslated strings. Wrap text with ", "0"] ], - "public/app/features/dashboard/dashgrid/PanelStateWrapper.tsx:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"] - ], "public/app/features/dashboard/dashgrid/SeriesVisibilityConfigFactory.ts:5381": [ [0, 0, 0, "Do not use any type assertions.", "0"] ], @@ -3754,8 +3650,7 @@ exports[`better eslint`] = { [0, 0, 0, "Do not use export all (\`export * from ...\`)", "7"] ], "public/app/features/dimensions/scale.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.", "0"] ], "public/app/features/dimensions/types.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"] @@ -4775,10 +4670,7 @@ exports[`better eslint`] = { [0, 0, 0, "Unexpected any. Specify a different type.", "0"] ], "public/app/features/panel/panellinks/link_srv.ts:5381": [ - [0, 0, 0, "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.", "0"] ], "public/app/features/playlist/PlaylistForm.tsx:5381": [ [0, 0, 0, "Use data-testid for E2E selectors instead of aria-label", "0"], @@ -4971,15 +4863,9 @@ exports[`better eslint`] = { [0, 0, 0, "Unexpected any. Specify a different type.", "1"], [0, 0, 0, "Do not use any type assertions.", "2"], [0, 0, 0, "Unexpected any. Specify a different type.", "3"], - [0, 0, 0, "Unexpected any. Specify a different type.", "4"], + [0, 0, 0, "Do not use any type assertions.", "4"], [0, 0, 0, "Unexpected any. Specify a different type.", "5"], - [0, 0, 0, "Unexpected any. Specify a different type.", "6"], - [0, 0, 0, "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, "Do not use any type assertions.", "6"] ], "public/app/features/plugins/extensions/usePluginComponents.tsx:5381": [ [0, 0, 0, "Do not use any type assertions.", "0"] @@ -7497,65 +7383,6 @@ exports[`no gf-form usage`] = { [0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"], [0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"] ], - "packages/grafana-ui/src/themes/GlobalStyles/forms.ts:5381": [ - [0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"], - [0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"], - [0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"], - [0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"], - [0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"], - [0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"], - [0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"], - [0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"], - [0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"], - [0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"], - [0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"], - [0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"], - [0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"], - [0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"], - [0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"], - [0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"], - [0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"], - [0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"], - [0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"], - [0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"], - [0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"], - [0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"], - [0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"], - [0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"], - [0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"], - [0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"] - ], - "packages/grafana-ui/src/themes/GlobalStyles/legacySelect.ts:5381": [ - [0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"], - [0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"], - [0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"], - [0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"], - [0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"], - [0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"], - [0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"], - [0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"], - [0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"], - [0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"], - [0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"], - [0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"], - [0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"], - [0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"], - [0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"], - [0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"], - [0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"], - [0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"], - [0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"], - [0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"], - [0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"], - [0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"], - [0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"], - [0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"], - [0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"], - [0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"], - [0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"], - [0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"], - [0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"] - ], "public/app/angular/components/PageHeader/PageHeader.tsx:5381": [ [0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"], [0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"] diff --git a/.betterer.ts b/.betterer.ts index 6b92c439de6..305b6c35961 100644 --- a/.betterer.ts +++ b/.betterer.ts @@ -7,9 +7,10 @@ import { glob } from 'glob'; // Why are we ignoring these? // They're all deprecated/being removed so doesn't make sense to fix types const eslintPathsToIgnore = [ - 'public/app/angular', // will be removed in Grafana 11 - 'public/app/plugins/panel/graph', // will be removed alongside angular - 'public/app/plugins/panel/table-old', // will be removed alongside angular + 'packages/grafana-ui/src/graveyard', // will be removed alongside angular in Grafana 12 + 'public/app/angular', // will be removed in Grafana 12 + 'public/app/plugins/panel/graph', // will be removed alongside angular in Grafana 12 + 'public/app/plugins/panel/table-old', // will be removed alongside angular in Grafana 12 'e2e/test-plugins', ]; @@ -21,10 +22,9 @@ export default { .exclude(new RegExp(eslintPathsToIgnore.join('|'))), 'no undocumented stories': () => countUndocumentedStories().include('**/!(*.internal).story.tsx'), 'no gf-form usage': () => - regexp( - /gf-form/gm, - 'gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.' - ).include('**/*.{ts,tsx,html}'), + regexp(/gf-form/gm, 'gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.') + .include('**/*.{ts,tsx,html}') + .exclude(new RegExp('packages/grafana-ui/src/themes/GlobalStyles')), }; function countUndocumentedStories() { diff --git a/packages/grafana-data/src/dataframe/dimensions.ts b/packages/grafana-data/src/dataframe/dimensions.ts index 80058770514..82222fe6ccd 100644 --- a/packages/grafana-data/src/dataframe/dimensions.ts +++ b/packages/grafana-data/src/dataframe/dimensions.ts @@ -1,7 +1,7 @@ import { KeyValue } from '../types/data'; import { Field } from '../types/dataFrame'; -export interface Dimension { +export interface Dimension { // Name of the dimension name: string; // Collection of fields representing dimension @@ -12,28 +12,28 @@ export interface Dimension { columns: Array>; } -export type Dimensions = KeyValue; +export type Dimensions = KeyValue>; -export const createDimension = (name: string, columns: Field[]): Dimension => { +export const createDimension = (name: string, columns: Array>): Dimension => { return { name, columns, }; }; -export const getColumnsFromDimension = (dimension: Dimension) => { +export const getColumnsFromDimension = (dimension: Dimension) => { return dimension.columns; }; -export const getColumnFromDimension = (dimension: Dimension, column: number) => { +export const getColumnFromDimension = (dimension: Dimension, column: number) => { return dimension.columns[column]; }; -export const getValueFromDimension = (dimension: Dimension, column: number, row: number) => { +export const getValueFromDimension = (dimension: Dimension, column: number, row: number) => { return dimension.columns[column].values[row]; }; -export const getAllValuesFromDimension = (dimension: Dimension, column: number, row: number) => { +export const getAllValuesFromDimension = (dimension: Dimension, column: number, row: number) => { return dimension.columns.map((c) => c.values[row]); }; -export const getDimensionByName = (dimensions: Dimensions, name: string) => dimensions[name]; +export const getDimensionByName = (dimensions: Dimensions, name: string) => dimensions[name]; diff --git a/packages/grafana-data/src/datetime/datemath.ts b/packages/grafana-data/src/datetime/datemath.ts index 0aedd4934b5..8ebf5c99269 100644 --- a/packages/grafana-data/src/datetime/datemath.ts +++ b/packages/grafana-data/src/datetime/datemath.ts @@ -2,7 +2,15 @@ import { includes, isDate } from 'lodash'; import { TimeZone } from '../types/time'; -import { DateTime, dateTime, dateTimeForTimeZone, DurationUnit, isDateTime, ISO_8601 } from './moment_wrapper'; +import { + DateTime, + dateTime, + dateTimeAsMoment, + dateTimeForTimeZone, + DurationUnit, + isDateTime, + ISO_8601, +} from './moment_wrapper'; const units: DurationUnit[] = ['y', 'M', 'w', 'd', 'h', 'm', 's', 'Q']; @@ -51,10 +59,10 @@ export function parse( // We got some non string which is not a moment nor Date. TS should be able to check for that but not always. return undefined; } else { - let time; + let time: DateTime; let mathString = ''; - let index; - let parseString; + let index = -1; + let parseString = ''; if (text.substring(0, 3) === 'now') { time = dateTimeForTimeZone(timezone); @@ -104,10 +112,9 @@ export function isValid(text: string | DateTime): boolean { * @param time * @param roundUp If true it will round the time to endOf time unit, otherwise to startOf time unit. */ -// TODO: Had to revert Andrejs `time: moment.Moment` to `time: any` export function parseDateMath( mathString: string, - time: any, + time: DateTime, roundUp?: boolean, fiscalYearStartMonth = 0 ): DateTime | undefined { @@ -187,21 +194,21 @@ export function parseDateMath( return result; } -export function roundToFiscal(fyStartMonth: number, dateTime: any, unit: string, roundUp: boolean | undefined) { +export function roundToFiscal(fyStartMonth: number, dateTime: DateTime, unit: string, roundUp: boolean | undefined) { switch (unit) { case 'y': if (roundUp) { - roundToFiscal(fyStartMonth, dateTime, unit, false).add(11, 'M').endOf('M'); + roundToFiscal(fyStartMonth, dateTime, unit, false)?.add(11, 'M').endOf('M'); } else { - dateTime.subtract((dateTime.month() - fyStartMonth + 12) % 12, 'M').startOf('M'); + dateTime.subtract((dateTimeAsMoment(dateTime).month() - fyStartMonth + 12) % 12, 'M').startOf('M'); } return dateTime; case 'Q': if (roundUp) { - roundToFiscal(fyStartMonth, dateTime, unit, false).add(2, 'M').endOf('M'); + roundToFiscal(fyStartMonth, dateTime, unit, false)?.add(2, 'M').endOf('M'); } else { // why + 12? to ensure this number is always a positive offset from fyStartMonth - dateTime.subtract((dateTime.month() - fyStartMonth + 12) % 3, 'M').startOf('M'); + dateTime.subtract((dateTimeAsMoment(dateTime).month() - fyStartMonth + 12) % 3, 'M').startOf('M'); } return dateTime; default: diff --git a/packages/grafana-data/src/events/EventBus.ts b/packages/grafana-data/src/events/EventBus.ts index b155319ecc1..cdcd16b2e89 100644 --- a/packages/grafana-data/src/events/EventBus.ts +++ b/packages/grafana-data/src/events/EventBus.ts @@ -1,3 +1,4 @@ +import { IScope } from 'angular'; import EventEmitter from 'eventemitter3'; import { Unsubscribable, Observable, Subscriber } from 'rxjs'; import { filter } from 'rxjs/operators'; @@ -55,7 +56,7 @@ export class EventBusSrv implements EventBus, LegacyEmitter { /** * Legacy functions */ - emit(event: AppEvent | string, payload?: T | any): void { + emit(event: AppEvent | string, payload?: T): void { // console.log(`Deprecated emitter function used (emit), use $emit`); if (typeof event === 'string') { @@ -65,7 +66,7 @@ export class EventBusSrv implements EventBus, LegacyEmitter { } } - on(event: AppEvent | string, handler: LegacyEventHandler, scope?: any) { + on(event: AppEvent | string, handler: LegacyEventHandler, scope?: IScope) { // console.log(`Deprecated emitter function used (on), use $on`); // need this wrapper to make old events compatible with old handlers diff --git a/packages/grafana-data/src/events/types.ts b/packages/grafana-data/src/events/types.ts index f5e111eb2fc..ad4fec0a025 100644 --- a/packages/grafana-data/src/events/types.ts +++ b/packages/grafana-data/src/events/types.ts @@ -1,3 +1,4 @@ +import { IScope } from 'angular'; import { Unsubscribable, Observable } from 'rxjs'; /** @@ -128,12 +129,12 @@ export interface LegacyEmitter { /** * @deprecated use $on */ - on(event: AppEvent | string, handler: LegacyEventHandler, scope?: any): void; + on(event: AppEvent | string, handler: LegacyEventHandler, scope?: IScope): void; /** * @deprecated use $on */ - off(event: AppEvent | string, handler: (payload?: T | any) => void): void; + off(event: AppEvent | string, handler: (payload?: T) => void): void; } /** @public */ diff --git a/packages/grafana-data/src/field/fieldState.ts b/packages/grafana-data/src/field/fieldState.ts index 2ec8942fcfe..3ddaebbda63 100644 --- a/packages/grafana-data/src/field/fieldState.ts +++ b/packages/grafana-data/src/field/fieldState.ts @@ -64,7 +64,7 @@ export function cacheFieldDisplayNames(frames: DataFrame[]) { * moves each field's config.custom.hideFrom to field.state.hideFrom * and mutates orgiginal field.config.custom.hideFrom to one with explicit overrides only, (without the ad-hoc stateful __system override from legend toggle) */ -export function decoupleHideFromState(frames: DataFrame[], fieldConfig: FieldConfigSource) { +export function decoupleHideFromState(frames: DataFrame[], fieldConfig: FieldConfigSource) { frames.forEach((frame) => { frame.fields.forEach((field) => { const hideFrom = { diff --git a/packages/grafana-data/src/field/overrides/processors.ts b/packages/grafana-data/src/field/overrides/processors.ts index ee396ebba01..9846c1c3ef3 100644 --- a/packages/grafana-data/src/field/overrides/processors.ts +++ b/packages/grafana-data/src/field/overrides/processors.ts @@ -19,7 +19,7 @@ export interface NumberFieldConfigSettings { } export const numberOverrideProcessor = ( - value: any, + value: unknown, context: FieldOverrideContext, settings?: NumberFieldConfigSettings ) => { @@ -27,7 +27,7 @@ export const numberOverrideProcessor = ( return undefined; } - return parseFloat(value); + return parseFloat(String(value)); }; export const displayNameOverrideProcessor = ( diff --git a/packages/grafana-data/src/geo/layer.ts b/packages/grafana-data/src/geo/layer.ts index 0c4f4ac7799..18ed9b6a6df 100644 --- a/packages/grafana-data/src/geo/layer.ts +++ b/packages/grafana-data/src/geo/layer.ts @@ -42,7 +42,7 @@ export interface MapLayerHandler { */ registerOptionsUI?: ( builder: PanelOptionsEditorBuilder>, - context: StandardEditorContext + context: StandardEditorContext> ) => void; } diff --git a/packages/grafana-data/src/transformations/fieldReducer.ts b/packages/grafana-data/src/transformations/fieldReducer.ts index 0205ce30dee..a032619aeb3 100644 --- a/packages/grafana-data/src/transformations/fieldReducer.ts +++ b/packages/grafana-data/src/transformations/fieldReducer.ts @@ -423,7 +423,7 @@ const buildPercentileReducers = (percentiles = [...Array.from({ length: 99 }, (_ percentiles.forEach((p) => { const percentile = p / 100; - const id = `p${p}` as ReducerID; + const id = `p${p}`; const name = `${p}${nth(p)} %`; const description = `${p}${nth(p)} percentile value`; diff --git a/packages/grafana-data/src/transformations/transformers/joinDataFrames.ts b/packages/grafana-data/src/transformations/transformers/joinDataFrames.ts index 6f8f592f36c..98f28ff9fce 100644 --- a/packages/grafana-data/src/transformations/transformers/joinDataFrames.ts +++ b/packages/grafana-data/src/transformations/transformers/joinDataFrames.ts @@ -546,7 +546,7 @@ export function join(tables: AlignedData[], nullModes?: number[][], mode: JoinMo // Test a few samples to see if the values are ascending // Only exported for tests -export function isLikelyAscendingVector(data: any[], samples = 50) { +export function isLikelyAscendingVector(data: unknown[], samples = 50) { const len = data.length; // empty or single value @@ -576,7 +576,7 @@ export function isLikelyAscendingVector(data: any[], samples = 50) { for (let prevVal = data[firstIdx], i = firstIdx + stride; i <= lastIdx; i += stride) { const v = data[i]; - if (v != null) { + if (v != null && prevVal != null) { if (v <= prevVal) { return false; } diff --git a/public/app/core/components/TagFilter/TagFilter.tsx b/public/app/core/components/TagFilter/TagFilter.tsx index fd2f40566ac..f7afcc9387d 100644 --- a/public/app/core/components/TagFilter/TagFilter.tsx +++ b/public/app/core/components/TagFilter/TagFilter.tsx @@ -2,7 +2,7 @@ import { css } from '@emotion/css'; import { useCallback, useEffect, useMemo, useState } from 'react'; import { components, MultiValueRemoveProps } from 'react-select'; -import { escapeStringForRegex, GrafanaTheme2 } from '@grafana/data'; +import { escapeStringForRegex, GrafanaTheme2, SelectableValue } from '@grafana/data'; import { Icon, MultiSelect, useStyles2 } from '@grafana/ui'; import { t } from 'app/core/internationalization'; @@ -28,9 +28,9 @@ export interface Props { width?: number; } -const filterOption = (option: any, searchQuery: string) => { +const filterOption = (option: SelectableValue, searchQuery: string) => { const regex = RegExp(escapeStringForRegex(searchQuery), 'i'); - return regex.test(option.value); + return Boolean(option.value && regex.test(option.value)); }; export const TagFilter = ({ @@ -124,8 +124,8 @@ export const TagFilter = ({ formatCreateLabel, defaultOptions: true, filterOption, - getOptionLabel: (i: any) => i.label, - getOptionValue: (i: any) => i.value, + getOptionLabel: (i: SelectableValue) => i.label, + getOptionValue: (i: SelectableValue) => i.value, inputId, isMulti: true, onChange: onTagChange, diff --git a/public/app/features/dashboard-scene/saving/DashboardSceneChangeTracker.test.ts b/public/app/features/dashboard-scene/saving/DashboardSceneChangeTracker.test.ts index 474907a347f..80dbb4e3cb3 100644 --- a/public/app/features/dashboard-scene/saving/DashboardSceneChangeTracker.test.ts +++ b/public/app/features/dashboard-scene/saving/DashboardSceneChangeTracker.test.ts @@ -25,11 +25,11 @@ describe('DashboardSceneChangeTracker', () => { () => ({ terminate, - }) as any + }) as unknown as CorsWorker ); const changeTracker = new DashboardSceneChangeTracker({ subscribeToEvent: jest.fn().mockReturnValue({ unsubscribe: jest.fn() }), - } as any); + } as unknown as DashboardScene); changeTracker.startTrackingChanges(); expect(changeTracker['_changesWorker']).not.toBeUndefined(); diff --git a/public/app/features/dashboard-scene/scene/NavToolbarActions.test.tsx b/public/app/features/dashboard-scene/scene/NavToolbarActions.test.tsx index af7d4d4a858..22c2acde4fa 100644 --- a/public/app/features/dashboard-scene/scene/NavToolbarActions.test.tsx +++ b/public/app/features/dashboard-scene/scene/NavToolbarActions.test.tsx @@ -28,7 +28,7 @@ jest.mock('app/features/playlist/PlaylistSrv', () => ({ })); jest.mock('@grafana/runtime', () => ({ - ...jest.requireActual>('@grafana/runtime'), + ...jest.requireActual('@grafana/runtime'), getDataSourceSrv: () => ({ get: jest.fn(), getInstanceSettings: jest.fn().mockReturnValue({ diff --git a/public/app/features/dashboard-scene/serialization/transformSaveModelToScene.test.ts b/public/app/features/dashboard-scene/serialization/transformSaveModelToScene.test.ts index e5c7ab36bca..868dfd24768 100644 --- a/public/app/features/dashboard-scene/serialization/transformSaveModelToScene.test.ts +++ b/public/app/features/dashboard-scene/serialization/transformSaveModelToScene.test.ts @@ -746,7 +746,10 @@ describe('transformSaveModelToScene', () => { describe('Repeating rows', () => { it('Should build correct scene model', () => { - const scene = transformSaveModelToScene({ dashboard: repeatingRowsAndPanelsDashboardJson as any, meta: {} }); + const scene = transformSaveModelToScene({ + dashboard: repeatingRowsAndPanelsDashboardJson as DashboardDataDTO, + meta: {}, + }); const body = scene.state.body as SceneGridLayout; const row2 = body.state.children[1] as SceneGridRow; @@ -762,7 +765,7 @@ describe('transformSaveModelToScene', () => { describe('Annotation queries', () => { it('Should build correct scene model', () => { - const scene = transformSaveModelToScene({ dashboard: dashboard_to_load1 as any, meta: {} }); + const scene = transformSaveModelToScene({ dashboard: dashboard_to_load1 as DashboardDataDTO, meta: {} }); expect(scene.state.$data).toBeInstanceOf(DashboardDataLayerSet); expect(scene.state.controls!.state.variableControls[1]).toBeInstanceOf(SceneDataLayerControls); @@ -790,7 +793,7 @@ describe('transformSaveModelToScene', () => { describe('Alerting data layer', () => { it('Should add alert states data layer if unified alerting enabled', () => { config.unifiedAlertingEnabled = true; - const scene = transformSaveModelToScene({ dashboard: dashboard_to_load1 as any, meta: {} }); + const scene = transformSaveModelToScene({ dashboard: dashboard_to_load1 as DashboardDataDTO, meta: {} }); expect(scene.state.$data).toBeInstanceOf(DashboardDataLayerSet); expect(scene.state.controls!.state.variableControls[1]).toBeInstanceOf(SceneDataLayerControls); @@ -803,7 +806,7 @@ describe('transformSaveModelToScene', () => { config.unifiedAlertingEnabled = false; const dashboard = { ...dashboard_to_load1 } as unknown as DashboardDataDTO; dashboard.panels![0].alert = {}; - const scene = transformSaveModelToScene({ dashboard: dashboard_to_load1 as any, meta: {} }); + const scene = transformSaveModelToScene({ dashboard: dashboard_to_load1 as DashboardDataDTO, meta: {} }); expect(scene.state.$data).toBeInstanceOf(DashboardDataLayerSet); expect(scene.state.controls!.state.variableControls[1]).toBeInstanceOf(SceneDataLayerControls); diff --git a/public/app/features/dashboard-scene/serialization/transformSceneToSaveModel.test.ts b/public/app/features/dashboard-scene/serialization/transformSceneToSaveModel.test.ts index 94497918e64..7f051e9924f 100644 --- a/public/app/features/dashboard-scene/serialization/transformSceneToSaveModel.test.ts +++ b/public/app/features/dashboard-scene/serialization/transformSceneToSaveModel.test.ts @@ -28,6 +28,7 @@ import { PanelModel } from 'app/features/dashboard/state'; import { getTimeRange } from 'app/features/dashboard/utils/timeRange'; import { reduceTransformRegistryItem } from 'app/features/transformers/editors/ReduceTransformerEditor'; import { SHARED_DASHBOARD_QUERY } from 'app/plugins/datasource/dashboard'; +import { DashboardDataDTO } from 'app/types'; import { buildPanelEditScene } from '../panel-edit/PanelEditor'; import { DashboardDataLayerSet } from '../scene/DashboardDataLayerSet'; @@ -192,7 +193,7 @@ describe('transformSceneToSaveModel', () => { }, links: [{ ...NEW_LINK, title: 'Link 1' }], }; - const scene = transformSaveModelToScene({ dashboard: dashboardWithCustomSettings as any, meta: {} }); + const scene = transformSaveModelToScene({ dashboard: dashboardWithCustomSettings as DashboardDataDTO, meta: {} }); const saveModel = transformSceneToSaveModel(scene); expect(saveModel).toMatchSnapshot(); @@ -201,7 +202,7 @@ describe('transformSceneToSaveModel', () => { describe('Given a simple scene with variables', () => { it('Should transform back to persisted model', () => { - const scene = transformSaveModelToScene({ dashboard: dashboard_to_load1 as any, meta: {} }); + const scene = transformSaveModelToScene({ dashboard: dashboard_to_load1 as DashboardDataDTO, meta: {} }); const saveModel = transformSceneToSaveModel(scene); expect(saveModel).toMatchSnapshot(); @@ -210,7 +211,10 @@ describe('transformSceneToSaveModel', () => { describe('Given a scene with rows', () => { it('Should transform back to persisted model', () => { - const scene = transformSaveModelToScene({ dashboard: repeatingRowsAndPanelsDashboardJson as any, meta: {} }); + const scene = transformSaveModelToScene({ + dashboard: repeatingRowsAndPanelsDashboardJson as DashboardDataDTO, + meta: {}, + }); const saveModel = transformSceneToSaveModel(scene); @@ -222,7 +226,10 @@ describe('transformSceneToSaveModel', () => { }); it('Should remove repeated rows in save model', () => { - const scene = transformSaveModelToScene({ dashboard: repeatingRowsAndPanelsDashboardJson as any, meta: {} }); + const scene = transformSaveModelToScene({ + dashboard: repeatingRowsAndPanelsDashboardJson as DashboardDataDTO, + meta: {}, + }); const variable = scene.state.$variables?.state.variables[0] as MultiValueVariable; variable.changeValueTo(['a', 'b', 'c']); @@ -427,7 +434,7 @@ describe('transformSceneToSaveModel', () => { describe('Annotations', () => { it('should transform annotations to save model', () => { - const scene = transformSaveModelToScene({ dashboard: dashboard_to_load1 as any, meta: {} }); + const scene = transformSaveModelToScene({ dashboard: dashboard_to_load1 as DashboardDataDTO, meta: {} }); const saveModel = transformSceneToSaveModel(scene); expect(saveModel.annotations?.list?.length).toBe(4); @@ -435,7 +442,7 @@ describe('transformSceneToSaveModel', () => { }); it('should transform annotations to save model after state changes', () => { - const scene = transformSaveModelToScene({ dashboard: dashboard_to_load1 as any, meta: {} }); + const scene = transformSaveModelToScene({ dashboard: dashboard_to_load1 as DashboardDataDTO, meta: {} }); const layers = (scene.state.$data as DashboardDataLayerSet)?.state.annotationLayers; const enabledLayer = layers[1]; @@ -678,7 +685,7 @@ describe('transformSceneToSaveModel', () => { }); it('attaches snapshot data to panels using Grafana snapshot query', async () => { - const scene = transformSaveModelToScene({ dashboard: snapshotableDashboardJson as any, meta: {} }); + const scene = transformSaveModelToScene({ dashboard: snapshotableDashboardJson as DashboardDataDTO, meta: {} }); activateFullSceneTree(scene); @@ -733,7 +740,10 @@ describe('transformSceneToSaveModel', () => { }); it('handles basic rows', async () => { - const scene = transformSaveModelToScene({ dashboard: snapshotableWithRowsDashboardJson as any, meta: {} }); + const scene = transformSaveModelToScene({ + dashboard: snapshotableWithRowsDashboardJson as DashboardDataDTO, + meta: {}, + }); activateFullSceneTree(scene); @@ -940,7 +950,7 @@ describe('transformSceneToSaveModel', () => { let snapshot: Dashboard = {} as Dashboard; beforeEach(() => { - const scene = transformSaveModelToScene({ dashboard: snapshotableDashboardJson as any, meta: {} }); + const scene = transformSaveModelToScene({ dashboard: snapshotableDashboardJson as DashboardDataDTO, meta: {} }); activateFullSceneTree(scene); snapshot = transformSceneToSaveModel(scene, true); }); @@ -1004,7 +1014,7 @@ describe('transformSceneToSaveModel', () => { }); it('should remove links', async () => { - const scene = transformSaveModelToScene({ dashboard: snapshotableDashboardJson as any, meta: {} }); + const scene = transformSaveModelToScene({ dashboard: snapshotableDashboardJson as DashboardDataDTO, meta: {} }); activateFullSceneTree(scene); const snapshot = transformSceneToSaveModel(scene, true); expect(snapshot.links?.length).toBe(1); @@ -1104,7 +1114,10 @@ describe('transformSceneToSaveModel', () => { describe('Given a scene with repeated panels and non-repeated panels', () => { it('should save repeated panels itemHeight as height', () => { - const scene = transformSaveModelToScene({ dashboard: repeatingRowsAndPanelsDashboardJson as any, meta: {} }); + const scene = transformSaveModelToScene({ + dashboard: repeatingRowsAndPanelsDashboardJson as DashboardDataDTO, + meta: {}, + }); const gridItem = sceneGraph.findByKey(scene, 'grid-item-2') as DashboardGridItem; expect(gridItem).toBeInstanceOf(DashboardGridItem); expect(gridItem.state.height).toBe(10); @@ -1117,7 +1130,10 @@ describe('transformSceneToSaveModel', () => { }); it('should not save non-repeated panels itemHeight as height', () => { - const scene = transformSaveModelToScene({ dashboard: repeatingRowsAndPanelsDashboardJson as any, meta: {} }); + const scene = transformSaveModelToScene({ + dashboard: repeatingRowsAndPanelsDashboardJson as DashboardDataDTO, + meta: {}, + }); const gridItem = sceneGraph.findByKey(scene, 'grid-item-15') as DashboardGridItem; expect(gridItem).toBeInstanceOf(DashboardGridItem); expect(gridItem.state.height).toBe(2); diff --git a/public/app/features/dashboard/components/PanelEditor/getVisualizationOptions.tsx b/public/app/features/dashboard/components/PanelEditor/getVisualizationOptions.tsx index 0a607ee3ff3..be19274ca5d 100644 --- a/public/app/features/dashboard/components/PanelEditor/getVisualizationOptions.tsx +++ b/public/app/features/dashboard/components/PanelEditor/getVisualizationOptions.tsx @@ -135,7 +135,7 @@ export function getVisualizationOptions(props: OptionPaneRenderProps): OptionsPa description: fieldOption.description, overrides: getOptionOverrides(fieldOption, currentFieldConfig, data?.series), render: function renderEditor() { - const onChange = (v: any) => { + const onChange = (v: unknown) => { onFieldConfigsChange( updateDefaultFieldConfigValue(currentFieldConfig, fieldOption.path, v, fieldOption.isCustom) ); diff --git a/public/app/features/dashboard/components/PanelEditor/utils.ts b/public/app/features/dashboard/components/PanelEditor/utils.ts index d5a3342e668..6697a58ab0b 100644 --- a/public/app/features/dashboard/components/PanelEditor/utils.ts +++ b/public/app/features/dashboard/components/PanelEditor/utils.ts @@ -39,7 +39,7 @@ export function supportsDataQuery(plugin: PanelPlugin | undefined | null): boole export const updateDefaultFieldConfigValue = ( config: FieldConfigSource, name: string, - value: any, + value: unknown, isCustom?: boolean ) => { let defaults = { ...config.defaults }; diff --git a/public/app/features/dashboard/components/SaveDashboard/forms/SaveDashboardAsForm.test.tsx b/public/app/features/dashboard/components/SaveDashboard/forms/SaveDashboardAsForm.test.tsx index aefda5932ce..da11ebdf177 100644 --- a/public/app/features/dashboard/components/SaveDashboard/forms/SaveDashboardAsForm.test.tsx +++ b/public/app/features/dashboard/components/SaveDashboard/forms/SaveDashboardAsForm.test.tsx @@ -3,6 +3,7 @@ import userEvent from '@testing-library/user-event'; import { DashboardModel } from 'app/features/dashboard/state'; import * as api from 'app/features/manage-dashboards/state/actions'; +import { SaveDashboardResponseDTO } from 'app/types'; import { SaveDashboardAsForm, SaveDashboardAsFormProps } from './SaveDashboardAsForm'; @@ -16,7 +17,7 @@ jest.mock('app/features/manage-dashboards/services/ValidationSrv', () => ({ jest.spyOn(api, 'searchFolders').mockResolvedValue([]); -const prepareDashboardMock = (panel: any) => { +const prepareDashboardMock = (panel: object) => { const json = { title: 'name', panels: [panel], @@ -43,7 +44,7 @@ const renderAndSubmitForm = async ( onSuccess={() => {}} onSubmit={async (jsonModel) => { submitSpy(jsonModel); - return {}; + return {} as SaveDashboardResponseDTO; }} {...otherProps} /> diff --git a/public/app/features/dashboard/components/SaveDashboard/forms/SaveDashboardForm.test.tsx b/public/app/features/dashboard/components/SaveDashboard/forms/SaveDashboardForm.test.tsx index ef7c6a605f1..4afa44f1b75 100644 --- a/public/app/features/dashboard/components/SaveDashboard/forms/SaveDashboardForm.test.tsx +++ b/public/app/features/dashboard/components/SaveDashboard/forms/SaveDashboardForm.test.tsx @@ -4,6 +4,7 @@ import userEvent from '@testing-library/user-event'; import { Dashboard } from '@grafana/schema'; import { DashboardModel } from 'app/features/dashboard/state'; import { createDashboardModelFixture } from 'app/features/dashboard/state/__fixtures__/dashboardFixtures'; +import { SaveDashboardResponseDTO } from 'app/types'; import { SaveDashboardOptions } from '../types'; @@ -41,7 +42,7 @@ const renderAndSubmitForm = async (dashboard: DashboardModel, submitSpy: jest.Mo onSuccess={() => {}} onSubmit={async (jsonModel) => { submitSpy(jsonModel); - return { status: 'success' }; + return { status: 'success' } as SaveDashboardResponseDTO; }} saveModel={{ clone: dashboard.getSaveModelClone(), @@ -69,7 +70,7 @@ describe('SaveDashboardAsForm', () => { onCancel={() => {}} onSuccess={() => {}} onSubmit={async () => { - return {}; + return {} as SaveDashboardResponseDTO; }} saveModel={{ clone: { id: 1, schemaVersion: 3 }, @@ -132,7 +133,7 @@ describe('SaveDashboardAsForm', () => { onCancel={() => {}} onSuccess={() => {}} onSubmit={async () => { - return {}; + return {} as SaveDashboardResponseDTO; }} saveModel={{ clone: createDashboardModelFixture().getSaveModelClone(), diff --git a/public/app/features/dashboard/components/SaveDashboard/forms/SaveDashboardForm.tsx b/public/app/features/dashboard/components/SaveDashboard/forms/SaveDashboardForm.tsx index cd1823f75f7..9093d92ee81 100644 --- a/public/app/features/dashboard/components/SaveDashboard/forms/SaveDashboardForm.tsx +++ b/public/app/features/dashboard/components/SaveDashboard/forms/SaveDashboardForm.tsx @@ -7,6 +7,7 @@ import { config } from '@grafana/runtime'; import { Dashboard } from '@grafana/schema'; import { Button, Checkbox, TextArea, useStyles2, Stack } from '@grafana/ui'; import { DashboardModel } from 'app/features/dashboard/state'; +import { SaveDashboardResponseDTO } from 'app/types'; import { GenAIDashboardChangesButton } from '../../GenAI/GenAIDashboardChangesButton'; import { SaveDashboardData, SaveDashboardOptions } from '../types'; @@ -17,7 +18,11 @@ export type SaveProps = { saveModel: SaveDashboardData; // already cloned onCancel: () => void; onSuccess: () => void; - onSubmit?: (saveModel: Dashboard, options: SaveDashboardOptions, dashboard: DashboardModel) => Promise; + onSubmit?: ( + saveModel: Dashboard, + options: SaveDashboardOptions, + dashboard: DashboardModel + ) => Promise; options: SaveDashboardOptions; onOptionsChange: (opts: SaveDashboardOptions) => void; }; diff --git a/public/app/features/dashboard/components/SaveDashboard/types.ts b/public/app/features/dashboard/components/SaveDashboard/types.ts index f5b9418a5ee..2c2482dd683 100644 --- a/public/app/features/dashboard/components/SaveDashboard/types.ts +++ b/public/app/features/dashboard/components/SaveDashboard/types.ts @@ -2,6 +2,7 @@ import { Dashboard } from '@grafana/schema'; import { ObjectMeta } from 'app/features/apiserver/types'; import { CloneOptions, DashboardModel } from 'app/features/dashboard/state/DashboardModel'; import { Diffs } from 'app/features/dashboard-scene/settings/version-history/utils'; +import { SaveDashboardResponseDTO } from 'app/types'; export interface SaveDashboardData { clone: Dashboard; // cloned copy @@ -33,7 +34,11 @@ export interface SaveDashboardFormProps { isLoading: boolean; onCancel: () => void; onSuccess: () => void; - onSubmit?: (saveModel: Dashboard, options: SaveDashboardOptions, dashboard: DashboardModel) => Promise; + onSubmit?: ( + saveModel: Dashboard, + options: SaveDashboardOptions, + dashboard: DashboardModel + ) => Promise; } export interface SaveDashboardModalProps { diff --git a/public/app/features/dashboard/dashgrid/PanelStateWrapper.tsx b/public/app/features/dashboard/dashgrid/PanelStateWrapper.tsx index 7d21b626fa3..a0158c55aee 100644 --- a/public/app/features/dashboard/dashgrid/PanelStateWrapper.tsx +++ b/public/app/features/dashboard/dashgrid/PanelStateWrapper.tsx @@ -379,7 +379,7 @@ export class PanelStateWrapper extends PureComponent { this.setState(stateUpdate); }; - onOptionsChange = (options: any) => { + onOptionsChange = (options: object) => { this.props.panel.updateOptions(options); }; diff --git a/public/app/features/dimensions/scale.ts b/public/app/features/dimensions/scale.ts index 98ce993877d..06f3be04dee 100644 --- a/public/app/features/dimensions/scale.ts +++ b/public/app/features/dimensions/scale.ts @@ -94,7 +94,7 @@ export function validateScaleOptions(options?: ScaleDimensionOptions): ScaleDime export function validateScaleConfig(copy: ScaleDimensionConfig, options: ScaleDimensionOptions): ScaleDimensionConfig { let { min, max } = validateScaleOptions(options); if (!copy) { - copy = {} as any; + copy = {} as ScaleDimensionConfig; } if (copy.max == null) { diff --git a/public/app/features/explore/utils/links.test.ts b/public/app/features/explore/utils/links.test.ts index a2aecbe8f0a..60a9c8fd5fe 100644 --- a/public/app/features/explore/utils/links.test.ts +++ b/public/app/features/explore/utils/links.test.ts @@ -719,10 +719,10 @@ function setup( }; }, getAnchorInfo(link) { - return { ...link }; + return { ...link, href: link.url ?? '' }; }, getLinkUrl(link) { - return link.url; + return link.url ?? ''; }, }); diff --git a/public/app/features/panel/panellinks/link_srv.ts b/public/app/features/panel/panellinks/link_srv.ts index 83f8cf82acb..fec4e0e2c8a 100644 --- a/public/app/features/panel/panellinks/link_srv.ts +++ b/public/app/features/panel/panellinks/link_srv.ts @@ -242,12 +242,12 @@ export const getCalculationValueDataLinksVariableSuggestions = (dataFrames: Data export interface LinkService { getDataLinkUIModel: (link: DataLink, replaceVariables: InterpolateFunction | undefined, origin: T) => LinkModel; - getAnchorInfo: (link: any) => { + getAnchorInfo: (link: DashboardLink) => { href: string; title: string; tooltip: string; }; - getLinkUrl: (link: any) => string; + getLinkUrl: (link: DashboardLink) => string; } export class LinkSrv implements LinkService { @@ -268,7 +268,7 @@ export class LinkSrv implements LinkService { return getConfig().disableSanitizeHtml ? url : textUtil.sanitizeUrl(url); } - getAnchorInfo(link: any) { + getAnchorInfo(link: DashboardLink) { const templateSrv = getTemplateSrv(); return { href: this.getLinkUrl(link), diff --git a/public/app/features/panel/panellinks/specs/link_srv.test.ts b/public/app/features/panel/panellinks/specs/link_srv.test.ts index cd5dd3b11ef..d9795d45cb4 100644 --- a/public/app/features/panel/panellinks/specs/link_srv.test.ts +++ b/public/app/features/panel/panellinks/specs/link_srv.test.ts @@ -165,7 +165,7 @@ describe('linkSrv', () => { url: '/graph?home=$home', title: 'Visit home', tooltip: 'Visit ${home:raw}', - }); + } as unknown as DashboardLink); expect(linkSrv.getLinkUrl).toBeCalledTimes(1); expect(templateSrv.replace).toBeCalledTimes(3); diff --git a/public/app/features/plugins/datasource_srv.ts b/public/app/features/plugins/datasource_srv.ts index 7e9b6affd1d..4ac58e3adfd 100644 --- a/public/app/features/plugins/datasource_srv.ts +++ b/public/app/features/plugins/datasource_srv.ts @@ -144,7 +144,7 @@ export class DatasourceSrv implements DataSourceService { return this.loadDatasource(nameOrUid); } - async loadDatasource(key: string): Promise> { + async loadDatasource(key: string): Promise { if (this.datasources[key]) { return Promise.resolve(this.datasources[key]); } @@ -164,7 +164,7 @@ export class DatasourceSrv implements DataSourceService { // If there is only one constructor argument it is instanceSettings const useAngular = dsPlugin.DataSourceClass.length !== 1; - let instance: DataSourceApi; + let instance: DataSourceApi; if (useAngular) { instance = getLegacyAngularInjector().instantiate(dsPlugin.DataSourceClass, { @@ -184,7 +184,7 @@ export class DatasourceSrv implements DataSourceService { anyInstance.type = instanceSettings.type; anyInstance.meta = instanceSettings.meta; anyInstance.uid = instanceSettings.uid; - (instance as any).getRef = DataSourceApi.prototype.getRef; + anyInstance.getRef = DataSourceApi.prototype.getRef; } // store in instance cache