mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Update dependency prettier to v2.5.1 (#43473)
* Update dependency prettier to v2.5.1 * prettier fixes * chore(toolkit): bump prettier to 2.5.1 * style(eslint): bump grafana config to 2.5.2 in core and toolkit * style(mssql-datasource): fix no-inferrable-types eslint errors Co-authored-by: Renovate Bot <bot@renovateapp.com> Co-authored-by: Ashley Harrison <ashley.harrison@grafana.com> Co-authored-by: Jack Westbrook <jack.westbrook@gmail.com>
This commit is contained in:
@@ -17,7 +17,7 @@ jest.mock('app/core/store', () => {
|
||||
});
|
||||
|
||||
jest.mock('@grafana/runtime', () => ({
|
||||
...((jest.requireActual('@grafana/runtime') as unknown) as object),
|
||||
...(jest.requireActual('@grafana/runtime') as unknown as object),
|
||||
getDataSourceSrv: () => {
|
||||
return {
|
||||
get: (v: any) => {
|
||||
|
||||
@@ -176,7 +176,7 @@ export class DashboardExporter {
|
||||
if (isQuery(variable)) {
|
||||
templateizeDatasourceUsage(variable);
|
||||
variable.options = [];
|
||||
variable.current = ({} as unknown) as VariableOption;
|
||||
variable.current = {} as unknown as VariableOption;
|
||||
variable.refresh =
|
||||
variable.refresh !== VariableRefresh.never ? variable.refresh : VariableRefresh.onDashboardLoad;
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ describe('DashboardPrompt', () => {
|
||||
describe('when called without current dashboard', () => {
|
||||
it('then it should return true', () => {
|
||||
const { original } = getTestContext();
|
||||
expect(ignoreChanges((null as unknown) as DashboardModel, original)).toBe(true);
|
||||
expect(ignoreChanges(null as unknown as DashboardModel, original)).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ describe('AutoRefreshIntervals', () => {
|
||||
|
||||
describe('when component is mounted without refreshIntervals', () => {
|
||||
it('then default intervals should be shown', () => {
|
||||
setupTestContext({ refreshIntervals: (null as unknown) as string[] });
|
||||
setupTestContext({ refreshIntervals: null as unknown as string[] });
|
||||
|
||||
expect(screen.getByRole('textbox')).toHaveValue('5s,10s,30s,1m,5m,15m,30m,1h,2h,1d');
|
||||
});
|
||||
@@ -96,9 +96,9 @@ describe('getValidIntervals', () => {
|
||||
const emptyIntervals = ['', '5s', ' ', '10s', ' '];
|
||||
const dependencies = {
|
||||
getTimeSrv: () =>
|
||||
(({
|
||||
({
|
||||
getValidIntervals: (intervals: any) => intervals,
|
||||
} as unknown) as TimeSrv),
|
||||
} as unknown as TimeSrv),
|
||||
};
|
||||
|
||||
const result = getValidIntervals(emptyIntervals, dependencies);
|
||||
@@ -112,9 +112,9 @@ describe('getValidIntervals', () => {
|
||||
const duplicateIntervals = ['5s', '10s', '1m', '5s', '30s', '10s', '5s', '2m'];
|
||||
const dependencies = {
|
||||
getTimeSrv: () =>
|
||||
(({
|
||||
({
|
||||
getValidIntervals: (intervals: any) => intervals,
|
||||
} as unknown) as TimeSrv),
|
||||
} as unknown as TimeSrv),
|
||||
};
|
||||
|
||||
const result = getValidIntervals(duplicateIntervals, dependencies);
|
||||
@@ -128,9 +128,9 @@ describe('getValidIntervals', () => {
|
||||
const duplicateIntervals = [' 5s', '10s ', ' 1m ', ' 3 0 s ', ' 2 m '];
|
||||
const dependencies = {
|
||||
getTimeSrv: () =>
|
||||
(({
|
||||
({
|
||||
getValidIntervals: (intervals: any) => intervals,
|
||||
} as unknown) as TimeSrv),
|
||||
} as unknown as TimeSrv),
|
||||
};
|
||||
|
||||
const result = getValidIntervals(duplicateIntervals, dependencies);
|
||||
@@ -145,9 +145,9 @@ describe('validateIntervals', () => {
|
||||
it('then it should return null', () => {
|
||||
const dependencies = {
|
||||
getTimeSrv: () =>
|
||||
(({
|
||||
({
|
||||
getValidIntervals: (intervals: any) => intervals,
|
||||
} as unknown) as TimeSrv),
|
||||
} as unknown as TimeSrv),
|
||||
};
|
||||
|
||||
const result = validateIntervals(defaultIntervals, dependencies);
|
||||
@@ -160,11 +160,11 @@ describe('validateIntervals', () => {
|
||||
it('then it should return the exception message', () => {
|
||||
const dependencies = {
|
||||
getTimeSrv: () =>
|
||||
(({
|
||||
({
|
||||
getValidIntervals: () => {
|
||||
throw new Error('Some error');
|
||||
},
|
||||
} as unknown) as TimeSrv),
|
||||
} as unknown as TimeSrv),
|
||||
};
|
||||
|
||||
const result = validateIntervals(defaultIntervals, dependencies);
|
||||
|
||||
@@ -10,7 +10,7 @@ import { selectors } from '@grafana/e2e-selectors';
|
||||
|
||||
const setupTestContext = (options: Partial<Props>) => {
|
||||
const defaults: Props = {
|
||||
dashboard: ({
|
||||
dashboard: {
|
||||
title: 'test dashboard title',
|
||||
description: 'test dashboard description',
|
||||
timepicker: {
|
||||
@@ -22,7 +22,7 @@ const setupTestContext = (options: Partial<Props>) => {
|
||||
folderTitle: 'test',
|
||||
},
|
||||
timezone: 'utc',
|
||||
} as unknown) as DashboardModel,
|
||||
} as unknown as DashboardModel,
|
||||
updateTimeZone: jest.fn(),
|
||||
updateWeekStart: jest.fn(),
|
||||
};
|
||||
|
||||
@@ -47,24 +47,30 @@ export const DynamicConfigValueEditor: React.FC<DynamicConfigValueEditorProps> =
|
||||
const labelCategory = item.category?.filter((c) => c !== item.name);
|
||||
let editor;
|
||||
|
||||
// eslint-disable-next-line react/display-name
|
||||
const renderLabel = (includeDescription = true, includeCounter = false) => (isExpanded = false) => (
|
||||
<HorizontalGroup justify="space-between">
|
||||
<Label category={labelCategory} description={includeDescription ? item.description : undefined}>
|
||||
<Highlighter
|
||||
textToHighlight={item.name}
|
||||
searchWords={[searchQuery]}
|
||||
highlightClassName={'search-fragment-highlight'}
|
||||
/>
|
||||
{!isExpanded && includeCounter && item.getItemsCount && <Counter value={item.getItemsCount(property.value)} />}
|
||||
</Label>
|
||||
{!isSystemOverride && (
|
||||
<div>
|
||||
<IconButton name="times" onClick={onRemove} />
|
||||
</div>
|
||||
)}
|
||||
</HorizontalGroup>
|
||||
);
|
||||
/* eslint-disable react/display-name */
|
||||
const renderLabel =
|
||||
(includeDescription = true, includeCounter = false) =>
|
||||
(isExpanded = false) =>
|
||||
(
|
||||
<HorizontalGroup justify="space-between">
|
||||
<Label category={labelCategory} description={includeDescription ? item.description : undefined}>
|
||||
<Highlighter
|
||||
textToHighlight={item.name}
|
||||
searchWords={[searchQuery]}
|
||||
highlightClassName={'search-fragment-highlight'}
|
||||
/>
|
||||
{!isExpanded && includeCounter && item.getItemsCount && (
|
||||
<Counter value={item.getItemsCount(property.value)} />
|
||||
)}
|
||||
</Label>
|
||||
{!isSystemOverride && (
|
||||
<div>
|
||||
<IconButton name="times" onClick={onRemove} />
|
||||
</div>
|
||||
)}
|
||||
</HorizontalGroup>
|
||||
);
|
||||
/* eslint-enable react/display-name */
|
||||
|
||||
if (isCollapsible) {
|
||||
editor = (
|
||||
|
||||
@@ -25,21 +25,21 @@ describe('standardFieldConfigEditorRegistry', () => {
|
||||
describe('supportsDataQuery', () => {
|
||||
describe('when called with plugin that supports queries', () => {
|
||||
it('then it should return true', () => {
|
||||
const plugin = ({ meta: { skipDataQuery: false } } as unknown) as PanelPlugin;
|
||||
const plugin = { meta: { skipDataQuery: false } } as unknown as PanelPlugin;
|
||||
expect(supportsDataQuery(plugin)).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when called with plugin that does not support queries', () => {
|
||||
it('then it should return false', () => {
|
||||
const plugin = ({ meta: { skipDataQuery: true } } as unknown) as PanelPlugin;
|
||||
const plugin = { meta: { skipDataQuery: true } } as unknown as PanelPlugin;
|
||||
expect(supportsDataQuery(plugin)).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when called without skipDataQuery', () => {
|
||||
it('then it should return false', () => {
|
||||
const plugin = ({ meta: {} } as unknown) as PanelPlugin;
|
||||
const plugin = { meta: {} } as unknown as PanelPlugin;
|
||||
expect(supportsDataQuery(plugin)).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -197,14 +197,8 @@ export class ShareSnapshot extends PureComponent<Props, State> {
|
||||
|
||||
renderStep1() {
|
||||
const { onDismiss } = this.props;
|
||||
const {
|
||||
snapshotName,
|
||||
selectedExpireOption,
|
||||
timeoutSeconds,
|
||||
isLoading,
|
||||
sharingButtonText,
|
||||
externalEnabled,
|
||||
} = this.state;
|
||||
const { snapshotName, selectedExpireOption, timeoutSeconds, isLoading, sharingButtonText, externalEnabled } =
|
||||
this.state;
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
@@ -31,11 +31,11 @@ describe('buildParams', () => {
|
||||
`(
|
||||
"when called with search: '$search' and useCurrentTimeRange: '$useCurrentTimeRange' and selectedTheme: '$selectedTheme' and panel: '$panel'then result should be '$expected'",
|
||||
({ search, useCurrentTimeRange, selectedTheme, panel, expected }) => {
|
||||
const range: TimeRange = ({
|
||||
const range: TimeRange = {
|
||||
from: 1000,
|
||||
to: 2000,
|
||||
raw: { from: 'now-6h', to: 'now' },
|
||||
} as unknown) as TimeRange;
|
||||
} as unknown as TimeRange;
|
||||
const orgId = '2';
|
||||
const result = buildParams({ useCurrentTimeRange, selectedTheme, panel, search, range, orgId });
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ describe('historySrv', () => {
|
||||
});
|
||||
|
||||
it('should return an empty array when not given a dashboard', () => {
|
||||
return historySrv.getHistoryList((null as unknown) as DashboardModel, historyListOpts).then((versions: any) => {
|
||||
return historySrv.getHistoryList(null as unknown as DashboardModel, historyListOpts).then((versions: any) => {
|
||||
expect(versions).toEqual([]);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -125,7 +125,7 @@ describe('getDiffText', () => {
|
||||
test.each(cases)(
|
||||
'returns a semantic message based on the type of diff, the values and the location of the change',
|
||||
(diff: Partial<Diff>, expected: string) => {
|
||||
expect(getDiffText((diff as unknown) as Diff)).toBe(expected);
|
||||
expect(getDiffText(diff as unknown as Diff)).toBe(expected);
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user