mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Chore: improve types (#78126)
* fix some types * more type updates * some more fixes * more changes * string instead of unknown * more like original logic * remove outdated comment * update betterer
This commit is contained in:
parent
b0448b92e5
commit
2c0c51a0df
@ -17,10 +17,7 @@ exports[`better eslint`] = {
|
||||
],
|
||||
"packages/grafana-data/src/dataframe/DataFrameJSON.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, "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.", "1"]
|
||||
],
|
||||
"packages/grafana-data/src/dataframe/DataFrameView.test.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
@ -30,12 +27,7 @@ exports[`better eslint`] = {
|
||||
[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, "Unexpected any. Specify a different type.", "4"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "5"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "6"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "7"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "8"]
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "3"]
|
||||
],
|
||||
"packages/grafana-data/src/dataframe/MutableDataFrame.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
@ -63,9 +55,8 @@ exports[`better eslint`] = {
|
||||
[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.", "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.", "5"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "6"]
|
||||
],
|
||||
"packages/grafana-data/src/dataframe/dimensions.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
@ -80,24 +71,23 @@ exports[`better eslint`] = {
|
||||
[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, "Unexpected any. Specify a different type.", "7"],
|
||||
[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.", "8"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "9"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "10"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "11"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "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.", "10"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "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, "Do not use any type assertions.", "15"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "16"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "17"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "18"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "19"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "20"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "21"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "22"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "23"]
|
||||
[0, 0, 0, "Do not use any type assertions.", "22"]
|
||||
],
|
||||
"packages/grafana-data/src/datetime/datemath.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
@ -153,26 +143,20 @@ exports[`better eslint`] = {
|
||||
"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"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "3"]
|
||||
],
|
||||
"packages/grafana-data/src/field/fieldOverrides.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-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, "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.", "6"],
|
||||
[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, "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, "Do not use any type assertions.", "11"]
|
||||
[0, 0, 0, "Do not use any type assertions.", "10"]
|
||||
],
|
||||
"packages/grafana-data/src/field/scale.ts:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"],
|
||||
@ -191,8 +175,7 @@ exports[`better eslint`] = {
|
||||
],
|
||||
"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.", "2"]
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"]
|
||||
],
|
||||
"packages/grafana-data/src/panel/PanelPlugin.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
@ -205,15 +188,10 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Do not use any type assertions.", "7"]
|
||||
],
|
||||
"packages/grafana-data/src/panel/getPanelOptionsWithDefaults.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.", "0"]
|
||||
],
|
||||
"packages/grafana-data/src/panel/registryFactories.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, "Do not use any type assertions.", "3"]
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"]
|
||||
],
|
||||
"packages/grafana-data/src/themes/colorManipulator.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
@ -223,9 +201,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, "Unexpected any. Specify a different type.", "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"]
|
||||
@ -2989,9 +2964,6 @@ exports[`better eslint`] = {
|
||||
"public/app/features/dashboard/components/DeleteDashboard/DeleteDashboardModal.tsx:5381": [
|
||||
[0, 0, 0, "Styles should be written using objects.", "0"]
|
||||
],
|
||||
"public/app/features/dashboard/components/GenAI/utils.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
],
|
||||
"public/app/features/dashboard/components/HelpWizard/HelpWizard.tsx:5381": [
|
||||
[0, 0, 0, "Styles should be written using objects.", "0"],
|
||||
[0, 0, 0, "Styles should be written using objects.", "1"],
|
||||
@ -3099,9 +3071,6 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "2"]
|
||||
],
|
||||
"public/app/features/dashboard/components/PanelEditor/types.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
],
|
||||
"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"],
|
||||
@ -3270,13 +3239,8 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "3"],
|
||||
[0, 0, 0, "Use data-testid for E2E selectors instead of aria-label", "4"]
|
||||
],
|
||||
"public/app/features/dashboard/dashgrid/DashboardPanel.tsx:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
],
|
||||
"public/app/features/dashboard/dashgrid/PanelStateWrapper.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.", "0"]
|
||||
],
|
||||
"public/app/features/dashboard/dashgrid/SeriesVisibilityConfigFactory.ts:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"]
|
||||
@ -3328,20 +3292,17 @@ exports[`better eslint`] = {
|
||||
[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.", "20"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "21"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "22"],
|
||||
[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, "Do not use any type assertions.", "26"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "27"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "28"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "29"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "30"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "31"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "32"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "33"]
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "29"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "30"]
|
||||
],
|
||||
"public/app/features/dashboard/state/DashboardModel.repeat.test.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
@ -3378,10 +3339,8 @@ exports[`better eslint`] = {
|
||||
[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, "Do not use any type assertions.", "24"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "25"]
|
||||
[0, 0, 0, "Do not use any type assertions.", "22"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "23"]
|
||||
],
|
||||
"public/app/features/dashboard/state/PanelModel.test.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
@ -3439,9 +3398,6 @@ exports[`better eslint`] = {
|
||||
"public/app/features/dashboard/state/initDashboard.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
],
|
||||
"public/app/features/dashboard/state/reducers.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
],
|
||||
"public/app/features/dashboard/utils/getPanelMenu.test.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
],
|
||||
@ -3619,8 +3575,7 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
],
|
||||
"public/app/features/dimensions/utils.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/explore/ContentOutline/ContentOutline.tsx:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"]
|
||||
@ -4137,9 +4092,8 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Do not use any type assertions.", "5"]
|
||||
],
|
||||
"public/app/features/expressions/ExpressionDatasource.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.", "0"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "1"]
|
||||
],
|
||||
"public/app/features/expressions/components/Condition.tsx:5381": [
|
||||
[0, 0, 0, "Styles should be written using objects.", "0"],
|
||||
@ -4169,12 +4123,6 @@ 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/features/geo/format/geohash.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
],
|
||||
"public/app/features/geo/format/geojson.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
],
|
||||
"public/app/features/geo/gazetteer/gazetteer.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "1"]
|
||||
@ -4195,9 +4143,6 @@ exports[`better eslint`] = {
|
||||
"public/app/features/inspector/InspectDataTab.tsx:5381": [
|
||||
[0, 0, 0, "Use data-testid for E2E selectors instead of aria-label", "0"]
|
||||
],
|
||||
"public/app/features/inspector/InspectErrorTab.tsx:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
],
|
||||
"public/app/features/inspector/InspectJSONTab.tsx:5381": [
|
||||
[0, 0, 0, "Use data-testid for E2E selectors instead of aria-label", "0"]
|
||||
],
|
||||
@ -4215,11 +4160,9 @@ exports[`better eslint`] = {
|
||||
],
|
||||
"public/app/features/inspector/QueryInspector.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, "Styles should be written using objects.", "3"],
|
||||
[0, 0, 0, "Use data-testid for E2E selectors instead of aria-label", "4"],
|
||||
[0, 0, 0, "Use data-testid for E2E selectors instead of aria-label", "5"]
|
||||
[0, 0, 0, "Styles should be written using objects.", "1"],
|
||||
[0, 0, 0, "Use data-testid for E2E selectors instead of aria-label", "2"],
|
||||
[0, 0, 0, "Use data-testid for E2E selectors instead of aria-label", "3"]
|
||||
],
|
||||
"public/app/features/inspector/styles.ts:5381": [
|
||||
[0, 0, 0, "Styles should be written using objects.", "0"],
|
||||
@ -4234,9 +4177,6 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Styles should be written using objects.", "9"],
|
||||
[0, 0, 0, "Styles should be written using objects.", "10"]
|
||||
],
|
||||
"public/app/features/invites/state/selectors.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
],
|
||||
"public/app/features/library-panels/components/LibraryPanelCard/LibraryPanelCard.tsx:5381": [
|
||||
[0, 0, 0, "Styles should be written using objects.", "0"]
|
||||
],
|
||||
@ -4288,11 +4228,6 @@ 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/features/live/centrifuge/LiveDataStream.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"]
|
||||
],
|
||||
"public/app/features/live/centrifuge/LiveDataStream.ts:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"]
|
||||
],
|
||||
@ -4302,9 +4237,6 @@ exports[`better eslint`] = {
|
||||
"public/app/features/live/centrifuge/serviceWorkerProxy.ts:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"]
|
||||
],
|
||||
"public/app/features/live/centrifuge/transferHandlers.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
],
|
||||
"public/app/features/live/data/amendTimeSeries.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "1"],
|
||||
@ -4460,11 +4392,7 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "4"]
|
||||
],
|
||||
"public/app/features/org/state/actions.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.", "0"]
|
||||
],
|
||||
"public/app/features/org/state/reducers.ts:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"]
|
||||
@ -4492,9 +4420,6 @@ exports[`better eslint`] = {
|
||||
"public/app/features/panel/components/VizTypePicker/VizTypePicker.tsx:5381": [
|
||||
[0, 0, 0, "Styles should be written using objects.", "0"]
|
||||
],
|
||||
"public/app/features/panel/components/VizTypePicker/types.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
],
|
||||
"public/app/features/panel/panellinks/linkSuppliers.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
],
|
||||
@ -4504,13 +4429,6 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "2"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "3"]
|
||||
],
|
||||
"public/app/features/panel/state/actions.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
],
|
||||
"public/app/features/panel/state/reducers.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/playlist/EmptyQueryListBanner.tsx:5381": [
|
||||
[0, 0, 0, "Styles should be written using objects.", "0"]
|
||||
],
|
||||
@ -4588,9 +4506,6 @@ 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/features/plugins/admin/components/SearchField.tsx:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
],
|
||||
"public/app/features/plugins/admin/components/VersionList.tsx:5381": [
|
||||
[0, 0, 0, "Styles should be written using objects.", "0"],
|
||||
[0, 0, 0, "Styles should be written using objects.", "1"],
|
||||
@ -4632,12 +4547,7 @@ exports[`better eslint`] = {
|
||||
[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, "Unexpected any. Specify a different type.", "12"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "13"]
|
||||
],
|
||||
"public/app/features/plugins/pluginSettings.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.", "12"]
|
||||
],
|
||||
"public/app/features/plugins/sandbox/distortion_map.ts:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"]
|
||||
@ -4673,9 +4583,7 @@ exports[`better eslint`] = {
|
||||
[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.", "3"]
|
||||
],
|
||||
"public/app/features/plugins/utils.ts:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"],
|
||||
@ -7417,11 +7325,6 @@ exports[`better eslint`] = {
|
||||
"public/test/lib/common.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
],
|
||||
"public/test/matchers/toEmitValuesWith.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "2"]
|
||||
],
|
||||
"public/test/specs/helpers.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"],
|
||||
@ -7434,9 +7337,7 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "8"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "9"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "10"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "11"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "12"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "13"]
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "11"]
|
||||
]
|
||||
}`
|
||||
};
|
||||
|
@ -143,7 +143,7 @@ export function decodeFieldValueEntities(lookup: FieldValueEntityLookup, values:
|
||||
*/
|
||||
export function decodeFieldValueEnums(lookup: string[], values: FieldValues) {
|
||||
for (let i = 0; i < values.length; i++) {
|
||||
values[i] = lookup[values[i] as number];
|
||||
values[i] = lookup[Number(values[i])];
|
||||
}
|
||||
}
|
||||
|
||||
@ -240,7 +240,9 @@ export function dataFrameToJSON(frame: DataFrame): DataFrameJSON {
|
||||
name: frame.name,
|
||||
fields: frame.fields.map((f) => {
|
||||
const { values, nanos, state, display, ...sfield } = f;
|
||||
delete (sfield as any).entities;
|
||||
if ('entities' in sfield) {
|
||||
delete sfield.entities;
|
||||
}
|
||||
data.values.push(values);
|
||||
|
||||
if (nanos != null) {
|
||||
|
@ -13,7 +13,7 @@ import { FunctionalVector } from '../vector/FunctionalVector';
|
||||
* @typeParam T - Type of object stored in the DataFrame.
|
||||
* @beta
|
||||
*/
|
||||
export class DataFrameView<T = any> extends FunctionalVector<T> {
|
||||
export class DataFrameView<T extends object = any> extends FunctionalVector<T> {
|
||||
private index = 0;
|
||||
private obj: T;
|
||||
readonly fields: {
|
||||
@ -22,7 +22,7 @@ export class DataFrameView<T = any> extends FunctionalVector<T> {
|
||||
|
||||
constructor(private data: DataFrame) {
|
||||
super();
|
||||
const obj = {} as unknown as T;
|
||||
const obj = {} as T;
|
||||
const fields = {} as any;
|
||||
|
||||
for (let i = 0; i < data.fields.length; i++) {
|
||||
@ -34,14 +34,14 @@ export class DataFrameView<T = any> extends FunctionalVector<T> {
|
||||
fields[field.name] = field;
|
||||
const getter = () => field.values.get(this.index); // .get() to support all Vector types
|
||||
|
||||
if (!(obj as any).hasOwnProperty(field.name)) {
|
||||
if (!obj.hasOwnProperty(field.name)) {
|
||||
Object.defineProperty(obj, field.name, {
|
||||
enumerable: true, // Shows up as enumerable property
|
||||
get: getter,
|
||||
});
|
||||
}
|
||||
|
||||
if (!(obj as any).hasOwnProperty(i.toString())) {
|
||||
if (!obj.hasOwnProperty(i.toString())) {
|
||||
Object.defineProperty(obj, i, {
|
||||
enumerable: false, // Don't enumerate array index
|
||||
get: getter,
|
||||
|
@ -488,7 +488,7 @@ export function getStreamingFrameOptions(opts?: Partial<StreamingFrameOptions>):
|
||||
|
||||
// converts vertical insertion records with table keys in [0] and column values in [1...N]
|
||||
// to join()-able tables with column arrays
|
||||
export function transpose(vrecs: any[][]) {
|
||||
export function transpose(vrecs: unknown[][]) {
|
||||
let tableKeys = new Set(vrecs[0]);
|
||||
let tables = new Map();
|
||||
|
||||
|
@ -33,10 +33,11 @@ function convertTableToDataFrame(table: TableData): DataFrame {
|
||||
const fields = table.columns.map((c) => {
|
||||
// TODO: should be Column but type does not exists there so not sure whats up here.
|
||||
const { text, type, ...disp } = c as any;
|
||||
const values: unknown[] = [];
|
||||
return {
|
||||
name: text?.length ? text : c, // rename 'text' to the 'name' field
|
||||
config: (disp || {}) as FieldConfig,
|
||||
values: [] as unknown[],
|
||||
values,
|
||||
type: type && Object.values(FieldType).includes(type as FieldType) ? (type as FieldType) : FieldType.other,
|
||||
};
|
||||
});
|
||||
|
@ -222,7 +222,7 @@ export function getRawDisplayProcessor(): DisplayProcessor {
|
||||
|
||||
const getCircularReplacer = () => {
|
||||
const seen = new WeakSet();
|
||||
return (_key: any, value: object | null) => {
|
||||
return (_key: string, value: object | null) => {
|
||||
if (typeof value === 'object' && value !== null) {
|
||||
if (seen.has(value)) {
|
||||
return;
|
||||
|
@ -238,7 +238,7 @@ export function applyFieldOverrides(options: ApplyFieldOverrideOptions): DataFra
|
||||
}
|
||||
|
||||
function calculateRange(
|
||||
config: FieldConfig<any>,
|
||||
config: FieldConfig,
|
||||
field: Field,
|
||||
globalRange: NumericRange | undefined,
|
||||
data: DataFrame[]
|
||||
@ -269,7 +269,7 @@ function calculateRange(
|
||||
// 2. have the ability to selectively get display color or text (but not always both, which are each quite expensive)
|
||||
// 3. sufficently optimize text formatting and threshold color determinitation
|
||||
function cachingDisplayProcessor(disp: DisplayProcessor, maxCacheSize = 2500): DisplayProcessor {
|
||||
type dispCache = Map<any, DisplayValue>;
|
||||
type dispCache = Map<unknown, DisplayValue>;
|
||||
// decimals -> cache mapping, -1 is unspecified decimals
|
||||
const caches = new Map<number, dispCache>();
|
||||
|
||||
|
@ -8,7 +8,7 @@ import {
|
||||
ValueMapping,
|
||||
} from '../../types';
|
||||
|
||||
export const identityOverrideProcessor = <T>(value: T, _context: FieldOverrideContext, _settings: any) => {
|
||||
export const identityOverrideProcessor = <T>(value: T) => {
|
||||
return value;
|
||||
};
|
||||
|
||||
|
@ -42,7 +42,7 @@ export interface MapLayerHandler<TConfig = any> {
|
||||
*/
|
||||
registerOptionsUI?: (
|
||||
builder: PanelOptionsEditorBuilder<MapLayerOptions<TConfig>>,
|
||||
context: StandardEditorContext<any, any>
|
||||
context: StandardEditorContext<any>
|
||||
) => void;
|
||||
}
|
||||
|
||||
|
@ -17,12 +17,12 @@ import { PanelPlugin } from './PanelPlugin';
|
||||
export interface Props {
|
||||
plugin: PanelPlugin;
|
||||
currentFieldConfig: FieldConfigSource;
|
||||
currentOptions: Record<string, any>;
|
||||
currentOptions: Record<string, unknown>;
|
||||
isAfterPluginChange: boolean;
|
||||
}
|
||||
|
||||
export interface OptionDefaults {
|
||||
options: any;
|
||||
options: Record<string, unknown>;
|
||||
fieldConfig: FieldConfigSource;
|
||||
}
|
||||
|
||||
|
@ -43,17 +43,17 @@ export function createFieldConfigRegistry<TFieldConfigOptions>(
|
||||
}
|
||||
|
||||
for (let fieldConfigProp of standardConfigs) {
|
||||
const id = fieldConfigProp.id as FieldConfigProperty;
|
||||
if (config.disableStandardOptions) {
|
||||
const isDisabled = config.disableStandardOptions.indexOf(fieldConfigProp.id as FieldConfigProperty) > -1;
|
||||
const isDisabled = config.disableStandardOptions.indexOf(id) > -1;
|
||||
if (isDisabled) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (config.standardOptions) {
|
||||
const customHideFromDefaults =
|
||||
config.standardOptions[fieldConfigProp.id as FieldConfigProperty]?.hideFromDefaults;
|
||||
const customDefault = config.standardOptions[fieldConfigProp.id as FieldConfigProperty]?.defaultValue;
|
||||
const customSettings = config.standardOptions[fieldConfigProp.id as FieldConfigProperty]?.settings;
|
||||
const customHideFromDefaults = config.standardOptions[id]?.hideFromDefaults;
|
||||
const customDefault = config.standardOptions[id]?.defaultValue;
|
||||
const customSettings = config.standardOptions[id]?.settings;
|
||||
|
||||
if (customHideFromDefaults) {
|
||||
fieldConfigProp = {
|
||||
|
@ -39,7 +39,7 @@ type FieldReducer = (field: Field, ignoreNulls: boolean, nullAsZero: boolean) =>
|
||||
|
||||
export interface FieldReducerInfo extends RegistryItem {
|
||||
// Internal details
|
||||
emptyInputResult?: any; // typically null, but some things like 'count' & 'sum' should be zero
|
||||
emptyInputResult?: unknown; // typically null, but some things like 'count' & 'sum' should be zero
|
||||
standard: boolean; // The most common stats can all be calculated in a single pass
|
||||
reduce?: FieldReducer;
|
||||
}
|
||||
|
@ -135,8 +135,7 @@ export function getFilteredPanelString(panel: PanelModel): string {
|
||||
'yaxes',
|
||||
]);
|
||||
|
||||
// This cannot avoid the use of any because the type of panelObj is any
|
||||
const panelObjFiltered = Object.keys(panelObj).reduce((obj: { [key: string]: any }, key) => {
|
||||
const panelObjFiltered = Object.keys(panelObj).reduce((obj: { [key: string]: unknown }, key) => {
|
||||
if (keysToKeep.has(key)) {
|
||||
obj[key] = panelObj[key];
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ export interface OptionPaneRenderProps {
|
||||
plugin: PanelPlugin;
|
||||
data?: PanelData;
|
||||
dashboard: DashboardModel;
|
||||
instanceState: any;
|
||||
instanceState: unknown;
|
||||
onPanelConfigChange: (configKey: keyof PanelModel, value: unknown) => void;
|
||||
onPanelOptionsChanged: (options: PanelModel['options']) => void;
|
||||
onFieldConfigsChange: (config: FieldConfigSource) => void;
|
||||
|
@ -28,7 +28,7 @@ export interface OwnProps {
|
||||
const mapStateToProps = (state: StoreState, props: OwnProps) => {
|
||||
const panelState = state.panels[props.stateKey];
|
||||
if (!panelState) {
|
||||
return { plugin: null };
|
||||
return { plugin: undefined };
|
||||
}
|
||||
|
||||
return {
|
||||
@ -58,7 +58,7 @@ export class DashboardPanelUnconnected extends PureComponent<Props> {
|
||||
}
|
||||
}
|
||||
|
||||
onInstanceStateChange = (value: any) => {
|
||||
onInstanceStateChange = (value: unknown) => {
|
||||
this.props.setPanelInstanceState({ key: this.props.stateKey, value });
|
||||
};
|
||||
|
||||
|
@ -65,7 +65,7 @@ export interface Props {
|
||||
isDraggable?: boolean;
|
||||
width: number;
|
||||
height: number;
|
||||
onInstanceStateChange: (value: any) => void;
|
||||
onInstanceStateChange: (value: unknown) => void;
|
||||
timezone?: string;
|
||||
hideMenu?: boolean;
|
||||
}
|
||||
@ -129,7 +129,7 @@ export class PanelStateWrapper extends PureComponent<Props, State> {
|
||||
// Due to a mutable panel model we get the sync settings via function that proactively reads from the model
|
||||
getSync = () => (this.props.isEditing ? DashboardCursorSync.Off : this.props.dashboard.graphTooltip);
|
||||
|
||||
onInstanceStateChange = (value: any) => {
|
||||
onInstanceStateChange = (value: unknown) => {
|
||||
this.props.onInstanceStateChange(value);
|
||||
|
||||
this.setState({
|
||||
|
@ -187,7 +187,7 @@ export class DashboardMigrator {
|
||||
|
||||
if (oldVersion < 6) {
|
||||
// move drop-downs to new schema
|
||||
const annotations: any = find(old.pulldowns, { type: 'annotations' });
|
||||
const annotations = find(old.pulldowns, { type: 'annotations' });
|
||||
|
||||
if (annotations) {
|
||||
this.dashboard.annotations = {
|
||||
@ -318,16 +318,18 @@ export class DashboardMigrator {
|
||||
|
||||
if (oldVersion < 12) {
|
||||
// update template variables
|
||||
each(this.dashboard.getVariables(), (templateVariable: any) => {
|
||||
each(this.dashboard.getVariables(), (templateVariable) => {
|
||||
if ('refresh' in templateVariable) {
|
||||
if (templateVariable.refresh) {
|
||||
templateVariable.refresh = 1;
|
||||
}
|
||||
if (!templateVariable.refresh) {
|
||||
templateVariable.refresh = 0;
|
||||
}
|
||||
if (templateVariable.hideVariable) {
|
||||
}
|
||||
if ('hideVariable' in templateVariable && templateVariable.hideVariable) {
|
||||
templateVariable.hide = 2;
|
||||
} else if (templateVariable.hideLabel) {
|
||||
} else if ('hideLabel' in templateVariable && templateVariable.hideLabel) {
|
||||
templateVariable.hide = 1;
|
||||
}
|
||||
});
|
||||
@ -993,7 +995,7 @@ export class DashboardMigrator {
|
||||
continue;
|
||||
}
|
||||
|
||||
const height: any = row.height || DEFAULT_ROW_HEIGHT;
|
||||
const height = row.height || DEFAULT_ROW_HEIGHT;
|
||||
const rowGridHeight = getGridHeight(height);
|
||||
|
||||
const rowPanel: any = {};
|
||||
|
@ -157,7 +157,7 @@ export class DashboardModel implements TimeModel {
|
||||
this.version = data.version ?? 0;
|
||||
this.links = data.links ?? [];
|
||||
this.gnetId = data.gnetId || null;
|
||||
this.panels = map(data.panels ?? [], (panelData: any) => new PanelModel(panelData));
|
||||
this.panels = map(data.panels ?? [], (panelData) => new PanelModel(panelData));
|
||||
// Deep clone original dashboard to avoid mutations by object reference
|
||||
this.originalDashboard = cloneDeep(data);
|
||||
this.originalTemplating = cloneDeep(this.templating);
|
||||
@ -331,7 +331,7 @@ export class DashboardModel implements TimeModel {
|
||||
|
||||
return panel.getSaveModel();
|
||||
})
|
||||
.map((model: any) => {
|
||||
.map((model) => {
|
||||
if (this.isSnapshotTruthy()) {
|
||||
return model;
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ export interface SetPanelAngularComponentPayload {
|
||||
|
||||
export interface SetPanelInstanceStatePayload {
|
||||
panelId: number;
|
||||
value: any;
|
||||
value: unknown;
|
||||
}
|
||||
|
||||
export const {
|
||||
|
@ -132,5 +132,5 @@ export function getLastNotNullFieldValue<T>(field: Field): T {
|
||||
return v;
|
||||
}
|
||||
}
|
||||
return undefined as any;
|
||||
return undefined as T;
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ export class ExpressionDatasourceApi extends DataSourceWithBackend<ExpressionQue
|
||||
super(instanceSettings);
|
||||
}
|
||||
|
||||
applyTemplateVariables(query: ExpressionQuery, scopedVars: ScopedVars): Record<string, any> {
|
||||
applyTemplateVariables(query: ExpressionQuery, scopedVars: ScopedVars) {
|
||||
const templateSrv = getTemplateSrv();
|
||||
return {
|
||||
...query,
|
||||
|
@ -33,7 +33,7 @@ export function decodeGeohash(geohash: string): [number, number] | undefined {
|
||||
return [lonCenter, latCenter];
|
||||
}
|
||||
|
||||
function refineInterval(interval: any[], base32Decoded: number, mask: number) {
|
||||
function refineInterval(interval: number[], base32Decoded: number, mask: number) {
|
||||
/* tslint:disable no-bitwise*/
|
||||
if (base32Decoded & mask) {
|
||||
interval[0] = (interval[0] + interval[1]) / 2;
|
||||
|
@ -4,7 +4,7 @@ import { Geometry } from 'ol/geom';
|
||||
import { DataFrame, Field, FieldType, getFieldTypeFromValue } from '@grafana/data';
|
||||
|
||||
interface FieldInfo {
|
||||
values: any[];
|
||||
values: Array<string | number | null | undefined>;
|
||||
types: Set<FieldType>;
|
||||
count: number;
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ interface InspectErrorTabProps {
|
||||
errors?: DataQueryError[];
|
||||
}
|
||||
|
||||
const parseErrorMessage = (message: string): { msg: string; json?: any } => {
|
||||
const parseErrorMessage = (message: string) => {
|
||||
try {
|
||||
const [msg, json] = message.split(/(\{.+)/);
|
||||
const jsonError = JSON.parse(json);
|
||||
|
@ -32,7 +32,7 @@ interface State {
|
||||
}
|
||||
|
||||
export class QueryInspector extends PureComponent<Props, State> {
|
||||
private formattedJson: any;
|
||||
private formattedJson?: {};
|
||||
private subs = new Subscription();
|
||||
|
||||
constructor(props: Props) {
|
||||
@ -146,7 +146,7 @@ export class QueryInspector extends PureComponent<Props, State> {
|
||||
});
|
||||
}
|
||||
|
||||
setFormattedJson = (formattedJson: any) => {
|
||||
setFormattedJson = (formattedJson: {}) => {
|
||||
this.formattedJson = formattedJson;
|
||||
};
|
||||
|
||||
|
@ -1,10 +1,12 @@
|
||||
import { createSelector } from '@reduxjs/toolkit';
|
||||
import { EntityState, createSelector } from '@reduxjs/toolkit';
|
||||
|
||||
import { Invitee } from 'app/types';
|
||||
|
||||
import { selectors } from './reducers';
|
||||
|
||||
export const { selectAll, selectById, selectTotal } = selectors;
|
||||
|
||||
const selectQuery = (_: any, query: string) => query;
|
||||
const selectQuery = (_state: EntityState<Invitee>, query: string) => query;
|
||||
export const selectInvitesMatchingQuery = createSelector([selectAll, selectQuery], (invites, searchQuery) => {
|
||||
const regex = new RegExp(searchQuery, 'i');
|
||||
const matches = invites.filter((invite) => regex.test(invite.name) || regex.test(invite.email));
|
||||
|
@ -25,9 +25,9 @@ type SubjectsInsteadOfObservables<T> = {
|
||||
[key in keyof T]: T[key] extends Observable<infer U> ? Subject<U> : T[key];
|
||||
};
|
||||
|
||||
type DepsWithSubjectsInsteadOfObservables<T = any> = SubjectsInsteadOfObservables<DataStreamHandlerDeps<T>>;
|
||||
type DepsWithSubjectsInsteadOfObservables<T = unknown> = SubjectsInsteadOfObservables<DataStreamHandlerDeps<T>>;
|
||||
|
||||
const createDeps = <T = any>(
|
||||
const createDeps = <T = unknown>(
|
||||
overrides?: Partial<DepsWithSubjectsInsteadOfObservables<T>>
|
||||
): DepsWithSubjectsInsteadOfObservables<T> => {
|
||||
return {
|
||||
@ -43,7 +43,7 @@ const createDeps = <T = any>(
|
||||
|
||||
class ValuesCollection<T> implements Unsubscribable {
|
||||
values: T[] = [];
|
||||
errors: any[] = [];
|
||||
errors: unknown[] = [];
|
||||
receivedComplete = false;
|
||||
subscription: Subscription | undefined;
|
||||
|
||||
|
@ -3,8 +3,8 @@ import { Subscriber } from 'rxjs';
|
||||
|
||||
// Observers, ie. functions passed to `observable.subscribe(...)`, are converted to a subclass of `Subscriber` before they are sent to the source Observable.
|
||||
// The conversion happens internally in the RxJS library - this transfer handler is catches them and wraps them with a proxy
|
||||
const subscriberTransferHandler: any = {
|
||||
canHandle(value: unknown): boolean {
|
||||
const subscriberTransferHandler = {
|
||||
canHandle(value: unknown): value is Subscriber<unknown> {
|
||||
return Boolean(value && value instanceof Subscriber);
|
||||
},
|
||||
|
||||
|
@ -1,26 +1,19 @@
|
||||
import React, { PureComponent } from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
import { ConnectedProps, connect } from 'react-redux';
|
||||
|
||||
import { NavModel } from '@grafana/data';
|
||||
import { VerticalGroup } from '@grafana/ui';
|
||||
import { Page } from 'app/core/components/Page/Page';
|
||||
import SharedPreferences from 'app/core/components/SharedPreferences/SharedPreferences';
|
||||
import { appEvents, contextSrv } from 'app/core/core';
|
||||
import { getNavModel } from 'app/core/selectors/navModel';
|
||||
import { AccessControlAction, Organization, StoreState } from 'app/types';
|
||||
import { AccessControlAction, StoreState } from 'app/types';
|
||||
import { ShowConfirmModalEvent } from 'app/types/events';
|
||||
|
||||
import OrgProfile from './OrgProfile';
|
||||
import { loadOrganization, updateOrganization } from './state/actions';
|
||||
import { setOrganizationName } from './state/reducers';
|
||||
|
||||
export interface Props {
|
||||
navModel: NavModel;
|
||||
organization: Organization;
|
||||
loadOrganization: typeof loadOrganization;
|
||||
setOrganizationName: typeof setOrganizationName;
|
||||
updateOrganization: typeof updateOrganization;
|
||||
}
|
||||
interface OwnProps {}
|
||||
|
||||
export class OrgDetailsPage extends PureComponent<Props> {
|
||||
async componentDidMount() {
|
||||
@ -89,4 +82,7 @@ const mapDispatchToProps = {
|
||||
updateOrganization,
|
||||
};
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(OrgDetailsPage);
|
||||
const connector = connect(mapStateToProps, mapDispatchToProps);
|
||||
export type Props = OwnProps & ConnectedProps<typeof connector>;
|
||||
|
||||
export default connector(OrgDetailsPage);
|
||||
|
@ -8,7 +8,7 @@ type OrganizationDependencies = { getBackendSrv: typeof getBackendSrv };
|
||||
|
||||
export function loadOrganization(
|
||||
dependencies: OrganizationDependencies = { getBackendSrv: getBackendSrv }
|
||||
): ThunkResult<any> {
|
||||
): ThunkResult<void> {
|
||||
return async (dispatch) => {
|
||||
const organizationResponse = await dependencies.getBackendSrv().get('/api/org');
|
||||
dispatch(organizationLoaded(organizationResponse));
|
||||
@ -19,7 +19,7 @@ export function loadOrganization(
|
||||
|
||||
export function updateOrganization(
|
||||
dependencies: OrganizationDependencies = { getBackendSrv: getBackendSrv }
|
||||
): ThunkResult<any> {
|
||||
): ThunkResult<void> {
|
||||
return async (dispatch, getStore) => {
|
||||
const organization = getStore().organization.organization;
|
||||
|
||||
@ -33,7 +33,7 @@ export function updateOrganization(
|
||||
export function setUserOrganization(
|
||||
orgId: number,
|
||||
dependencies: OrganizationDependencies = { getBackendSrv: getBackendSrv }
|
||||
): ThunkResult<any> {
|
||||
): ThunkResult<void> {
|
||||
return async (dispatch) => {
|
||||
const organizationResponse = await dependencies.getBackendSrv().post('/api/user/using/' + orgId);
|
||||
|
||||
@ -44,7 +44,7 @@ export function setUserOrganization(
|
||||
export function createOrganization(
|
||||
newOrg: { name: string },
|
||||
dependencies: OrganizationDependencies = { getBackendSrv: getBackendSrv }
|
||||
): ThunkResult<any> {
|
||||
): ThunkResult<void> {
|
||||
return async (dispatch) => {
|
||||
const result = await dependencies.getBackendSrv().post('/api/orgs/', newOrg);
|
||||
|
||||
|
@ -107,7 +107,7 @@ export function PanelRenderer<P extends object = {}, F extends object = {}>(prop
|
||||
);
|
||||
}
|
||||
|
||||
function useOptionDefaults<P extends object = {}, F extends object = {}>(
|
||||
function useOptionDefaults<P extends Record<string, unknown> = {}, F extends object = {}>(
|
||||
plugin: PanelPlugin | undefined,
|
||||
options: P,
|
||||
fieldConfig: FieldConfigSource<F>
|
||||
|
@ -2,7 +2,7 @@ import { FieldConfigSource } from '@grafana/data';
|
||||
|
||||
export interface VizTypeChangeDetails {
|
||||
pluginId: string;
|
||||
options?: any;
|
||||
options?: Record<string, unknown>;
|
||||
fieldConfig?: FieldConfigSource;
|
||||
withModKey?: boolean;
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ export function cleanUpPanelState(panelKey: string): ThunkResult<void> {
|
||||
export interface ChangePanelPluginAndOptionsArgs {
|
||||
panel: PanelModel;
|
||||
pluginId: string;
|
||||
options?: any;
|
||||
options?: Record<string, unknown>;
|
||||
fieldConfig?: FieldConfigSource;
|
||||
transformations?: DataTransformerConfig[];
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ export type RootPanelsState = Record<string, PanelState>;
|
||||
export interface PanelState {
|
||||
plugin?: PanelPlugin;
|
||||
angularComponent?: AngularComponent;
|
||||
instanceState?: any | null;
|
||||
instanceState?: unknown | null;
|
||||
}
|
||||
|
||||
export const initialState: RootPanelsState = {};
|
||||
@ -54,7 +54,7 @@ export interface SetPanelAngularComponentPayload {
|
||||
|
||||
export interface SetPanelInstanceStatePayload {
|
||||
key: string;
|
||||
value: any;
|
||||
value: unknown;
|
||||
}
|
||||
|
||||
export const {
|
||||
|
@ -10,7 +10,7 @@ interface Props {
|
||||
|
||||
// useDebounce has a bug which causes it to fire on first render. This wrapper prevents that.
|
||||
// https://github.com/streamich/react-use/issues/759
|
||||
const useDebounceWithoutFirstRender = (callBack: () => any, delay = 0, deps: React.DependencyList = []) => {
|
||||
const useDebounceWithoutFirstRender = (callBack: () => void, delay = 0, deps: React.DependencyList = []) => {
|
||||
const isFirstRender = useRef(true);
|
||||
const debounceDeps = [...deps, isFirstRender];
|
||||
|
||||
|
@ -356,7 +356,7 @@ export function getNameOrUid(ref?: string | DataSourceRef | null): string | unde
|
||||
return isString ? ref : ref?.uid;
|
||||
}
|
||||
|
||||
export function variableInterpolation(value: any[]) {
|
||||
export function variableInterpolation<T>(value: T | T[]) {
|
||||
if (Array.isArray(value)) {
|
||||
return value[0];
|
||||
}
|
||||
|
@ -14,11 +14,11 @@ export function getPluginSettings(pluginId: string, options?: Partial<BackendSrv
|
||||
}
|
||||
return getBackendSrv()
|
||||
.get(`/api/plugins/${pluginId}/settings`, undefined, undefined, options)
|
||||
.then((settings: any) => {
|
||||
.then((settings) => {
|
||||
pluginInfoCache[pluginId] = settings;
|
||||
return settings;
|
||||
})
|
||||
.catch((err: any) => {
|
||||
.catch(() => {
|
||||
return Promise.reject(new Error('Unknown Plugin'));
|
||||
});
|
||||
}
|
||||
|
@ -182,7 +182,6 @@ const enum Op {
|
||||
NOT_IN = 'select_not_any_in',
|
||||
MACROS = 'macros',
|
||||
}
|
||||
// eslint-ignore
|
||||
const customOperators = getCustomOperators(BasicConfig);
|
||||
const textWidget = BasicConfig.types.text.widgets.text;
|
||||
const opers = [...(textWidget.operators || []), Op.IN, Op.NOT_IN];
|
||||
@ -317,7 +316,6 @@ function getCustomOperators(config: BasicConfig) {
|
||||
}
|
||||
|
||||
// value: string | List<string> but AQB uses a different version of Immutable
|
||||
// eslint-ignore
|
||||
function splitIfString(value: any) {
|
||||
if (isString(value)) {
|
||||
return value.split(',');
|
||||
|
@ -217,7 +217,7 @@ export abstract class SqlDatasource extends DataSourceWithBackend<SQLQuery, SQLO
|
||||
}
|
||||
|
||||
// NOTE: this always runs with the `@grafana/data/getDefaultTimeRange` time range
|
||||
async runSql<T>(query: string, options?: RunSQLOptions) {
|
||||
async runSql<T extends object>(query: string, options?: RunSQLOptions) {
|
||||
const range = getDefaultTimeRange();
|
||||
const frame = await this.runMetaQuery({ rawSql: query, format: QueryFormat.Table, refId: options?.refId }, range);
|
||||
return new DataFrameView<T>(frame);
|
||||
|
@ -75,7 +75,7 @@ describe('datasource_srv', () => {
|
||||
type: 'test-db',
|
||||
name: 'mmm',
|
||||
uid: 'uid-code-mmm',
|
||||
meta: { metrics: true, annotations: true } as any,
|
||||
meta: { metrics: true, annotations: true },
|
||||
},
|
||||
'-- Grafana --': {
|
||||
type: 'grafana',
|
||||
@ -169,7 +169,7 @@ describe('datasource_srv', () => {
|
||||
});
|
||||
|
||||
it('Can get by variable', async () => {
|
||||
const ds = (await dataSourceSrv.get('${datasource}')) as any;
|
||||
const ds = await dataSourceSrv.get('${datasource}');
|
||||
expect(ds.meta).toBe(dataSourceInit.BBB.meta);
|
||||
|
||||
const ds2 = await dataSourceSrv.get('${datasource}', { datasource: { text: 'Prom', value: 'uid-code-aaa' } });
|
||||
|
@ -3,7 +3,7 @@ import { Observable, Subscription } from 'rxjs';
|
||||
|
||||
import { expectObservable, forceObservableCompletion } from './utils';
|
||||
|
||||
function tryExpectations(received: unknown[], expectations: (received: unknown[]) => void): jest.CustomMatcherResult {
|
||||
function tryExpectations<T = unknown>(received: T[], expectations: (received: T[]) => void): jest.CustomMatcherResult {
|
||||
try {
|
||||
expectations(received);
|
||||
return {
|
||||
@ -27,9 +27,9 @@ function tryExpectations(received: unknown[], expectations: (received: unknown[]
|
||||
* the observable ended (or emitted error). If Observable does not complete within OBSERVABLE_TEST_TIMEOUT_IN_MS the
|
||||
* test fails.
|
||||
*/
|
||||
export function toEmitValuesWith(
|
||||
received: Observable<any>,
|
||||
expectations: (actual: any[]) => void
|
||||
export function toEmitValuesWith<T = unknown>(
|
||||
received: Observable<T>,
|
||||
expectations: (actual: T[]) => void
|
||||
): Promise<jest.CustomMatcherResult> {
|
||||
const failsChecks = expectObservable(received);
|
||||
if (failsChecks) {
|
||||
@ -37,7 +37,7 @@ export function toEmitValuesWith(
|
||||
}
|
||||
|
||||
return new Promise((resolve) => {
|
||||
const receivedValues: any[] = [];
|
||||
const receivedValues: T[] = [];
|
||||
const subscription = new Subscription();
|
||||
|
||||
subscription.add(
|
||||
|
@ -2,12 +2,10 @@ import { Observable } from 'rxjs';
|
||||
|
||||
export const OBSERVABLE_TEST_TIMEOUT_IN_MS = 1000;
|
||||
|
||||
export type ObservableType<T> = T extends Observable<infer V> ? V : never;
|
||||
|
||||
export interface ObservableMatchers<R, T = {}> extends jest.ExpectExtendMap {
|
||||
toEmitValues<E = ObservableType<T>>(received: T, expected: E[]): Promise<jest.CustomMatcherResult>;
|
||||
toEmitValuesWith<E = ObservableType<T>>(
|
||||
received: T,
|
||||
expectations: (received: E[]) => void
|
||||
toEmitValues<T>(received: Observable<T>, expected: T[]): Promise<jest.CustomMatcherResult>;
|
||||
toEmitValuesWith<T>(
|
||||
received: Observable<T>,
|
||||
expectations: (received: T[]) => void
|
||||
): Promise<jest.CustomMatcherResult>;
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ export function ControllerTestContext(this: any) {
|
||||
$provide.value('templateSrv', self.templateSrv);
|
||||
$provide.value('$element', self.$element);
|
||||
$provide.value('$sanitize', self.$sanitize);
|
||||
each(mocks, (value: any, key: any) => {
|
||||
each(mocks, (value, key) => {
|
||||
$provide.value(key, value);
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user