From 0b322a0f5d24d9347fd4836cefaa87938d998786 Mon Sep 17 00:00:00 2001 From: Ashley Harrison Date: Fri, 19 Aug 2022 16:46:58 +0100 Subject: [PATCH] fix some anys (#53789) --- .betterer.results | 84 ++++--------------- devenv/e2e-api-tests/dashboard.test.ts | 2 +- devenv/e2e-api-tests/folder.test.ts | 4 +- .../dashboard-templating.spec.ts | 2 +- .../src/dataframe/CircularDataFrame.ts | 2 +- .../src/dataframe/frameComparisons.ts | 2 +- .../ColorPicker/ColorPickerPopover.tsx | 2 +- .../CustomScrollbar/CustomScrollbar.tsx | 12 +-- .../TimeZonePicker/TimeZoneOption.tsx | 2 +- .../ErrorBoundary/ErrorBoundary.tsx | 4 +- .../FileDropzone/FileDropzone.test.tsx | 2 +- .../src/components/Forms/FieldArray.story.tsx | 3 +- .../components/Forms/Legacy/Select/Select.tsx | 4 +- .../grafana-ui/src/components/Gauge/Gauge.tsx | 8 +- .../components/Input/AutoSizeInput.story.tsx | 4 +- .../src/components/Input/Input.story.tsx | 4 +- .../JSONFormatter/JSONFormatter.tsx | 4 +- .../components/List/List.story.internal.tsx | 4 +- .../Logs/LogRowContextProvider.test.tsx | 12 +-- .../components/Logs/LogRowContextProvider.tsx | 4 +- .../src/components/Portal/Portal.tsx | 2 +- .../src/components/Select/InputControl.tsx | 2 +- .../src/components/Select/MultiValue.tsx | 2 +- 23 files changed, 59 insertions(+), 112 deletions(-) diff --git a/.betterer.results b/.betterer.results index 209db07b306..0085e2e0a51 100644 --- a/.betterer.results +++ b/.betterer.results @@ -8,7 +8,7 @@ exports[`no enzyme tests`] = { "packages/grafana-ui/src/components/Graph/Graph.test.tsx:1664091255": [ [0, 17, 13, "RegExp match", "2409514259"] ], - "packages/grafana-ui/src/components/Logs/LogRowContextProvider.test.tsx:943686035": [ + "packages/grafana-ui/src/components/Logs/LogRowContextProvider.test.tsx:3786619094": [ [0, 17, 13, "RegExp match", "2409514259"] ], "packages/grafana-ui/src/components/QueryField/QueryField.test.tsx:375894800": [ @@ -113,9 +113,6 @@ exports[`better eslint`] = { [0, 0, 0, "Do not use any type assertions.", "0"], [0, 0, 0, "Unexpected any. Specify a different type.", "1"] ], - "e2e/dashboards-suite/dashboard-templating.spec.ts:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"] - ], "e2e/dashboards-suite/textbox-variables.spec.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"], [0, 0, 0, "Unexpected any. Specify a different type.", "1"], @@ -138,8 +135,7 @@ exports[`better eslint`] = { [0, 0, 0, "Unexpected any. Specify a different type.", "8"] ], "packages/grafana-data/src/dataframe/CircularDataFrame.ts:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"], - [0, 0, 0, "Unexpected any. Specify a different type.", "1"] + [0, 0, 0, "Unexpected any. Specify a different type.", "0"] ], "packages/grafana-data/src/dataframe/DataFrameJSON.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"], @@ -207,9 +203,7 @@ exports[`better eslint`] = { [0, 0, 0, "Do not use any type assertions.", "0"], [0, 0, 0, "Unexpected any. Specify a different type.", "1"], [0, 0, 0, "Do not use any type assertions.", "2"], - [0, 0, 0, "Unexpected any. Specify a different type.", "3"], - [0, 0, 0, "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"] ], "packages/grafana-data/src/dataframe/processDataFrame.test.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"] @@ -1341,18 +1335,9 @@ exports[`better eslint`] = { [0, 0, 0, "Unexpected any. Specify a different type.", "2"], [0, 0, 0, "Do not use any type assertions.", "3"] ], - "packages/grafana-ui/src/components/ColorPicker/ColorPickerPopover.tsx:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"] - ], "packages/grafana-ui/src/components/CustomScrollbar/CustomScrollbar.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, "Unexpected any. Specify a different type.", "7"] + [0, 0, 0, "Unexpected any. Specify a different type.", "1"] ], "packages/grafana-ui/src/components/DataLinks/DataLinkInput.tsx:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"], @@ -1389,20 +1374,10 @@ exports[`better eslint`] = { "packages/grafana-ui/src/components/DateTimePickers/TimeOfDayPicker.tsx:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"] ], - "packages/grafana-ui/src/components/DateTimePickers/TimeZonePicker/TimeZoneOption.tsx:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"] - ], "packages/grafana-ui/src/components/Dropdown/ButtonSelect.tsx:5381": [ [0, 0, 0, "Do not use any type assertions.", "0"], [0, 0, 0, "Do not use any type assertions.", "1"] ], - "packages/grafana-ui/src/components/ErrorBoundary/ErrorBoundary.tsx:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"], - [0, 0, 0, "Unexpected any. Specify a different type.", "1"] - ], - "packages/grafana-ui/src/components/FileDropzone/FileDropzone.test.tsx:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"] - ], "packages/grafana-ui/src/components/FilterInput/FilterInput.tsx:5381": [ [0, 0, 0, "Do not use any type assertions.", "0"] ], @@ -1410,8 +1385,7 @@ exports[`better eslint`] = { [0, 0, 0, "Do not use any type assertions.", "0"] ], "packages/grafana-ui/src/components/Forms/FieldArray.story.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.", "0"] ], "packages/grafana-ui/src/components/Forms/Form.story.tsx:5381": [ [0, 0, 0, "Do not use any type assertions.", "0"], @@ -1428,8 +1402,7 @@ exports[`better eslint`] = { [0, 0, 0, "Unexpected any. Specify a different type.", "0"] ], "packages/grafana-ui/src/components/Forms/Legacy/Select/Select.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.", "0"] ], "packages/grafana-ui/src/components/Forms/Legacy/Select/SelectOption.test.tsx:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"] @@ -1441,10 +1414,6 @@ exports[`better eslint`] = { "packages/grafana-ui/src/components/Forms/RadioButtonGroup/RadioButtonGroup.tsx:5381": [ [0, 0, 0, "Do not use any type assertions.", "0"] ], - "packages/grafana-ui/src/components/Gauge/Gauge.tsx:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"], - [0, 0, 0, "Unexpected any. Specify a different type.", "1"] - ], "packages/grafana-ui/src/components/Graph/Graph.test.tsx:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"] ], @@ -1499,20 +1468,15 @@ exports[`better eslint`] = { [0, 0, 0, "Do not use any type assertions.", "0"] ], "packages/grafana-ui/src/components/Input/AutoSizeInput.story.tsx:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"], - [0, 0, 0, "Do not use any type assertions.", "1"], - [0, 0, 0, "Unexpected any. Specify a different type.", "2"], - [0, 0, 0, "Do not use any type assertions.", "3"] + [0, 0, 0, "Do not use any type assertions.", "0"], + [0, 0, 0, "Do not use any type assertions.", "1"] ], "packages/grafana-ui/src/components/Input/Input.story.tsx:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"], - [0, 0, 0, "Do not use any type assertions.", "1"], - [0, 0, 0, "Unexpected any. Specify a different type.", "2"], - [0, 0, 0, "Do not use any type assertions.", "3"] + [0, 0, 0, "Do not use any type assertions.", "0"], + [0, 0, 0, "Do not use any type assertions.", "1"] ], "packages/grafana-ui/src/components/JSONFormatter/JSONFormatter.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.", "0"] ], "packages/grafana-ui/src/components/JSONFormatter/json_explorer/helpers.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"] @@ -1530,28 +1494,17 @@ exports[`better eslint`] = { [0, 0, 0, "Do not use any type assertions.", "0"] ], "packages/grafana-ui/src/components/List/List.story.internal.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, "Do not use any type assertions.", "0"] ], "packages/grafana-ui/src/components/Logs/LogRowContext.tsx:5381": [ [0, 0, 0, "Do not use any type assertions.", "0"] ], - "packages/grafana-ui/src/components/Logs/LogRowContextProvider.test.tsx:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"], - [0, 0, 0, "Unexpected any. Specify a different type.", "1"], - [0, 0, 0, "Unexpected any. Specify a different type.", "2"], - [0, 0, 0, "Unexpected any. Specify a different type.", "3"], - [0, 0, 0, "Unexpected any. Specify a different type.", "4"] - ], "packages/grafana-ui/src/components/Logs/LogRowContextProvider.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.", "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"] ], "packages/grafana-ui/src/components/Logs/LogRows.tsx:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"] @@ -1593,9 +1546,6 @@ exports[`better eslint`] = { [0, 0, 0, "Do not use any type assertions.", "0"], [0, 0, 0, "Unexpected any. Specify a different type.", "1"] ], - "packages/grafana-ui/src/components/Portal/Portal.tsx:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"] - ], "packages/grafana-ui/src/components/QueryField/QueryField.test.tsx:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"], [0, 0, 0, "Unexpected any. Specify a different type.", "1"], @@ -1650,12 +1600,8 @@ exports[`better eslint`] = { "packages/grafana-ui/src/components/Select/IndicatorsContainer.tsx:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"] ], - "packages/grafana-ui/src/components/Select/InputControl.tsx:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"] - ], "packages/grafana-ui/src/components/Select/MultiValue.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.", "0"] ], "packages/grafana-ui/src/components/Select/Select.story.tsx:5381": [ [0, 0, 0, "Do not use any type assertions.", "0"], diff --git a/devenv/e2e-api-tests/dashboard.test.ts b/devenv/e2e-api-tests/dashboard.test.ts index 55beaffecb0..a318158a091 100644 --- a/devenv/e2e-api-tests/dashboard.test.ts +++ b/devenv/e2e-api-tests/dashboard.test.ts @@ -2,7 +2,7 @@ import client from './client'; import * as setup from './setup'; describe('/api/dashboards', () => { - let state: any = {}; + let state = {}; beforeAll(async () => { state = await setup.ensureState({ diff --git a/devenv/e2e-api-tests/folder.test.ts b/devenv/e2e-api-tests/folder.test.ts index 0d40972aa6d..180238a67ad 100644 --- a/devenv/e2e-api-tests/folder.test.ts +++ b/devenv/e2e-api-tests/folder.test.ts @@ -2,10 +2,8 @@ import client from './client'; import * as setup from './setup'; describe('/api/folders', () => { - let state: any = {}; - beforeAll(async () => { - state = await setup.ensureState({ + await setup.ensureState({ orgName: 'api-test-org', users: [ { user: setup.admin, role: 'Admin' }, diff --git a/e2e/dashboards-suite/dashboard-templating.spec.ts b/e2e/dashboards-suite/dashboard-templating.spec.ts index 8d3d10770e5..913a8d181d7 100644 --- a/e2e/dashboards-suite/dashboard-templating.spec.ts +++ b/e2e/dashboards-suite/dashboard-templating.spec.ts @@ -10,7 +10,7 @@ e2e.scenario({ // Open dashboard global variables and interpolation e2e.flows.openDashboard({ uid: 'HYaGDGIMk' }); - const items: any = []; + const items: string[] = []; const expectedItems: string[] = [ '__dashboard = Templating - Global variables and interpolation', '__dashboard.name = Templating - Global variables and interpolation', diff --git a/packages/grafana-data/src/dataframe/CircularDataFrame.ts b/packages/grafana-data/src/dataframe/CircularDataFrame.ts index ea39654d47c..2f23b96340b 100644 --- a/packages/grafana-data/src/dataframe/CircularDataFrame.ts +++ b/packages/grafana-data/src/dataframe/CircularDataFrame.ts @@ -13,7 +13,7 @@ interface CircularOptions { */ export class CircularDataFrame extends MutableDataFrame { constructor(options: CircularOptions) { - super(undefined, (buffer?: any[]) => { + super(undefined, (buffer) => { return new CircularVector({ ...options, buffer, diff --git a/packages/grafana-data/src/dataframe/frameComparisons.ts b/packages/grafana-data/src/dataframe/frameComparisons.ts index d5f1ef99390..f96a7e1660a 100644 --- a/packages/grafana-data/src/dataframe/frameComparisons.ts +++ b/packages/grafana-data/src/dataframe/frameComparisons.ts @@ -92,7 +92,7 @@ export function compareArrayValues(a: T[], b: T[], cmp: (a: T, b: T) => boole return true; } -type Cmp = (valA: any, valB: any) => boolean; +type Cmp = (valA: unknown, valB: unknown) => boolean; const defaultCmp: Cmp = (a, b) => a === b; diff --git a/packages/grafana-ui/src/components/ColorPicker/ColorPickerPopover.tsx b/packages/grafana-ui/src/components/ColorPicker/ColorPickerPopover.tsx index 812b8cca3e4..5c5dad1ae12 100644 --- a/packages/grafana-ui/src/components/ColorPicker/ColorPickerPopover.tsx +++ b/packages/grafana-ui/src/components/ColorPicker/ColorPickerPopover.tsx @@ -50,7 +50,7 @@ class UnThemedColorPickerPopover extends Comp return `ColorPickerPopover__tab ${activePicker === tabName && 'ColorPickerPopover__tab--active'}`; }; - handleChange = (color: any) => { + handleChange = (color: string) => { const { onChange, enableNamedColors, theme } = this.props; if (enableNamedColors) { return onChange(color); diff --git a/packages/grafana-ui/src/components/CustomScrollbar/CustomScrollbar.tsx b/packages/grafana-ui/src/components/CustomScrollbar/CustomScrollbar.tsx index 9fb2443c081..47a8416d0fa 100644 --- a/packages/grafana-ui/src/components/CustomScrollbar/CustomScrollbar.tsx +++ b/packages/grafana-ui/src/components/CustomScrollbar/CustomScrollbar.tsx @@ -75,7 +75,7 @@ export const CustomScrollbar: FC = ({ }, updateAfterMountMs); }, [updateAfterMountMs]); - function renderTrack(className: string, hideTrack: boolean | undefined, passedProps: any) { + function renderTrack(className: string, hideTrack: boolean | undefined, passedProps: JSX.IntrinsicElements['div']) { if (passedProps.style && hideTrack) { passedProps.style.display = 'none'; } @@ -84,28 +84,28 @@ export const CustomScrollbar: FC = ({ } const renderTrackHorizontal = useCallback( - (passedProps: any) => { + (passedProps: JSX.IntrinsicElements['div']) => { return renderTrack('track-horizontal', hideHorizontalTrack, passedProps); }, [hideHorizontalTrack] ); const renderTrackVertical = useCallback( - (passedProps: any) => { + (passedProps: JSX.IntrinsicElements['div']) => { return renderTrack('track-vertical', hideVerticalTrack, passedProps); }, [hideVerticalTrack] ); - const renderThumbHorizontal = useCallback((passedProps: any) => { + const renderThumbHorizontal = useCallback((passedProps: JSX.IntrinsicElements['div']) => { return
; }, []); - const renderThumbVertical = useCallback((passedProps: any) => { + const renderThumbVertical = useCallback((passedProps: JSX.IntrinsicElements['div']) => { return
; }, []); - const renderView = useCallback((passedProps: any) => { + const renderView = useCallback((passedProps: JSX.IntrinsicElements['div']) => { return
; }, []); diff --git a/packages/grafana-ui/src/components/DateTimePickers/TimeZonePicker/TimeZoneOption.tsx b/packages/grafana-ui/src/components/DateTimePickers/TimeZonePicker/TimeZoneOption.tsx index 3c8807dfea0..96bf32ee93d 100644 --- a/packages/grafana-ui/src/components/DateTimePickers/TimeZonePicker/TimeZoneOption.tsx +++ b/packages/grafana-ui/src/components/DateTimePickers/TimeZonePicker/TimeZoneOption.tsx @@ -15,7 +15,7 @@ import { TimeZoneTitle } from './TimeZoneTitle'; interface Props { isFocused: boolean; isSelected: boolean; - innerProps: any; + innerProps: JSX.IntrinsicElements['div']; data: SelectableZone; } diff --git a/packages/grafana-ui/src/components/ErrorBoundary/ErrorBoundary.tsx b/packages/grafana-ui/src/components/ErrorBoundary/ErrorBoundary.tsx index a929bbfec35..5233a4d5a85 100644 --- a/packages/grafana-ui/src/components/ErrorBoundary/ErrorBoundary.tsx +++ b/packages/grafana-ui/src/components/ErrorBoundary/ErrorBoundary.tsx @@ -17,7 +17,7 @@ export interface ErrorBoundaryApi { interface Props { children: (r: ErrorBoundaryApi) => ReactNode; /** Will re-render children after error if recover values changes */ - dependencies?: any[]; + dependencies?: unknown[]; /** Callback called on error */ onError?: (error: Error) => void; /** Callback error state is cleared due to recover props change */ @@ -89,7 +89,7 @@ export interface ErrorBoundaryAlertProps { style?: 'page' | 'alertbox'; /** Will re-render children after error if recover values changes */ - dependencies?: any[]; + dependencies?: unknown[]; } export class ErrorBoundaryAlert extends PureComponent { diff --git a/packages/grafana-ui/src/components/FileDropzone/FileDropzone.test.tsx b/packages/grafana-ui/src/components/FileDropzone/FileDropzone.test.tsx index b10c9160d08..e60f6818e2c 100644 --- a/packages/grafana-ui/src/components/FileDropzone/FileDropzone.test.tsx +++ b/packages/grafana-ui/src/components/FileDropzone/FileDropzone.test.tsx @@ -127,7 +127,7 @@ describe('The FileDropzone component', () => { }); }); -function dispatchEvt(node: HTMLElement, type: string, data: any) { +function dispatchEvt(node: HTMLElement, type: string, data: unknown) { const event = new Event(type, { bubbles: true }); Object.assign(event, data); fireEvent(node, event); diff --git a/packages/grafana-ui/src/components/Forms/FieldArray.story.tsx b/packages/grafana-ui/src/components/Forms/FieldArray.story.tsx index 6b60b083f46..1ca5cca9282 100644 --- a/packages/grafana-ui/src/components/Forms/FieldArray.story.tsx +++ b/packages/grafana-ui/src/components/Forms/FieldArray.story.tsx @@ -1,5 +1,6 @@ import { Meta, Story } from '@storybook/react'; import React from 'react'; +import { FieldValues } from 'react-hook-form'; import { Form, Input, Button, HorizontalGroup } from '@grafana/ui'; @@ -28,7 +29,7 @@ export default { } as Meta; export const Simple: Story = (args) => { - const defaultValues: any = { + const defaultValues: FieldValues = { people: [{ firstName: 'Janis', lastName: 'Joplin' }], }; return ( diff --git a/packages/grafana-ui/src/components/Forms/Legacy/Select/Select.tsx b/packages/grafana-ui/src/components/Forms/Legacy/Select/Select.tsx index db2da0be303..ab47f4245d8 100644 --- a/packages/grafana-ui/src/components/Forms/Legacy/Select/Select.tsx +++ b/packages/grafana-ui/src/components/Forms/Legacy/Select/Select.tsx @@ -1,7 +1,7 @@ // Libraries import classNames from 'classnames'; import React, { PureComponent } from 'react'; -import { default as ReactSelect, components } from 'react-select'; +import { default as ReactSelect, components, MenuListProps } from 'react-select'; import { default as ReactAsyncSelect } from 'react-select/async'; import Creatable from 'react-select/creatable'; @@ -42,7 +42,7 @@ export interface LegacySelectProps extends LegacyCommonProps { value?: SelectableValue; } -export const MenuList = (props: any) => { +export const MenuList = (props: MenuListProps) => { return ( diff --git a/packages/grafana-ui/src/components/Gauge/Gauge.tsx b/packages/grafana-ui/src/components/Gauge/Gauge.tsx index 906ca0d7f7f..ebdcf84e6ff 100644 --- a/packages/grafana-ui/src/components/Gauge/Gauge.tsx +++ b/packages/grafana-ui/src/components/Gauge/Gauge.tsx @@ -29,7 +29,7 @@ export interface Props extends Themeable { } export class Gauge extends PureComponent { - canvasElement: any; + canvasElement: HTMLDivElement | null = null; static defaultProps: Partial = { showThresholdMarkers: true, @@ -90,7 +90,7 @@ export class Gauge extends PureComponent { max = +max.toFixed(decimals); } - const options: any = { + const options = { series: { gauges: { gauge: { @@ -133,7 +133,9 @@ export class Gauge extends PureComponent { }; try { - $.plot(this.canvasElement, [plotSeries], options); + if (this.canvasElement) { + $.plot(this.canvasElement, [plotSeries], options); + } } catch (err) { console.error('Gauge rendering error', err, options, value); } diff --git a/packages/grafana-ui/src/components/Input/AutoSizeInput.story.tsx b/packages/grafana-ui/src/components/Input/AutoSizeInput.story.tsx index b61e378e38c..b99a656b6c4 100644 --- a/packages/grafana-ui/src/components/Input/AutoSizeInput.story.tsx +++ b/packages/grafana-ui/src/components/Input/AutoSizeInput.story.tsx @@ -67,11 +67,11 @@ export const Simple: Story = (args) => { const addonBefore =
AutoSizeInput
; const prefix = args.prefixVisible; const suffix = args.suffixVisible; - let prefixEl: any = prefix; + let prefixEl = prefix; if (prefix && prefix.match(/icon-/g)) { prefixEl = ; } - let suffixEl: any = suffix; + let suffixEl = suffix; if (suffix && suffix.match(/icon-/g)) { suffixEl = ; } diff --git a/packages/grafana-ui/src/components/Input/Input.story.tsx b/packages/grafana-ui/src/components/Input/Input.story.tsx index 80c4ffc138d..f328d37bf1b 100644 --- a/packages/grafana-ui/src/components/Input/Input.story.tsx +++ b/packages/grafana-ui/src/components/Input/Input.story.tsx @@ -69,11 +69,11 @@ export const Simple: Story = (args) => { const addonBefore =
Input
; const prefix = args.prefixVisible; const suffix = args.suffixVisible; - let prefixEl: any = prefix; + let prefixEl = prefix; if (prefix && prefix.match(/icon-/g)) { prefixEl = ; } - let suffixEl: any = suffix; + let suffixEl = suffix; if (suffix && suffix.match(/icon-/g)) { suffixEl = ; } diff --git a/packages/grafana-ui/src/components/JSONFormatter/JSONFormatter.tsx b/packages/grafana-ui/src/components/JSONFormatter/JSONFormatter.tsx index ca815e8c760..d7b89a29a2a 100644 --- a/packages/grafana-ui/src/components/JSONFormatter/JSONFormatter.tsx +++ b/packages/grafana-ui/src/components/JSONFormatter/JSONFormatter.tsx @@ -1,11 +1,11 @@ import React, { PureComponent, createRef } from 'react'; -import { JsonExplorer } from './json_explorer/json_explorer'; // We have made some monkey-patching of json-formatter-js so we can't switch right now +import { JsonExplorer, JsonExplorerConfig } from './json_explorer/json_explorer'; // We have made some monkey-patching of json-formatter-js so we can't switch right now interface Props { className?: string; json: {}; - config?: any; + config?: JsonExplorerConfig; open?: number; onDidRender?: (formattedJson: any) => void; } diff --git a/packages/grafana-ui/src/components/List/List.story.internal.tsx b/packages/grafana-ui/src/components/List/List.story.internal.tsx index 2a7a74dfddc..dd39646024c 100644 --- a/packages/grafana-ui/src/components/List/List.story.internal.tsx +++ b/packages/grafana-ui/src/components/List/List.story.internal.tsx @@ -38,8 +38,8 @@ const generateListItems = (numberOfItems: number) => { }; const getItem = (inline = false) => { - const rawRenderer = (item: any) => <>{item.name}; - const customRenderer = (item: any, index: number) => ( + const rawRenderer = (item: ReturnType[0]) => <>{item.name}; + const customRenderer = (item: ReturnType[0], index: number) => (
{ ], }); let called = false; - const getRowContextMock = (row: LogRowModel, options?: any): Promise => { + const getRowContextMock = (row: LogRowModel, options?: RowContextOptions): Promise => { if (!called) { called = true; return Promise.resolve({ data: [firstResult] }); @@ -64,7 +64,7 @@ describe('getRowContexts', () => { ], }); let called = false; - const getRowContextMock = (row: LogRowModel, options?: any): Promise => { + const getRowContextMock = (row: LogRowModel, options?: RowContextOptions): Promise => { if (!called) { called = true; return Promise.resolve({ data: [firstResult] }); @@ -89,7 +89,7 @@ describe('getRowContexts', () => { const firstError = new Error('Error 1'); const secondError = new Error('Error 2'); let called = false; - const getRowContextMock = (row: LogRowModel, options?: any): Promise => { + const getRowContextMock = (row: LogRowModel, options?: RowContextOptions): Promise => { if (!called) { called = true; return Promise.reject(firstError); @@ -136,7 +136,7 @@ describe('LogRowContextProvider', () => { }); let called = false; - const getRowContextMock = (row: LogRowModel, options?: any): Promise => { + const getRowContextMock = (row: LogRowModel, options?: RowContextOptions): Promise => { if (!called) { called = true; return Promise.resolve({ data: [firstResult] }); @@ -145,7 +145,7 @@ describe('LogRowContextProvider', () => { }; let updateLimitCalled = false; - const mockedChildren = jest.fn((mockState: any) => { + const mockedChildren = jest.fn((mockState) => { const { result, errors, hasMoreContextRows, updateLimit, limit } = mockState; if (!updateLimitCalled && result.before.length === 0) { expect(result).toEqual({ before: [], after: [] }); diff --git a/packages/grafana-ui/src/components/Logs/LogRowContextProvider.tsx b/packages/grafana-ui/src/components/Logs/LogRowContextProvider.tsx index 2751f623c12..7fa3bbbaa98 100644 --- a/packages/grafana-ui/src/components/Logs/LogRowContextProvider.tsx +++ b/packages/grafana-ui/src/components/Logs/LogRowContextProvider.tsx @@ -73,7 +73,7 @@ export const getRowContexts = async ( return []; } - const data: any[] = []; + const data = []; for (let index = 0; index < dataResult.data.length; index++) { const dataFrame = toDataFrame(dataResult.data[index]); const fieldCache = new FieldCache(dataFrame); @@ -166,7 +166,7 @@ export const LogRowContextProvider: React.FunctionComponent { if (value) { - setResult((currentResult: any) => { + setResult((currentResult) => { let hasMoreLogsBefore = true, hasMoreLogsAfter = true; diff --git a/packages/grafana-ui/src/components/Portal/Portal.tsx b/packages/grafana-ui/src/components/Portal/Portal.tsx index 0d260cca338..0e00c7b2025 100644 --- a/packages/grafana-ui/src/components/Portal/Portal.tsx +++ b/packages/grafana-ui/src/components/Portal/Portal.tsx @@ -6,7 +6,7 @@ import { useTheme2 } from '../../themes'; interface Props { className?: string; root?: HTMLElement; - forwardedRef?: any; + forwardedRef?: React.ForwardedRef; } export function Portal(props: PropsWithChildren) { diff --git a/packages/grafana-ui/src/components/Select/InputControl.tsx b/packages/grafana-ui/src/components/Select/InputControl.tsx index e107737495f..55aa58d6728 100644 --- a/packages/grafana-ui/src/components/Select/InputControl.tsx +++ b/packages/grafana-ui/src/components/Select/InputControl.tsx @@ -14,7 +14,7 @@ interface InputControlProps { focused: boolean; invalid: boolean; disabled: boolean; - innerProps: any; + innerProps: JSX.IntrinsicElements['div']; } const getInputControlStyles = stylesFactory((theme: GrafanaTheme2, invalid: boolean, withPrefix: boolean) => { diff --git a/packages/grafana-ui/src/components/Select/MultiValue.tsx b/packages/grafana-ui/src/components/Select/MultiValue.tsx index 0a02abc316a..9e660ffb3da 100644 --- a/packages/grafana-ui/src/components/Select/MultiValue.tsx +++ b/packages/grafana-ui/src/components/Select/MultiValue.tsx @@ -6,7 +6,7 @@ import { IconButton } from '../IconButton/IconButton'; import { getSelectStyles } from './getSelectStyles'; interface MultiValueContainerProps { - innerProps: any; + innerProps: JSX.IntrinsicElements['div']; } export const MultiValueContainer: React.FC = ({ innerProps, children }) => {