diff --git a/.betterer.results b/.betterer.results index 63208ca90b0..80b563a36f9 100644 --- a/.betterer.results +++ b/.betterer.results @@ -902,9 +902,7 @@ exports[`better eslint`] = { [0, 0, 0, "Do not use any type assertions.", "2"] ], "packages/grafana-ui/src/components/DataLinks/DataLinkInput.tsx:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"], - [0, 0, 0, "Do not use any type assertions.", "1"], - [0, 0, 0, "Unexpected any. Specify a different type.", "2"] + [0, 0, 0, "Do not use any type assertions.", "0"] ], "packages/grafana-ui/src/components/DataLinks/DataLinksContextMenu.tsx:5381": [ [0, 0, 0, "Use data-testid for E2E selectors instead of aria-label", "0"] @@ -926,9 +924,6 @@ exports[`better eslint`] = { [0, 0, 0, "Unexpected any. Specify a different type.", "6"], [0, 0, 0, "Unexpected any. Specify a different type.", "7"] ], - "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/TimeRangeInput.tsx:5381": [ [0, 0, 0, "Use data-testid for E2E selectors instead of aria-label", "0"] ], @@ -955,20 +950,11 @@ exports[`better eslint`] = { "packages/grafana-ui/src/components/Forms/FieldArray.story.tsx:5381": [ [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"], - [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"] - ], "packages/grafana-ui/src/components/Forms/Legacy/Input/Input.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"] ], - "packages/grafana-ui/src/components/Forms/Legacy/Select/IndicatorsContainer.tsx:5381": [ - [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"] ], @@ -977,8 +963,7 @@ exports[`better eslint`] = { [0, 0, 0, "Unexpected any. Specify a different type.", "1"] ], "packages/grafana-ui/src/components/Graph/Graph.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/Graph/GraphContextMenu.tsx:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"] @@ -1586,8 +1571,7 @@ exports[`better eslint`] = { [0, 0, 0, "Unexpected any. Specify a different type.", "0"] ], "public/app/core/reducers/root.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/core/services/ResponseQueue.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"] @@ -3156,21 +3140,14 @@ exports[`better eslint`] = { [0, 0, 0, "Do not use any type assertions.", "1"], [0, 0, 0, "Unexpected any. Specify a different type.", "2"] ], - "public/app/features/transformers/configFromQuery/ConfigFromQueryTransformerEditor.tsx:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"] - ], "public/app/features/transformers/editors/CalculateFieldTransformerEditor.tsx:5381": [ [0, 0, 0, "Do not use any type assertions.", "0"], [0, 0, 0, "Do not use any type assertions.", "1"] ], "public/app/features/transformers/editors/ConvertFieldTypeTransformerEditor.tsx:5381": [ - [0, 0, 0, "Do not use any type assertions.", "0"], - [0, 0, 0, "Unexpected any. Specify a different type.", "1"] - ], - "public/app/features/transformers/editors/GroupByTransformerEditor.tsx:5381": [ [0, 0, 0, "Do not use any type assertions.", "0"] ], - "public/app/features/transformers/editors/OrganizeFieldsTransformerEditor.tsx:5381": [ + "public/app/features/transformers/editors/GroupByTransformerEditor.tsx:5381": [ [0, 0, 0, "Do not use any type assertions.", "0"] ], "public/app/features/transformers/editors/ReduceTransformerEditor.tsx:5381": [ @@ -3205,15 +3182,10 @@ exports[`better eslint`] = { [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.", "4"] ], "public/app/features/transformers/lookupGazetteer/FieldLookupTransformerEditor.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"], - [0, 0, 0, "Unexpected any. Specify a different type.", "3"] + [0, 0, 0, "Do not use any type assertions.", "0"] ], "public/app/features/transformers/lookupGazetteer/fieldLookup.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"] @@ -3226,28 +3198,17 @@ exports[`better eslint`] = { [0, 0, 0, "Unexpected any. Specify a different type.", "0"], [0, 0, 0, "Unexpected any. Specify a different type.", "1"] ], - "public/app/features/transformers/spatial/SpatialTransformerEditor.tsx:5381": [ - [0, 0, 0, "Do not use any type assertions.", "0"], - [0, 0, 0, "Do not use any type assertions.", "1"] - ], "public/app/features/transformers/spatial/optionsHelper.tsx:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"], - [0, 0, 0, "Unexpected any. Specify a different type.", "1"], - [0, 0, 0, "Do not use any type assertions.", "2"], + [0, 0, 0, "Do not use any type assertions.", "1"], + [0, 0, 0, "Unexpected any. Specify a different type.", "2"], [0, 0, 0, "Unexpected any. Specify a different type.", "3"], - [0, 0, 0, "Unexpected any. Specify a different type.", "4"], - [0, 0, 0, "Do not use any type assertions.", "5"], - [0, 0, 0, "Do not use any type assertions.", "6"] - ], - "public/app/features/transformers/spatial/utils.ts:5381": [ - [0, 0, 0, "Do not use any type assertions.", "0"] + [0, 0, 0, "Do not use any type assertions.", "4"], + [0, 0, 0, "Do not use any type assertions.", "5"] ], "public/app/features/transformers/standardTransformers.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"] ], - "public/app/features/transformers/utils.ts:5381": [ - [0, 0, 0, "Do not use any type assertions.", "0"] - ], "public/app/features/users/state/reducers.ts:5381": [ [0, 0, 0, "Do not use any type assertions.", "0"] ], @@ -3502,9 +3463,8 @@ exports[`better eslint`] = { ], "public/app/features/variables/state/sharedReducer.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"], - [0, 0, 0, "Unexpected any. Specify a different type.", "1"], - [0, 0, 0, "Do not use any type assertions.", "2"], - [0, 0, 0, "Unexpected any. Specify a different type.", "3"] + [0, 0, 0, "Do not use any type assertions.", "1"], + [0, 0, 0, "Unexpected any. Specify a different type.", "2"] ], "public/app/features/variables/state/transactionReducer.test.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"], @@ -3530,9 +3490,6 @@ exports[`better eslint`] = { [0, 0, 0, "Do not use any type assertions.", "7"], [0, 0, 0, "Unexpected any. Specify a different type.", "8"] ], - "public/app/features/variables/textbox/reducer.ts:5381": [ - [0, 0, 0, "Do not use any type assertions.", "0"] - ], "public/app/features/variables/types.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"], [0, 0, 0, "Unexpected any. Specify a different type.", "1"], @@ -3551,9 +3508,7 @@ exports[`better eslint`] = { [0, 0, 0, "Unexpected any. Specify a different type.", "7"], [0, 0, 0, "Unexpected any. Specify a different type.", "8"], [0, 0, 0, "Unexpected any. Specify a different type.", "9"], - [0, 0, 0, "Unexpected any. Specify a different type.", "10"], - [0, 0, 0, "Unexpected any. Specify a different type.", "11"], - [0, 0, 0, "Do not use any type assertions.", "12"] + [0, 0, 0, "Do not use any type assertions.", "10"] ], "public/app/plugins/datasource/alertmanager/DataSource.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"] @@ -5601,9 +5556,6 @@ exports[`better eslint`] = { [0, 0, 0, "Do not use any type assertions.", "10"], [0, 0, 0, "Do not use any type assertions.", "11"] ], - "public/app/polyfills/old-mediaquerylist.ts:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"] - ], "public/app/store/configureStore.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"] ], diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index c91b3cd6725..c7a360a6df1 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -436,7 +436,6 @@ lerna.json @grafana/frontend-ops /public/app/plugins/panel/welcome/ @grafana/grafana-frontend-platform /public/app/plugins/panel/xychart/ @grafana/dataviz-squad /public/app/plugins/sdk.ts @grafana/plugins-platform-frontend -/public/app/polyfills/old-mediaquerylist.ts @grafana/grafana-frontend-platform /public/app/routes/ @grafana/grafana-frontend-platform /public/app/store/ @grafana/grafana-frontend-platform /public/app/types/ @grafana/grafana-frontend-platform diff --git a/packages/grafana-ui/src/components/DataLinks/DataLinkInput.tsx b/packages/grafana-ui/src/components/DataLinks/DataLinkInput.tsx index 17a6917b470..bee5cc80bbe 100644 --- a/packages/grafana-ui/src/components/DataLinks/DataLinkInput.tsx +++ b/packages/grafana-ui/src/components/DataLinks/DataLinkInput.tsx @@ -38,7 +38,7 @@ const datalinksSyntax: Grammar = { const plugins = [ SlatePrism( { - onlyIn: (node: any) => node.type === 'code_block', + onlyIn: (node) => 'type' in node && node.type === 'code_block', getSyntax: () => 'links', }, { ...(Prism.languages as LanguageMap), links: datalinksSyntax } @@ -100,7 +100,7 @@ export const DataLinkInput = memo( // SelectionReference is used to position the variables suggestion relatively to current DOM selection const selectionRef = useMemo(() => new SelectionReference(), []); - const onKeyDown = React.useCallback((event: React.KeyboardEvent, next: () => any) => { + const onKeyDown = React.useCallback((event: React.KeyboardEvent, next: () => void) => { if (!stateRef.current.showingSuggestions) { if (event.key === '=' || event.key === '$' || (event.keyCode === 32 && event.ctrlKey)) { return setShowingSuggestions(true); diff --git a/packages/grafana-ui/src/components/DateTimePickers/TimeOfDayPicker.tsx b/packages/grafana-ui/src/components/DateTimePickers/TimeOfDayPicker.tsx index 6b924753932..90d0cd24357 100644 --- a/packages/grafana-ui/src/components/DateTimePickers/TimeOfDayPicker.tsx +++ b/packages/grafana-ui/src/components/DateTimePickers/TimeOfDayPicker.tsx @@ -2,7 +2,7 @@ import { css, cx } from '@emotion/css'; import RcTimePicker from 'rc-time-picker'; import React from 'react'; -import { dateTime, DateTime, dateTimeAsMoment, GrafanaTheme2 } from '@grafana/data'; +import { dateTime, DateTime, dateTimeAsMoment, GrafanaTheme2, isDateTimeInput } from '@grafana/data'; import { Icon, useStyles2 } from '../../index'; import { getFocusStyles } from '../../themes/mixins'; @@ -43,7 +43,11 @@ export const TimeOfDayPicker = ({ className={cx(inputSizes()[size], styles.input)} popupClassName={cx(styles.picker, POPUP_CLASS_NAME)} defaultValue={dateTimeAsMoment()} - onChange={(value: any) => onChange(dateTime(value))} + onChange={(value) => { + if (isDateTimeInput(value)) { + return onChange(dateTime(value)); + } + }} allowEmpty={false} showSecond={showSeconds} value={dateTimeAsMoment(value)} diff --git a/packages/grafana-ui/src/components/Forms/Form.story.tsx b/packages/grafana-ui/src/components/Forms/Form.story.tsx index b1879ef9a5d..7e8e4172f6b 100644 --- a/packages/grafana-ui/src/components/Forms/Form.story.tsx +++ b/packages/grafana-ui/src/components/Forms/Form.story.tsx @@ -67,8 +67,9 @@ const renderForm = (defaultValues?: FormDTO) => ( console.log(data); }} > - {({ register, control, errors }) => - (console.log(errors) as any) || ( + {({ register, control, errors }) => { + console.log(errors); + return ( <> Edit user @@ -120,8 +121,8 @@ const renderForm = (defaultValues?: FormDTO) => ( - ) - } + ); + }} ); @@ -153,8 +154,9 @@ export const AsyncValidation: Story = ({ passAsyncValidation }) => { alert('Submitted successfully!'); }} > - {({ register, control, errors, formState }) => - (console.log(errors) as any) || ( + {({ register, control, errors, formState }) => { + console.log(errors); + return ( <> Edit user @@ -169,8 +171,8 @@ export const AsyncValidation: Story = ({ passAsyncValidation }) => { Submit - ) - } + ); + }} ); diff --git a/packages/grafana-ui/src/components/Forms/Legacy/Select/IndicatorsContainer.tsx b/packages/grafana-ui/src/components/Forms/Legacy/Select/IndicatorsContainer.tsx index 0cfe9a8cca0..e27792e4a00 100644 --- a/packages/grafana-ui/src/components/Forms/Legacy/Select/IndicatorsContainer.tsx +++ b/packages/grafana-ui/src/components/Forms/Legacy/Select/IndicatorsContainer.tsx @@ -1,9 +1,9 @@ import React from 'react'; -import { components } from 'react-select'; +import { components, IndicatorsContainerProps } from 'react-select'; import { Icon } from '../../../Icon/Icon'; -export const IndicatorsContainer = (props: any) => { +export const IndicatorsContainer = (props: IndicatorsContainerProps) => { const isOpen = props.selectProps.menuIsOpen; return ( diff --git a/packages/grafana-ui/src/components/Graph/Graph.tsx b/packages/grafana-ui/src/components/Graph/Graph.tsx index ed20d1e4644..99f660c37db 100644 --- a/packages/grafana-ui/src/components/Graph/Graph.tsx +++ b/packages/grafana-ui/src/components/Graph/Graph.tsx @@ -299,7 +299,7 @@ export class Graph extends PureComponent { const max = timeRange.to.valueOf(); const yaxes = this.getYAxes(series); - const flotOptions: any = { + const flotOptions = { legend: { show: false, }, diff --git a/public/app/app.ts b/public/app/app.ts index 2189274260b..663f47f7f54 100644 --- a/public/app/app.ts +++ b/public/app/app.ts @@ -3,7 +3,6 @@ import 'core-js'; import 'regenerator-runtime/runtime'; import 'whatwg-fetch'; // fetch polyfill needed for PhantomJs rendering -import './polyfills/old-mediaquerylist'; // Safari < 14 does not have mql.addEventListener() import 'file-saver'; import 'jquery'; diff --git a/public/app/core/reducers/root.ts b/public/app/core/reducers/root.ts index 68ac180d36c..f2c436062bd 100644 --- a/public/app/core/reducers/root.ts +++ b/public/app/core/reducers/root.ts @@ -1,3 +1,4 @@ +import { ReducersMapObject } from '@reduxjs/toolkit'; import { AnyAction, combineReducers } from 'redux'; import sharedReducers from 'app/core/reducers'; @@ -58,7 +59,7 @@ const rootReducers = { const addedReducers = {}; -export const addReducer = (newReducers: any) => { +export const addReducer = (newReducers: ReducersMapObject) => { Object.assign(addedReducers, newReducers); }; diff --git a/public/app/features/transformers/configFromQuery/ConfigFromQueryTransformerEditor.tsx b/public/app/features/transformers/configFromQuery/ConfigFromQueryTransformerEditor.tsx index 64e42fa0f38..9dc54d344b5 100644 --- a/public/app/features/transformers/configFromQuery/ConfigFromQueryTransformerEditor.tsx +++ b/public/app/features/transformers/configFromQuery/ConfigFromQueryTransformerEditor.tsx @@ -42,7 +42,7 @@ export function ConfigFromQueryTransformerEditor({ input, onChange, options }: P onChange({ ...options, applyTo: { id: value.value! } }); }; - const onMatcherConfigChange = (matcherOption: any) => { + const onMatcherConfigChange = (matcherOption: unknown) => { onChange({ ...options, applyTo: { id: currentMatcher.id, options: matcherOption } }); }; diff --git a/public/app/features/transformers/editors/ConvertFieldTypeTransformerEditor.tsx b/public/app/features/transformers/editors/ConvertFieldTypeTransformerEditor.tsx index 32dbe0b333b..cadf1f324e7 100644 --- a/public/app/features/transformers/editors/ConvertFieldTypeTransformerEditor.tsx +++ b/public/app/features/transformers/editors/ConvertFieldTypeTransformerEditor.tsx @@ -21,9 +21,9 @@ import { allFieldTypeIconOptions } from '@grafana/ui/src/components/MatchersUI/F import { hasAlphaPanels } from 'app/core/config'; import { findField } from 'app/features/dimensions'; -const fieldNamePickerSettings: StandardEditorsRegistryItem = { +const fieldNamePickerSettings = { settings: { width: 24, isClearable: false }, -} as any; +} as StandardEditorsRegistryItem; export const ConvertFieldTypeTransformerEditor = ({ input, diff --git a/public/app/features/transformers/editors/OrganizeFieldsTransformerEditor.tsx b/public/app/features/transformers/editors/OrganizeFieldsTransformerEditor.tsx index da25487528c..cfaf2bd64ab 100644 --- a/public/app/features/transformers/editors/OrganizeFieldsTransformerEditor.tsx +++ b/public/app/features/transformers/editors/OrganizeFieldsTransformerEditor.tsx @@ -192,13 +192,10 @@ const reorderToIndex = (fieldNames: string[], startIndex: number, endIndex: numb const [removed] = result.splice(startIndex, 1); result.splice(endIndex, 0, removed); - return result.reduce( - (nameByIndex, fieldName, index) => { - nameByIndex[fieldName] = index; - return nameByIndex; - }, - {} as Record - ); + return result.reduce>((nameByIndex, fieldName, index) => { + nameByIndex[fieldName] = index; + return nameByIndex; + }, {}); }; const orderFieldNamesByIndex = (fieldNames: string[], indexByName: Record = {}): string[] => { diff --git a/public/app/features/transformers/editors/SortByTransformerEditor.tsx b/public/app/features/transformers/editors/SortByTransformerEditor.tsx index 899649ca3e0..ff595611e27 100644 --- a/public/app/features/transformers/editors/SortByTransformerEditor.tsx +++ b/public/app/features/transformers/editors/SortByTransformerEditor.tsx @@ -23,7 +23,7 @@ export const SortByTransformerEditor = ({ input, options, onChange }: Transforme [onChange, options] ); - const sorts = options.sort?.length ? options.sort : [{} as SortByField]; + const sorts: SortByField[] = options.sort?.length ? options.sort : [{} as SortByField]; return (
diff --git a/public/app/features/transformers/fieldToConfigMapping/fieldToConfigMapping.ts b/public/app/features/transformers/fieldToConfigMapping/fieldToConfigMapping.ts index 5c81ccc6327..8eca18f14d1 100644 --- a/public/app/features/transformers/fieldToConfigMapping/fieldToConfigMapping.ts +++ b/public/app/features/transformers/fieldToConfigMapping/fieldToConfigMapping.ts @@ -135,7 +135,7 @@ export const configMapHandlers: FieldToConfigMapHandler[] = [ { key: 'displayName', name: 'Display name', - processor: (value: any) => value.toString(), + processor: (value) => value.toString(), }, { key: 'color', @@ -247,7 +247,7 @@ export function getConfigMapHandlersIndex() { return configMapHandlersIndex; } -function toNumericOrUndefined(value: any) { +function toNumericOrUndefined(value: unknown) { const numeric = anyToNumber(value); if (isNaN(numeric)) { diff --git a/public/app/features/transformers/lookupGazetteer/FieldLookupTransformerEditor.tsx b/public/app/features/transformers/lookupGazetteer/FieldLookupTransformerEditor.tsx index 2784d9e17da..810a0d2fb50 100644 --- a/public/app/features/transformers/lookupGazetteer/FieldLookupTransformerEditor.tsx +++ b/public/app/features/transformers/lookupGazetteer/FieldLookupTransformerEditor.tsx @@ -28,9 +28,9 @@ const fieldNamePickerSettings: StandardEditorsRegistryItem null, }; -const fieldLookupSettings: StandardEditorsRegistryItem = { +const fieldLookupSettings = { settings: {}, -} as any; +} as StandardEditorsRegistryItem; export const FieldLookupTransformerEditor = ({ input, options, onChange }: TransformerUIProps) => { const onPickLookupField = useCallback( @@ -60,7 +60,7 @@ export const FieldLookupTransformerEditor = ({ input, options, onChange }: Trans context={{ data: input }} value={options?.lookupField ?? ''} onChange={onPickLookupField} - item={fieldNamePickerSettings as any} + item={fieldNamePickerSettings} /> diff --git a/public/app/features/transformers/spatial/SpatialTransformerEditor.tsx b/public/app/features/transformers/spatial/SpatialTransformerEditor.tsx index 1349f754c93..7834e820a61 100644 --- a/public/app/features/transformers/spatial/SpatialTransformerEditor.tsx +++ b/public/app/features/transformers/spatial/SpatialTransformerEditor.tsx @@ -11,7 +11,7 @@ import { TransformerUIProps, TransformerCategory, } from '@grafana/data'; -import { FrameGeometrySource, FrameGeometrySourceMode } from '@grafana/schema'; +import { FrameGeometrySourceMode } from '@grafana/schema'; import { useTheme2 } from '@grafana/ui'; import { addLocationFields } from 'app/features/geo/editor/locationEditor'; @@ -90,10 +90,9 @@ const supplier = ( category: ['Source'], path: 'source', build: (b, c) => { - const loc = (options.source ?? {}) as FrameGeometrySource; - if (!loc.mode) { - loc.mode = FrameGeometrySourceMode.Auto; - } + const loc = options.source ?? { + mode: FrameGeometrySourceMode.Auto, + }; addLocationFields('Point', '', b, loc); }, }); @@ -102,10 +101,9 @@ const supplier = ( category: ['Target'], path: 'modify', build: (b, c) => { - const loc = (options.modify?.target ?? {}) as FrameGeometrySource; - if (!loc.mode) { - loc.mode = FrameGeometrySourceMode.Auto; - } + const loc = options.modify?.target ?? { + mode: FrameGeometrySourceMode.Auto, + }; addLocationFields('Point', 'target.', b, loc); }, }); diff --git a/public/app/features/transformers/spatial/optionsHelper.tsx b/public/app/features/transformers/spatial/optionsHelper.tsx index 8c60d6527bf..49f77cf7927 100644 --- a/public/app/features/transformers/spatial/optionsHelper.tsx +++ b/public/app/features/transformers/spatial/optionsHelper.tsx @@ -31,8 +31,8 @@ export function getTransformerOptionPane( }; const access: NestedValueAccess = { - getValue: (path: string) => lodashGet(props.options, path), - onChange: (path: string, value: any) => { + getValue: (path) => lodashGet(props.options, path), + onChange: (path, value) => { props.onChange(setOptionImmutably(props.options as any, path, value)); }, }; diff --git a/public/app/features/transformers/spatial/utils.ts b/public/app/features/transformers/spatial/utils.ts index 60cd7a710e9..2a53307331a 100644 --- a/public/app/features/transformers/spatial/utils.ts +++ b/public/app/features/transformers/spatial/utils.ts @@ -41,7 +41,7 @@ export function calculateBearings(values: Array): number[] export function getCenterPoint(geo: Geometry): number[] { if (geo instanceof Point) { - return (geo as Point).getCoordinates(); + return geo.getCoordinates(); } return getCenter(geo.getExtent()); } diff --git a/public/app/features/transformers/utils.ts b/public/app/features/transformers/utils.ts index adf95a8c19e..33b3f9344dd 100644 --- a/public/app/features/transformers/utils.ts +++ b/public/app/features/transformers/utils.ts @@ -9,20 +9,17 @@ export function useAllFieldNamesFromDataFrames(input: DataFrame[]): string[] { } return Object.keys( - input.reduce( - (names, frame) => { - if (!frame || !Array.isArray(frame.fields)) { - return names; - } + input.reduce>((names, frame) => { + if (!frame || !Array.isArray(frame.fields)) { + return names; + } - return frame.fields.reduce((names, field) => { - const t = getFieldDisplayName(field, frame, input); - names[t] = true; - return names; - }, names); - }, - {} as Record - ) + return frame.fields.reduce((names, field) => { + const t = getFieldDisplayName(field, frame, input); + names[t] = true; + return names; + }, names); + }, {}) ); }, [input]); } diff --git a/public/app/features/variables/state/sharedReducer.ts b/public/app/features/variables/state/sharedReducer.ts index fefea202464..ba4d6567a39 100644 --- a/public/app/features/variables/state/sharedReducer.ts +++ b/public/app/features/variables/state/sharedReducer.ts @@ -52,7 +52,7 @@ const sharedReducerSlice = createSlice({ instanceState.state = LoadingState.Done; instanceState.error = null; }, - variableStateFailed: (state: VariablesState, action: PayloadAction>) => { + variableStateFailed: (state: VariablesState, action: PayloadAction>) => { const instanceState = getInstanceState(state, action.payload.id); if (!instanceState) { // we might have cancelled a batch so then this state has been removed diff --git a/public/app/features/variables/textbox/reducer.ts b/public/app/features/variables/textbox/reducer.ts index 76fa81274cd..fb884448916 100644 --- a/public/app/features/variables/textbox/reducer.ts +++ b/public/app/features/variables/textbox/reducer.ts @@ -2,13 +2,13 @@ import { createSlice, PayloadAction } from '@reduxjs/toolkit'; import { getInstanceState } from '../state/selectors'; import { initialVariablesState, VariablePayload, VariablesState } from '../state/types'; -import { initialVariableModelState, TextBoxVariableModel, VariableOption } from '../types'; +import { initialVariableModelState, TextBoxVariableModel } from '../types'; export const initialTextBoxVariableModelState: TextBoxVariableModel = { ...initialVariableModelState, type: 'textbox', query: '', - current: {} as VariableOption, + current: {}, options: [], originalQuery: null, }; diff --git a/public/app/features/variables/utils.ts b/public/app/features/variables/utils.ts index 2c5bbdf29bf..797d6abf22f 100644 --- a/public/app/features/variables/utils.ts +++ b/public/app/features/variables/utils.ts @@ -226,7 +226,7 @@ export function findTemplateVarChanges(query: UrlQueryMap, old: UrlQueryMap): Ex return count ? changes : undefined; } -export function ensureStringValues(value: any | any[]): string | string[] { +export function ensureStringValues(value: unknown | unknown[]): string | string[] { if (Array.isArray(value)) { return value.map(String); } diff --git a/public/app/polyfills/old-mediaquerylist.ts b/public/app/polyfills/old-mediaquerylist.ts deleted file mode 100644 index 6fdd31397bf..00000000000 --- a/public/app/polyfills/old-mediaquerylist.ts +++ /dev/null @@ -1,22 +0,0 @@ -// Safari < 14 does not have mql.addEventListener(), but uses the old spec mql.addListener() - -let oMatchMedia = window.matchMedia; - -type MqlListener = (this: MediaQueryList, ev: MediaQueryListEvent) => any; - -window.matchMedia = (mediaQueryString) => { - let mql = oMatchMedia(mediaQueryString); - - if (!mql.addEventListener) { - // @ts-ignore - mql.addEventListener = (type: string, listener: MqlListener) => { - mql.addListener(listener); - }; - // @ts-ignore - mql.removeEventListener = (type: string, listener: MqlListener) => { - mql.removeListener(listener); - }; - } - - return mql; -};