diff --git a/.betterer.results b/.betterer.results index fc74334c08f..fe83a03e916 100644 --- a/.betterer.results +++ b/.betterer.results @@ -5387,13 +5387,9 @@ exports[`better eslint`] = { [0, 0, 0, "Do not use any type assertions.", "0"], [0, 0, 0, "Do not use any type assertions.", "1"] ], - "public/app/features/variables/shared/testing/datasourceVariableBuilder.ts:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"] - ], "public/app/features/variables/shared/testing/optionsVariableBuilder.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, "Unexpected any. Specify a different type.", "2"] + [0, 0, 0, "Do not use any type assertions.", "1"] ], "public/app/features/variables/shared/testing/variableBuilder.ts:5381": [ [0, 0, 0, "Do not use any type assertions.", "0"] @@ -5404,15 +5400,9 @@ 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.", "5"], [0, 0, 0, "Do not use any type assertions.", "6"], - [0, 0, 0, "Do not use any type assertions.", "7"], - [0, 0, 0, "Do not use any type assertions.", "8"], - [0, 0, 0, "Do not use any type assertions.", "9"], - [0, 0, 0, "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.", "7"] ], "public/app/features/variables/state/keyedVariablesReducer.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"], @@ -5443,13 +5433,12 @@ exports[`better eslint`] = { "public/app/features/variables/system/adapter.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, "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, "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, "Unexpected any. Specify a different type.", "7"] ], "public/app/features/variables/types.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"], @@ -5466,9 +5455,7 @@ exports[`better eslint`] = { [0, 0, 0, "Unexpected any. Specify a different type.", "4"], [0, 0, 0, "Unexpected any. Specify a different type.", "5"], [0, 0, 0, "Unexpected any. Specify a different type.", "6"], - [0, 0, 0, "Unexpected any. Specify a different type.", "7"], - [0, 0, 0, "Unexpected any. Specify a different type.", "8"], - [0, 0, 0, "Do not use any type assertions.", "9"] + [0, 0, 0, "Do not use any type assertions.", "7"] ], "public/app/features/visualization/data-hover/DataHoverRows.tsx:5381": [ [0, 0, 0, "Styles should be written using objects.", "0"] @@ -5504,8 +5491,7 @@ exports[`better eslint`] = { ], "public/app/plugins/datasource/cloud-monitoring/CloudMonitoringMetricFindQuery.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, "Unexpected any. Specify a different type.", "2"] + [0, 0, 0, "Unexpected any. Specify a different type.", "1"] ], "public/app/plugins/datasource/cloud-monitoring/annotationSupport.ts:5381": [ [0, 0, 0, "Do not use any type assertions.", "0"], @@ -5514,41 +5500,24 @@ exports[`better eslint`] = { "public/app/plugins/datasource/cloud-monitoring/components/Aggregation.tsx:5381": [ [0, 0, 0, "Do not use any type assertions.", "0"] ], - "public/app/plugins/datasource/cloud-monitoring/components/AliasBy.tsx:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"], - [0, 0, 0, "Unexpected any. Specify a different type.", "1"] - ], "public/app/plugins/datasource/cloud-monitoring/components/CloudMonitoringCheatSheet.tsx:5381": [ [0, 0, 0, "Styles should be written using objects.", "0"] ], - "public/app/plugins/datasource/cloud-monitoring/components/MQLQueryEditor.tsx:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"] - ], "public/app/plugins/datasource/cloud-monitoring/components/VariableQueryEditor.tsx: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"], - [0, 0, 0, "Unexpected any. Specify a different type.", "4"], - [0, 0, 0, "Unexpected any. Specify a different type.", "5"], - [0, 0, 0, "Unexpected any. Specify a different type.", "6"] + [0, 0, 0, "Do not use any type assertions.", "0"] ], "public/app/plugins/datasource/cloud-monitoring/components/VisualMetricQueryEditor.tsx:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"], - [0, 0, 0, "Styles should be written using objects.", "1"] + [0, 0, 0, "Styles should be written using objects.", "0"] ], "public/app/plugins/datasource/cloud-monitoring/datasource.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.", "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, "Do not use any type assertions.", "5"] + [0, 0, 0, "Do not use any type assertions.", "3"] ], "public/app/plugins/datasource/cloud-monitoring/functions.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, "Unexpected any. Specify a different type.", "2"] + [0, 0, 0, "Do not use any type assertions.", "1"] ], "public/app/plugins/datasource/cloud-monitoring/types/types.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"] @@ -5604,12 +5573,10 @@ exports[`better eslint`] = { ], "public/app/plugins/datasource/cloudwatch/utils/datalinks.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.", "1"] ], "public/app/plugins/datasource/cloudwatch/utils/logsRetry.ts:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"], - [0, 0, 0, "Unexpected any. Specify a different type.", "1"] + [0, 0, 0, "Unexpected any. Specify a different type.", "0"] ], "public/app/plugins/datasource/dashboard/DashboardQueryEditor.tsx:5381": [ [0, 0, 0, "Do not use any type assertions.", "0"] @@ -5639,12 +5606,12 @@ 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, "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, "Do not use any type assertions.", "25"], + [0, 0, 0, "Unexpected any. Specify a different type.", "25"], [0, 0, 0, "Unexpected any. Specify a different type.", "26"], [0, 0, 0, "Unexpected any. Specify a different type.", "27"], [0, 0, 0, "Unexpected any. Specify a different type.", "28"], @@ -5654,17 +5621,7 @@ exports[`better eslint`] = { [0, 0, 0, "Unexpected any. Specify a different type.", "32"], [0, 0, 0, "Unexpected any. Specify a different type.", "33"], [0, 0, 0, "Unexpected any. Specify a different type.", "34"], - [0, 0, 0, "Unexpected any. Specify a different type.", "35"], - [0, 0, 0, "Unexpected any. Specify a different type.", "36"], - [0, 0, 0, "Unexpected any. Specify a different type.", "37"], - [0, 0, 0, "Unexpected any. Specify a different type.", "38"], - [0, 0, 0, "Unexpected any. Specify a different type.", "39"], - [0, 0, 0, "Unexpected any. Specify a different type.", "40"], - [0, 0, 0, "Unexpected any. Specify a different type.", "41"], - [0, 0, 0, "Unexpected any. Specify a different type.", "42"], - [0, 0, 0, "Unexpected any. Specify a different type.", "43"], - [0, 0, 0, "Unexpected any. Specify a different type.", "44"], - [0, 0, 0, "Unexpected any. Specify a different type.", "45"] + [0, 0, 0, "Unexpected any. Specify a different type.", "35"] ], "public/app/plugins/datasource/elasticsearch/LanguageProvider.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"], @@ -5688,17 +5645,12 @@ exports[`better eslint`] = { [0, 0, 0, "Unexpected any. Specify a different type.", "3"], [0, 0, 0, "Unexpected any. Specify a different type.", "4"], [0, 0, 0, "Unexpected any. Specify a different type.", "5"], - [0, 0, 0, "Unexpected any. Specify a different type.", "6"], + [0, 0, 0, "Do not use any type assertions.", "6"], [0, 0, 0, "Unexpected any. Specify a different type.", "7"], - [0, 0, 0, "Unexpected any. Specify a different type.", "8"], - [0, 0, 0, "Unexpected any. Specify a different type.", "9"], - [0, 0, 0, "Do not use any type assertions.", "10"], - [0, 0, 0, "Unexpected any. Specify a different type.", "11"], - [0, 0, 0, "Unexpected any. Specify a different type.", "12"] + [0, 0, 0, "Unexpected any. Specify a different type.", "8"] ], "public/app/plugins/datasource/elasticsearch/components/AddRemove.tsx:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"], - [0, 0, 0, "Styles should be written using objects.", "1"] + [0, 0, 0, "Styles should be written using objects.", "0"] ], "public/app/plugins/datasource/elasticsearch/components/MetricPicker.tsx:5381": [ [0, 0, 0, "Styles should be written using objects.", "0"] @@ -5715,21 +5667,14 @@ exports[`better eslint`] = { [0, 0, 0, "Styles should be written using objects.", "2"] ], "public/app/plugins/datasource/elasticsearch/components/QueryEditor/BucketAggregationsEditor/SettingsEditor/TermsSettingsEditor.tsx:5381": [ - [0, 0, 0, "Do not use any type assertions.", "0"], - [0, 0, 0, "Do not use any type assertions.", "1"] + [0, 0, 0, "Do not use any type assertions.", "0"] ], "public/app/plugins/datasource/elasticsearch/components/QueryEditor/BucketAggregationsEditor/aggregations.ts:5381": [ [0, 0, 0, "Do not use any type assertions.", "0"] ], - "public/app/plugins/datasource/elasticsearch/components/QueryEditor/BucketAggregationsEditor/state/actions.ts:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"] - ], "public/app/plugins/datasource/elasticsearch/components/QueryEditor/BucketAggregationsEditor/state/reducer.ts:5381": [ [0, 0, 0, "Do not use any type assertions.", "0"] ], - "public/app/plugins/datasource/elasticsearch/components/QueryEditor/ElasticsearchQueryContext.tsx:5381": [ - [0, 0, 0, "Do not use any type assertions.", "0"] - ], "public/app/plugins/datasource/elasticsearch/components/QueryEditor/MetricAggregationsEditor/MetricEditor.tsx:5381": [ [0, 0, 0, "Do not use any type assertions.", "0"] ], @@ -5749,11 +5694,6 @@ exports[`better eslint`] = { "public/app/plugins/datasource/elasticsearch/components/QueryEditor/MetricAggregationsEditor/aggregations.ts:5381": [ [0, 0, 0, "Do not use any type assertions.", "0"] ], - "public/app/plugins/datasource/elasticsearch/components/QueryEditor/MetricAggregationsEditor/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"] - ], "public/app/plugins/datasource/elasticsearch/components/QueryEditor/MetricAggregationsEditor/state/reducer.ts:5381": [ [0, 0, 0, "Do not use any type assertions.", "0"] ], @@ -5797,8 +5737,7 @@ exports[`better eslint`] = { [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.", "5"] ], "public/app/plugins/datasource/elasticsearch/hooks/useStatelessReducer.ts:5381": [ [0, 0, 0, "Do not use any type assertions.", "0"] @@ -5810,26 +5749,17 @@ exports[`better eslint`] = { [0, 0, 0, "Styles should be written using objects.", "0"], [0, 0, 0, "Styles should be written using objects.", "1"] ], - "public/app/plugins/datasource/grafana-testdata-datasource/ConfigEditor.tsx:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"] - ], "public/app/plugins/datasource/grafana-testdata-datasource/QueryEditor.tsx:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"], [0, 0, 0, "Do not use any type assertions.", "1"], [0, 0, 0, "Do not use any type assertions.", "2"], - [0, 0, 0, "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, "Unexpected any. Specify a different type.", "6"] + [0, 0, 0, "Do not use any type assertions.", "3"], + [0, 0, 0, "Unexpected any. Specify a different type.", "4"] ], "public/app/plugins/datasource/grafana-testdata-datasource/components/RandomWalkEditor.tsx:5381": [ [0, 0, 0, "Do not use any type assertions.", "0"], - [0, 0, 0, "Do not use any type assertions.", "1"], - [0, 0, 0, "Unexpected any. Specify a different type.", "2"], - [0, 0, 0, "Do not use any type assertions.", "3"] - ], - "public/app/plugins/datasource/grafana-testdata-datasource/components/RawFrameEditor.tsx:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"] + [0, 0, 0, "Unexpected any. Specify a different type.", "1"], + [0, 0, 0, "Do not use any type assertions.", "2"] ], "public/app/plugins/datasource/grafana-testdata-datasource/components/SimulationQueryEditor.tsx:5381": [ [0, 0, 0, "Do not use any type assertions.", "0"], @@ -5847,9 +5777,7 @@ exports[`better eslint`] = { [0, 0, 0, "Unexpected any. Specify a different type.", "1"] ], "public/app/plugins/datasource/grafana-testdata-datasource/nodeGraphUtils.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.", "0"] ], "public/app/plugins/datasource/grafana-testdata-datasource/runStreams.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"] @@ -5867,11 +5795,6 @@ exports[`better eslint`] = { [0, 0, 0, "Do not use any type assertions.", "6"], [0, 0, 0, "Styles should be written using objects.", "7"] ], - "public/app/plugins/datasource/grafana/components/SearchEditor.tsx:5381": [ - [0, 0, 0, "Do not use any type assertions.", "0"], - [0, 0, 0, "Unexpected any. Specify a different type.", "1"], - [0, 0, 0, "Do not use any type assertions.", "2"] - ], "public/app/plugins/datasource/grafana/components/TimePickerInput.tsx:5381": [ [0, 0, 0, "Styles should be written using objects.", "0"], [0, 0, 0, "Styles should be written using objects.", "1"], @@ -5890,22 +5813,18 @@ exports[`better eslint`] = { [0, 0, 0, "Do not use any type assertions.", "1"], [0, 0, 0, "Do not use any type assertions.", "2"], [0, 0, 0, "Do not use any type assertions.", "3"], - [0, 0, 0, "Do not use any type assertions.", "4"], - [0, 0, 0, "Unexpected any. Specify a different type.", "5"], - [0, 0, 0, "Unexpected any. Specify a different type.", "6"], + [0, 0, 0, "Unexpected any. Specify a different type.", "4"], + [0, 0, 0, "Do not use any type assertions.", "5"], + [0, 0, 0, "Do not use any type assertions.", "6"], [0, 0, 0, "Do not use any type assertions.", "7"], - [0, 0, 0, "Do not use any type assertions.", "8"], - [0, 0, 0, "Do not use any type assertions.", "9"], - [0, 0, 0, "Unexpected any. Specify a different type.", "10"], - [0, 0, 0, "Unexpected any. Specify a different type.", "11"], - [0, 0, 0, "Do not use any type assertions.", "12"] + [0, 0, 0, "Unexpected any. Specify a different type.", "8"], + [0, 0, 0, "Do not use any type assertions.", "9"] ], "public/app/plugins/datasource/graphite/components/AddGraphiteFunction.tsx:5381": [ [0, 0, 0, "Styles should be written using objects.", "0"] ], "public/app/plugins/datasource/graphite/components/FunctionEditor.tsx:5381": [ - [0, 0, 0, "Styles should be written using objects.", "0"], - [0, 0, 0, "Unexpected any. Specify a different type.", "1"] + [0, 0, 0, "Styles should be written using objects.", "0"] ], "public/app/plugins/datasource/graphite/components/FunctionParamEditor.tsx:5381": [ [0, 0, 0, "Styles should be written using objects.", "0"] diff --git a/public/app/features/variables/datasource/actions.test.ts b/public/app/features/variables/datasource/actions.test.ts index 42864b95de4..4d3a5ca8e94 100644 --- a/public/app/features/variables/datasource/actions.test.ts +++ b/public/app/features/variables/datasource/actions.test.ts @@ -29,7 +29,12 @@ function getTestContext({ sources = [], query, regex }: Args = {}) { const getListMock = jest.fn().mockReturnValue(sources); const getDatasourceSrvMock = jest.fn().mockReturnValue({ getList: getListMock }); const dependencies: DataSourceVariableActionDependencies = { getDatasourceSrv: getDatasourceSrvMock }; - const datasource = datasourceBuilder().withId('0').withRootStateKey('key').withQuery(query).withRegEx(regex).build(); + const datasource = datasourceBuilder() + .withId('0') + .withRootStateKey('key') + .withQuery(query!) + .withRegEx(regex!) + .build(); return { getListMock, getDatasourceSrvMock, dependencies, datasource }; } diff --git a/public/app/features/variables/shared/testing/datasourceVariableBuilder.ts b/public/app/features/variables/shared/testing/datasourceVariableBuilder.ts index 8f52026e81e..ad370b7eed5 100644 --- a/public/app/features/variables/shared/testing/datasourceVariableBuilder.ts +++ b/public/app/features/variables/shared/testing/datasourceVariableBuilder.ts @@ -10,7 +10,7 @@ export class DatasourceVariableBuilder< return this; } - withRegEx(regex: any) { + withRegEx(regex: string) { this.variable.regex = regex; return this; } diff --git a/public/app/features/variables/shared/testing/optionsVariableBuilder.ts b/public/app/features/variables/shared/testing/optionsVariableBuilder.ts index 97bed58572a..fcb33006b88 100644 --- a/public/app/features/variables/shared/testing/optionsVariableBuilder.ts +++ b/public/app/features/variables/shared/testing/optionsVariableBuilder.ts @@ -35,7 +35,7 @@ export class OptionsVariableBuilder extends Varia return this; } - withQuery(query: any) { + withQuery(query: string) { this.variable.query = query; return this; } diff --git a/public/app/features/variables/state/actions.ts b/public/app/features/variables/state/actions.ts index f57567f5fd6..47cc2c83c91 100644 --- a/public/app/features/variables/state/actions.ts +++ b/public/app/features/variables/state/actions.ts @@ -617,7 +617,7 @@ export const variableUpdated = ( }; const node = g.getNode(variableInState.name); - let promises: Array> = []; + let promises: Array> = []; if (node) { promises = node.getOptimizedInputEdges().map((e) => { const variable = variables.find((v) => v.name === e.inputNode?.name); @@ -758,8 +758,8 @@ const getVariablesThatNeedRefreshOld = (key: string, state: StoreState): Variabl const allVariables = getVariablesByKey(key, state); const variablesThatNeedRefresh = allVariables.filter((variable) => { - if (variable.hasOwnProperty('refresh') && variable.hasOwnProperty('options')) { - const variableWithRefresh = variable as unknown as QueryVariableModel; + if ('refresh' in variable && 'options' in variable) { + const variableWithRefresh = variable; return variableWithRefresh.refresh === VariableRefresh.onTimeRangeChanged; } return false; @@ -828,7 +828,7 @@ export const timeRangeUpdated = export const templateVarsChangedInUrl = (key: string, vars: ExtendedUrlQueryMap, events: typeof appEvents = appEvents): ThunkResult => async (dispatch, getState) => { - const update: Array> = []; + const update: Array> = []; const dashboard = getState().dashboard.getModel(); const variables = getVariablesByKey(key, getState()); @@ -888,7 +888,7 @@ export const templateVarsChangedInUrl = } }; -export function isVariableUrlValueDifferentFromCurrent(variable: TypedVariableModel, urlValue: any): boolean { +export function isVariableUrlValueDifferentFromCurrent(variable: TypedVariableModel, urlValue: unknown): boolean { const variableValue = variableAdapters.get(variable.type).getValueForUrl(variable); let stringUrlValue = ensureStringValues(urlValue); if (Array.isArray(variableValue) && !Array.isArray(stringUrlValue)) { @@ -1032,12 +1032,12 @@ export const updateOptions = export const createVariableErrorNotification = ( message: string, - error: any, + error: unknown, identifier?: KeyedVariableIdentifier ): AppNotification => createErrorNotification( `${identifier ? `Templating [${identifier.id}]` : 'Templating'}`, - `${message} ${error.message}` + error instanceof Error ? `${message} ${error.message}` : `${message}` ); export const completeVariableLoading = diff --git a/public/app/features/variables/system/adapter.ts b/public/app/features/variables/system/adapter.ts index 82b8c277da5..71c4f341909 100644 --- a/public/app/features/variables/system/adapter.ts +++ b/public/app/features/variables/system/adapter.ts @@ -20,7 +20,7 @@ export const createSystemVariableAdapter = (): VariableAdapter '' } }, state: LoadingState.Done, }, - reducer: (state: any, action: any) => state, + reducer: (state: any) => state, picker: null as unknown as ComponentType>>, editor: null as unknown as ComponentType>>, dependsOn: () => { diff --git a/public/app/features/variables/utils.ts b/public/app/features/variables/utils.ts index 8ab8906f7e2..4372ff37bea 100644 --- a/public/app/features/variables/utils.ts +++ b/public/app/features/variables/utils.ts @@ -184,7 +184,7 @@ export function getVariableTypes(): Array<{ label: string; value: VariableType } })); } -function getUrlValueForComparison(value: any): any { +function getUrlValueForComparison(value: unknown) { if (isArray(value)) { if (value.length === 0) { value = undefined; diff --git a/public/app/plugins/datasource/cloud-monitoring/CloudMonitoringMetricFindQuery.ts b/public/app/plugins/datasource/cloud-monitoring/CloudMonitoringMetricFindQuery.ts index 1ae2c1096e4..6131457fb25 100644 --- a/public/app/plugins/datasource/cloud-monitoring/CloudMonitoringMetricFindQuery.ts +++ b/public/app/plugins/datasource/cloud-monitoring/CloudMonitoringMetricFindQuery.ts @@ -1,7 +1,5 @@ import { isString } from 'lodash'; -import { SelectableValue } from '@grafana/data'; - import { ALIGNMENT_PERIODS, SELECTORS } from './constants'; import CloudMonitoringDatasource from './datasource'; import { @@ -59,7 +57,7 @@ export default class CloudMonitoringMetricFindQuery { async handleProjectsQuery() { const projects = await this.datasource.getProjects(); - return (projects as SelectableValue).map((s: { label: string; value: string }) => ({ + return projects.map((s) => ({ text: s.label, value: s.value, expandable: true, diff --git a/public/app/plugins/datasource/cloud-monitoring/components/AliasBy.tsx b/public/app/plugins/datasource/cloud-monitoring/components/AliasBy.tsx index f369f8bdfb3..eef85c5e9b5 100644 --- a/public/app/plugins/datasource/cloud-monitoring/components/AliasBy.tsx +++ b/public/app/plugins/datasource/cloud-monitoring/components/AliasBy.tsx @@ -6,7 +6,7 @@ import { Input } from '@grafana/ui'; export interface Props { refId: string; - onChange: (alias: any) => void; + onChange: (alias: string) => void; value?: string; } @@ -15,14 +15,14 @@ export const AliasBy = ({ refId, value = '', onChange }: Props) => { const propagateOnChange = debounce(onChange, 1000); - onChange = (e: any) => { - setAlias(e.target.value); - propagateOnChange(e.target.value); + const onInputChange = (e: React.ChangeEvent) => { + setAlias(e.currentTarget.value); + propagateOnChange(e.currentTarget.value); }; return ( - + ); }; diff --git a/public/app/plugins/datasource/cloud-monitoring/components/MQLQueryEditor.tsx b/public/app/plugins/datasource/cloud-monitoring/components/MQLQueryEditor.tsx index 48cbd630f49..324b55b5e02 100644 --- a/public/app/plugins/datasource/cloud-monitoring/components/MQLQueryEditor.tsx +++ b/public/app/plugins/datasource/cloud-monitoring/components/MQLQueryEditor.tsx @@ -9,7 +9,7 @@ export interface Props { } export function MQLQueryEditor({ query, onChange, onRunQuery }: React.PropsWithChildren) { - const onKeyDown = (event: any) => { + const onKeyDown = (event: React.KeyboardEvent) => { if (event.key === 'Enter' && (event.shiftKey || event.ctrlKey)) { event.preventDefault(); onRunQuery(); diff --git a/public/app/plugins/datasource/cloud-monitoring/components/VariableQueryEditor.tsx b/public/app/plugins/datasource/cloud-monitoring/components/VariableQueryEditor.tsx index 8a8bb39d032..ac3a804caaf 100644 --- a/public/app/plugins/datasource/cloud-monitoring/components/VariableQueryEditor.tsx +++ b/public/app/plugins/datasource/cloud-monitoring/components/VariableQueryEditor.tsx @@ -66,7 +66,7 @@ export class CloudMonitoringVariableQueryEditor extends PureComponent ({ + const services = extractServicesFromMetricDescriptors(metricDescriptors).map((m) => ({ value: m.service, label: m.serviceShortName, })); @@ -87,7 +87,7 @@ export class CloudMonitoringVariableQueryEditor extends PureComponent ({ + .map((v) => ({ value: `$${v.name}`, label: `$${v.name}`, })), diff --git a/public/app/plugins/datasource/cloud-monitoring/components/VisualMetricQueryEditor.tsx b/public/app/plugins/datasource/cloud-monitoring/components/VisualMetricQueryEditor.tsx index 566cbd2b8c5..c2f34da823a 100644 --- a/public/app/plugins/datasource/cloud-monitoring/components/VisualMetricQueryEditor.tsx +++ b/public/app/plugins/datasource/cloud-monitoring/components/VisualMetricQueryEditor.tsx @@ -42,7 +42,7 @@ export function Editor({ aliasBy, onChangeAliasBy, }: React.PropsWithChildren) { - const [labels, setLabels] = useState<{ [k: string]: any }>({}); + const [labels, setLabels] = useState<{ [k: string]: string[] }>({}); const [metricDescriptors, setMetricDescriptors] = useState([]); const [metricDescriptor, setMetricDescriptor] = useState(); const [metrics, setMetrics] = useState>>([]); diff --git a/public/app/plugins/datasource/cloud-monitoring/datasource.ts b/public/app/plugins/datasource/cloud-monitoring/datasource.ts index b0ebe939538..9ac999a88d0 100644 --- a/public/app/plugins/datasource/cloud-monitoring/datasource.ts +++ b/public/app/plugins/datasource/cloud-monitoring/datasource.ts @@ -54,7 +54,7 @@ export default class CloudMonitoringDatasource extends DataSourceWithBackend< return super.query(request); } - applyTemplateVariables(target: CloudMonitoringQuery, scopedVars: ScopedVars): Record { + applyTemplateVariables(target: CloudMonitoringQuery, scopedVars: ScopedVars) { const { timeSeriesList, timeSeriesQuery, sloQuery, promQLQuery } = target; return { @@ -335,9 +335,7 @@ export default class CloudMonitoringDatasource extends DataSourceWithBackend< } interpolateVariablesInQueries(queries: CloudMonitoringQuery[], scopedVars: ScopedVars): CloudMonitoringQuery[] { - return queries.map( - (query) => this.applyTemplateVariables(this.migrateQuery(query), scopedVars) as CloudMonitoringQuery - ); + return queries.map((query) => this.applyTemplateVariables(this.migrateQuery(query), scopedVars)); } interpolateFilters(filters: string[], scopedVars: ScopedVars) { diff --git a/public/app/plugins/datasource/cloud-monitoring/functions.ts b/public/app/plugins/datasource/cloud-monitoring/functions.ts index 70de5c65d29..13e0aceb1fe 100644 --- a/public/app/plugins/datasource/cloud-monitoring/functions.ts +++ b/public/app/plugins/datasource/cloud-monitoring/functions.ts @@ -90,7 +90,15 @@ export const getAlignmentPickerData = ( }; export const labelsToGroupedOptions = (groupBys: string[]) => { - const groups = groupBys.reduce((acc: any, curr: string) => { + const groups = groupBys.reduce< + Record< + string, + Array<{ + value: string; + label: string; + }> + > + >((acc, curr) => { const arr = curr.split('.').map(startCase); const group = (arr.length === 2 ? arr : initial(arr)).join(' '); const option = { diff --git a/public/app/plugins/datasource/cloudwatch/utils/datalinks.ts b/public/app/plugins/datasource/cloudwatch/utils/datalinks.ts index aa35d4b9c34..a9b051a9e82 100644 --- a/public/app/plugins/datasource/cloudwatch/utils/datalinks.ts +++ b/public/app/plugins/datasource/cloudwatch/utils/datalinks.ts @@ -43,7 +43,7 @@ export async function addDataLinksToLogsResponse( } } -async function createInternalXrayLink(datasourceUid: string, region: string) { +async function createInternalXrayLink(datasourceUid: string, region: string): Promise { let ds; try { ds = await getDataSourceSrv().get(datasourceUid); @@ -60,7 +60,7 @@ async function createInternalXrayLink(datasourceUid: string, region: string) { datasourceUid: datasourceUid, datasourceName: ds.name, }, - } as DataLink; + }; } function createAwsConsoleLink( diff --git a/public/app/plugins/datasource/cloudwatch/utils/logsRetry.ts b/public/app/plugins/datasource/cloudwatch/utils/logsRetry.ts index eea4b7c2077..ad13b154a59 100644 --- a/public/app/plugins/datasource/cloudwatch/utils/logsRetry.ts +++ b/public/app/plugins/datasource/cloudwatch/utils/logsRetry.ts @@ -27,7 +27,7 @@ export function runWithRetry( ): Observable<{ frames: DataFrame[]; error?: DataQueryError }> { const startTime = new Date(); let retries = 0; - let timerID: any; + let timerID: ReturnType; let subscription: Subscription; let collected = {}; diff --git a/public/app/plugins/datasource/elasticsearch/ElasticResponse.ts b/public/app/plugins/datasource/elasticsearch/ElasticResponse.ts index 797ec344ec8..5455555451c 100644 --- a/public/app/plugins/datasource/elasticsearch/ElasticResponse.ts +++ b/public/app/plugins/datasource/elasticsearch/ElasticResponse.ts @@ -340,7 +340,7 @@ export class ElasticResponse { if (target.alias) { const regex = /\{\{([\s\S]+?)\}\}/g; - return target.alias.replace(regex, (match: any, g1: any, g2: any) => { + return target.alias.replace(regex, (match, g1, g2) => { const group = g1 || g2; if (group.indexOf('term ') === 0) { @@ -367,7 +367,7 @@ export class ElasticResponse { metricName = getScriptValue(agg); for (const pv of agg.pipelineVariables) { - const appliedAgg: any = find(target.metrics, { id: pv.pipelineAgg }); + const appliedAgg = find(target.metrics, { id: pv.pipelineAgg }); if (appliedAgg) { metricName = metricName.replace('params.' + pv.name, describeMetric(appliedAgg)); } @@ -376,7 +376,7 @@ export class ElasticResponse { metricName = 'Unset'; } } else { - const appliedAgg: any = find(target.metrics, { id: series.field }); + const appliedAgg = find(target.metrics, { id: series.field }); if (appliedAgg) { metricName += ' ' + describeMetric(appliedAgg); } else { @@ -734,7 +734,7 @@ const createEmptyDataFrame = ( name: logMessageField, type: FieldType.string, }); - series.setParser(f, (v: any) => { + series.setParser(f, (v) => { return v || ''; }); } @@ -744,7 +744,7 @@ const createEmptyDataFrame = ( name: 'level', type: FieldType.string, }); - series.setParser(f, (v: any) => { + series.setParser(f, (v) => { return v || ''; }); } @@ -768,7 +768,7 @@ const createEmptyDataFrame = ( name, type, }); - series.setParser(f, (v: any) => { + series.setParser(f, (v) => { return v || ''; }); } @@ -776,7 +776,7 @@ const createEmptyDataFrame = ( return series; }; -const addPreferredVisualisationType = (series: any, type: PreferredVisualisationType) => { +const addPreferredVisualisationType = (series: DataFrame, type: PreferredVisualisationType) => { let s = series; s.meta ? (s.meta.preferredVisualisationType = type) @@ -786,7 +786,7 @@ const addPreferredVisualisationType = (series: any, type: PreferredVisualisation }; const toNameTypePair = - (docs: Array>) => + (docs: Array>) => (propName: string): [string, FieldType] => [ propName, guessType(docs.find((doc) => doc[propName] !== undefined)?.[propName]), diff --git a/public/app/plugins/datasource/elasticsearch/QueryBuilder.ts b/public/app/plugins/datasource/elasticsearch/QueryBuilder.ts index f398b87fa39..a5d7f767f2b 100644 --- a/public/app/plugins/datasource/elasticsearch/QueryBuilder.ts +++ b/public/app/plugins/datasource/elasticsearch/QueryBuilder.ts @@ -37,17 +37,18 @@ export class ElasticQueryBuilder { } getRangeFilter() { - const filter: any = {}; - filter[this.timeField] = { - gte: '$timeFrom', - lte: '$timeTo', - format: 'epoch_millis', + const filter = { + [this.timeField]: { + gte: '$timeFrom', + lte: '$timeTo', + format: 'epoch_millis', + }, }; return filter; } - buildTermsAgg(aggDef: Terms, queryNode: { terms?: any; aggs?: any }, target: ElasticsearchQuery) { + buildTermsAgg(aggDef: Terms, queryNode: { terms?: any; aggs?: Record }, target: ElasticsearchQuery) { queryNode.terms = { field: aggDef.field }; if (!aggDef.settings) { @@ -101,7 +102,7 @@ export class ElasticQueryBuilder { } getDateHistogramAgg(aggDef: DateHistogram) { - const esAgg: any = {}; + const esAgg: Record = {}; const settings = aggDef.settings || {}; esAgg.field = aggDef.field || this.timeField; @@ -128,11 +129,11 @@ export class ElasticQueryBuilder { } getHistogramAgg(aggDef: Histogram) { - const esAgg: any = {}; - const settings = aggDef.settings || {}; - esAgg.interval = settings.interval; - esAgg.field = aggDef.field; - esAgg.min_doc_count = settings.min_doc_count || 0; + const esAgg = { + interval: aggDef.settings?.interval, + field: aggDef.field, + min_doc_count: aggDef.settings?.min_doc_count || 0, + }; return esAgg; } diff --git a/public/app/plugins/datasource/elasticsearch/components/AddRemove.tsx b/public/app/plugins/datasource/elasticsearch/components/AddRemove.tsx index f2765277cd2..288ef03c1f1 100644 --- a/public/app/plugins/datasource/elasticsearch/components/AddRemove.tsx +++ b/public/app/plugins/datasource/elasticsearch/components/AddRemove.tsx @@ -5,7 +5,7 @@ import { Button } from '@grafana/ui'; interface Props { index: number; - elements: any[]; + elements: unknown[]; onAdd: () => void; onRemove: () => void; } diff --git a/public/app/plugins/datasource/elasticsearch/components/QueryEditor/BucketAggregationsEditor/SettingsEditor/TermsSettingsEditor.tsx b/public/app/plugins/datasource/elasticsearch/components/QueryEditor/BucketAggregationsEditor/SettingsEditor/TermsSettingsEditor.tsx index 5829a54108d..7b005941ab8 100644 --- a/public/app/plugins/datasource/elasticsearch/components/QueryEditor/BucketAggregationsEditor/SettingsEditor/TermsSettingsEditor.tsx +++ b/public/app/plugins/datasource/elasticsearch/components/QueryEditor/BucketAggregationsEditor/SettingsEditor/TermsSettingsEditor.tsx @@ -102,7 +102,7 @@ function createOrderByOptionsForExtendedStats(metric: ExtendedStats): Selectable return metaKeys .filter((key) => metric.meta?.[key]) .map((key) => { - let method = key as string; + let method: string = key; // The bucket path for std_deviation_bounds.lower and std_deviation_bounds.upper // is accessed via std_lower and std_upper, respectively. if (key === 'std_deviation_bounds_lower') { diff --git a/public/app/plugins/datasource/elasticsearch/components/QueryEditor/BucketAggregationsEditor/state/actions.ts b/public/app/plugins/datasource/elasticsearch/components/QueryEditor/BucketAggregationsEditor/state/actions.ts index 2b200658d94..f128d5aa582 100644 --- a/public/app/plugins/datasource/elasticsearch/components/QueryEditor/BucketAggregationsEditor/state/actions.ts +++ b/public/app/plugins/datasource/elasticsearch/components/QueryEditor/BucketAggregationsEditor/state/actions.ts @@ -15,5 +15,5 @@ export const changeBucketAggregationField = createAction<{ export const changeBucketAggregationSetting = createAction<{ bucketAgg: BucketAggregation; settingName: string; - newValue: any; + newValue: unknown; }>('@bucketAggs/change_setting'); diff --git a/public/app/plugins/datasource/elasticsearch/components/QueryEditor/ElasticsearchQueryContext.tsx b/public/app/plugins/datasource/elasticsearch/components/QueryEditor/ElasticsearchQueryContext.tsx index f91fe3d209d..dda0b664f53 100644 --- a/public/app/plugins/datasource/elasticsearch/components/QueryEditor/ElasticsearchQueryContext.tsx +++ b/public/app/plugins/datasource/elasticsearch/components/QueryEditor/ElasticsearchQueryContext.tsx @@ -91,7 +91,7 @@ const getHook: GetHook = (c) => () => { throw new Error('use ElasticsearchProvider first.'); } - return contextValue as NonNullable; + return contextValue; }; export const useQuery = getHook(QueryContext); diff --git a/public/app/plugins/datasource/elasticsearch/components/QueryEditor/MetricAggregationsEditor/state/actions.ts b/public/app/plugins/datasource/elasticsearch/components/QueryEditor/MetricAggregationsEditor/state/actions.ts index 9c3fe19f47c..e7dc68aa1bd 100644 --- a/public/app/plugins/datasource/elasticsearch/components/QueryEditor/MetricAggregationsEditor/state/actions.ts +++ b/public/app/plugins/datasource/elasticsearch/components/QueryEditor/MetricAggregationsEditor/state/actions.ts @@ -9,16 +9,16 @@ export const changeMetricField = createAction<{ id: MetricAggregation['id']; fie export const changeMetricType = createAction<{ id: MetricAggregation['id']; type: MetricAggregation['type'] }>( '@metrics/change_type' ); -export const changeMetricAttribute = createAction<{ metric: MetricAggregation; attribute: string; newValue: any }>( +export const changeMetricAttribute = createAction<{ metric: MetricAggregation; attribute: string; newValue: unknown }>( '@metrics/change_attr' ); export const changeMetricSetting = createAction<{ metric: MetricAggregationWithSettings; settingName: string; - newValue: any; + newValue: unknown; }>('@metrics/change_setting'); export const changeMetricMeta = createAction<{ metric: MetricAggregationWithMeta; meta: string; - newValue: any; + newValue: unknown; }>('@metrics/change_meta'); diff --git a/public/app/plugins/datasource/elasticsearch/datasource.ts b/public/app/plugins/datasource/elasticsearch/datasource.ts index 307329311b7..d0c1af10068 100644 --- a/public/app/plugins/datasource/elasticsearch/datasource.ts +++ b/public/app/plugins/datasource/elasticsearch/datasource.ts @@ -191,7 +191,7 @@ export class ElasticDatasource * @param url the url to query the index on, for example `/_mapping`. */ - private requestAllIndices(url: string, range = getDefaultTimeRange()): Observable { + private requestAllIndices(url: string, range = getDefaultTimeRange()) { let indexList = this.indexPattern.getIndexList(range.from, range.to); if (!Array.isArray(indexList)) { indexList = [this.indexPattern.getIndexForToday()]; diff --git a/public/app/plugins/datasource/grafana-testdata-datasource/ConfigEditor.tsx b/public/app/plugins/datasource/grafana-testdata-datasource/ConfigEditor.tsx index 9cc333215bb..9c78b849d9b 100644 --- a/public/app/plugins/datasource/grafana-testdata-datasource/ConfigEditor.tsx +++ b/public/app/plugins/datasource/grafana-testdata-datasource/ConfigEditor.tsx @@ -3,7 +3,7 @@ import React, { PureComponent } from 'react'; import { DataSourcePluginOptionsEditorProps } from '@grafana/data'; -type Props = DataSourcePluginOptionsEditorProps; +type Props = DataSourcePluginOptionsEditorProps; /** * Empty Config Editor -- settings to save diff --git a/public/app/plugins/datasource/grafana-testdata-datasource/QueryEditor.tsx b/public/app/plugins/datasource/grafana-testdata-datasource/QueryEditor.tsx index 71636cfdcf6..c6cf280a5be 100644 --- a/public/app/plugins/datasource/grafana-testdata-datasource/QueryEditor.tsx +++ b/public/app/plugins/datasource/grafana-testdata-datasource/QueryEditor.tsx @@ -127,7 +127,7 @@ export const QueryEditor = ({ query, datasource, onChange, onRunQuery }: Props) const onInputChange = (e: FormEvent) => { const { name, value, type } = e.currentTarget; - let newValue: any = value; + let newValue: string | number | boolean = value; if (type === 'number') { newValue = Number(value); @@ -142,7 +142,7 @@ export const QueryEditor = ({ query, datasource, onChange, onRunQuery }: Props) const onFieldChange = (field: string) => (e: { target: { name: string; value: string; type: string } }) => { const { name, value, type } = e.target; - let newValue: any = value; + let newValue: string | number = value; if (type === 'number') { newValue = Number(value); diff --git a/public/app/plugins/datasource/grafana-testdata-datasource/components/RandomWalkEditor.tsx b/public/app/plugins/datasource/grafana-testdata-datasource/components/RandomWalkEditor.tsx index 74334a6b897..2296c6c0fd0 100644 --- a/public/app/plugins/datasource/grafana-testdata-datasource/components/RandomWalkEditor.tsx +++ b/public/app/plugins/datasource/grafana-testdata-datasource/components/RandomWalkEditor.tsx @@ -6,7 +6,15 @@ import { InlineField, InlineFieldRow, Input } from '@grafana/ui'; import { EditorProps } from '../QueryEditor'; import { TestData } from '../dataquery.gen'; -const randomWalkFields = [ +const randomWalkFields: Array<{ + label: string; + id: Selector; + placeholder: string; + min?: number; + step?: number; + max?: number; + tooltip?: string; +}> = [ { label: 'Series count', id: 'seriesCount', placeholder: '1', min: 1, step: 1 }, { label: 'Start value', id: 'startValue', placeholder: 'auto', step: 1 }, { label: 'Min', id: 'min', placeholder: 'none', step: 0.1 }, @@ -31,7 +39,7 @@ export const RandomWalkEditor = ({ onChange, query }: EditorProps) => { return ( {randomWalkFields.map(({ label, id, min, step, placeholder, tooltip }) => { - const selector = testSelectors?.[id as Selector]; + const selector = testSelectors[id]; return ( { // Copy paste from panel json if (isArray(json.series) && json.state) { - data = json.series.map((v: any) => toDataFrameDTO(toDataFrame(v))); + data = json.series.map((v: unknown) => toDataFrameDTO(toDataFrame(v))); } else { // Chek if it is a copy of the raw resuls const v = toDataQueryResponse({ data: json }); diff --git a/public/app/plugins/datasource/grafana-testdata-datasource/nodeGraphUtils.ts b/public/app/plugins/datasource/grafana-testdata-datasource/nodeGraphUtils.ts index 3bf1af6280b..515d3c885c2 100644 --- a/public/app/plugins/datasource/grafana-testdata-datasource/nodeGraphUtils.ts +++ b/public/app/plugins/datasource/grafana-testdata-datasource/nodeGraphUtils.ts @@ -11,6 +11,7 @@ import { nodes, edges } from './testData/serviceMapResponse'; export function generateRandomNodes(count = 10) { const nodes = []; + const edges: string[] = []; const root = { id: 'root', @@ -20,7 +21,7 @@ export function generateRandomNodes(count = 10) { error: 0, stat1: Math.random(), stat2: Math.random(), - edges: [] as any[], + edges, }; nodes.push(root); const nodesWithoutMaxEdges = [root]; diff --git a/public/app/plugins/datasource/grafana/components/SearchEditor.tsx b/public/app/plugins/datasource/grafana/components/SearchEditor.tsx index f0a52cdbe08..dea22b8b22e 100644 --- a/public/app/plugins/datasource/grafana/components/SearchEditor.tsx +++ b/public/app/plugins/datasource/grafana/components/SearchEditor.tsx @@ -29,7 +29,7 @@ export default function SearchEditor({ value, onChange }: Props) { setJSON(JSON.stringify({ ...emptySearchQuery, ...value }, null, 2)); }, [value]); - const handleSearchBlur = (e: React.FocusEvent) => { + const handleSearchBlur = () => { if (query !== value.query) { onChange({ ...value, query }); } @@ -39,12 +39,12 @@ export default function SearchEditor({ value, onChange }: Props) { if (e.key !== 'Enter') { return; } - handleSearchBlur(e as any); + handleSearchBlur(); }; const onSaveSearchJSON = (rawSearchJSON: string) => { try { - const searchQuery = JSON.parse(rawSearchJSON) as SearchQuery; + const searchQuery: SearchQuery = JSON.parse(rawSearchJSON); onChange(searchQuery); setQuery(searchQuery.query ?? ''); } catch (ex) { diff --git a/public/app/plugins/datasource/grafana/datasource.ts b/public/app/plugins/datasource/grafana/datasource.ts index 1f9cb331962..934eadf8708 100644 --- a/public/app/plugins/datasource/grafana/datasource.ts +++ b/public/app/plugins/datasource/grafana/datasource.ts @@ -60,7 +60,7 @@ export class GrafanaDatasource extends DataSourceWithBackend { datasource = ref; } } else { - datasource = anno.datasource as DataSourceRef; + datasource = anno.datasource; } // Filter from streaming query conflicts with filter from annotations @@ -188,7 +188,7 @@ export class GrafanaDatasource extends DataSourceWithBackend { ); } - metricFindQuery(options: any) { + metricFindQuery() { return Promise.resolve([]); } @@ -232,7 +232,7 @@ export class GrafanaDatasource extends DataSourceWithBackend { const delimiter = '__delimiter__'; const tags = []; for (const t of params.tags) { - const renderedValues = templateSrv.replace(t, {}, (value: any) => { + const renderedValues = templateSrv.replace(t, {}, (value: string | string[]) => { if (typeof value === 'string') { return value; } diff --git a/public/app/plugins/datasource/graphite/components/FunctionEditor.tsx b/public/app/plugins/datasource/graphite/components/FunctionEditor.tsx index 8971466e219..1971664c446 100644 --- a/public/app/plugins/datasource/graphite/components/FunctionEditor.tsx +++ b/public/app/plugins/datasource/graphite/components/FunctionEditor.tsx @@ -2,7 +2,7 @@ import { css } from '@emotion/css'; import React from 'react'; import { GrafanaTheme2 } from '@grafana/data'; -import { Icon, Tooltip, useStyles2 } from '@grafana/ui'; +import { Icon, Tooltip, useStyles2, type PopoverContent } from '@grafana/ui'; import { FuncInstance } from '../gfunc'; @@ -29,17 +29,17 @@ const getStyles = (theme: GrafanaTheme2) => { const FunctionEditor = ({ onMoveLeft, onMoveRight, func, ...props }: FunctionEditorProps) => { const styles = useStyles2(getStyles); - const renderContent = ({ updatePopperPosition }: any) => ( + const renderContent: PopoverContent = ({ updatePopperPosition }) => ( { onMoveLeft(func); - updatePopperPosition(); + updatePopperPosition?.(); }} onMoveRight={() => { onMoveRight(func); - updatePopperPosition(); + updatePopperPosition?.(); }} /> );