From 5ca382c88adc2372afa60c86697aceb263ed1c73 Mon Sep 17 00:00:00 2001 From: Ashley Harrison Date: Mon, 17 Jul 2023 14:46:15 +0100 Subject: [PATCH] Revert "Update dependency prettier to v3 (#71586)" (#71755) This reverts commit 2e8cd1c021ffba522457982f3535916bbead22a4. --- .yarn/sdks/prettier/package.json | 2 +- e2e/cloud-plugins-suite/azure-monitor.spec.ts | 60 +++----------- package.json | 6 +- packages/grafana-data/src/events/EventBus.ts | 6 +- .../grafana-data/src/panel/PanelPlugin.ts | 2 +- .../src/types/OptionsUIRegistryBuilder.ts | 4 +- packages/grafana-data/src/types/datasource.ts | 16 ++-- packages/grafana-data/src/types/variables.ts | 8 +- .../grafana-data/src/vector/SortedVector.ts | 5 +- .../src/utils/DataSourceWithBackend.ts | 2 +- .../grafana-toolkit/src/cli/tasks/task.ts | 5 +- .../ConfirmButton/ConfirmButton.tsx | 13 +-- .../Forms/Legacy/Select/_Select.scss | 1 - .../Forms/RadioButtonList/RadioButtonDot.tsx | 4 +- .../src/components/Forms/commonStyles.ts | 11 +-- .../grafana-ui/src/components/Input/Input.tsx | 50 +++++------ .../src/components/Menu/utils.test.ts | 2 +- .../PanelContainer/PanelContainer.tsx | 11 +-- .../components/Typeahead/TypeaheadItem.tsx | 7 +- .../transitions/SlideOutTransition.tsx | 8 +- .../utils/storybook/withStoryContainer.tsx | 4 +- .../src/utils/storybook/withTheme.tsx | 3 +- .../components/form_dropdown/form_dropdown.ts | 7 +- public/app/angular/components/switch.ts | 5 +- public/app/angular/diff-view.ts | 6 +- public/app/angular/panel/query_ctrl.ts | 5 +- public/app/angular/services/AngularLoader.ts | 5 +- .../AppChrome/SectionNav/SectionNavItem.tsx | 4 +- .../components/CloseButton/CloseButton.tsx | 11 +-- .../components/RolePicker/RolePickerInput.tsx | 4 +- public/app/core/components/help/HelpModal.tsx | 7 +- .../history/richHistoryLocalStorageUtils.ts | 4 +- public/app/core/services/keybindingSrv.ts | 5 +- .../alert-groups/AlertGroupHeader.tsx | 19 ++--- .../notification-policies/Modals.tsx | 2 +- .../receivers/editor/autocomplete.ts | 5 +- .../receivers/form/GrafanaReceiverForm.tsx | 2 +- .../components/rule-editor/QueryOptions.tsx | 6 +- .../rules/RuleDetailsDataSources.tsx | 19 ++--- .../rules/state-history/LogRecordViewer.tsx | 4 +- .../components/silences/SilencesTable.tsx | 17 ++-- .../unified/hooks/useURLSearchParams.ts | 2 +- .../unified/state/AlertingQueryRunner.ts | 5 +- .../features/alerting/unified/utils/rules.ts | 23 +++--- .../features/auth-config/ErrorContainer.tsx | 8 +- .../app/features/canvas/runtime/element.tsx | 6 +- public/app/features/canvas/runtime/frame.tsx | 6 +- public/app/features/canvas/runtime/root.tsx | 6 +- .../Forms/ConfigureCorrelationSourceForm.tsx | 6 +- .../AddPanelWidget/AddPanelWidget.tsx | 12 ++- .../AutoRefreshIntervals.test.tsx | 10 +-- .../PanelEditor/DynamicConfigValueEditor.tsx | 45 +++++----- .../dashboard/state/PanelModel.test.ts | 2 +- .../datasources/state/actions.test.ts | 8 +- .../datasources/state/reducers.test.ts | 2 +- .../features/explore/FeatureTogglePage.tsx | 7 +- .../explore/RichHistory/RichHistoryCard.tsx | 15 ++-- .../features/explore/TraceView/TraceView.tsx | 4 +- public/app/features/plugins/admin/helpers.ts | 11 +-- .../features/query/state/PanelQueryRunner.ts | 2 +- public/app/features/storage/RootView.tsx | 4 +- .../OrganizeFieldsTransformerEditor.tsx | 11 +-- public/app/features/transformers/utils.ts | 23 +++--- .../editor/getVariableQueryEditor.tsx | 4 +- public/app/features/variables/guard.ts | 20 ++--- .../app/features/variables/inspect/utils.ts | 82 +++++++++---------- .../app/features/variables/query/actions.ts | 33 ++++---- .../testing/datasourceVariableBuilder.ts | 2 +- public/app/features/variables/types.ts | 2 +- .../plugins/datasource/alertmanager/types.ts | 2 +- .../query-runner/CloudWatchRequest.ts | 5 +- .../elasticsearch/ElasticResponse.ts | 11 +-- .../datasource/elasticsearch/IndexPattern.ts | 5 +- .../plugins/datasource/graphite/datasource.ts | 5 +- .../CompletionDataProvider.ts | 5 +- .../datasource/mysql/sqlCompletionProvider.ts | 63 +++++++------- .../plugins/datasource/opentsdb/datasource.ts | 5 +- .../prometheus/metric_find_query.ts | 5 +- .../querybuilder/binaryScalarOperations.ts | 17 ++-- .../querybuilder/components/LabelFilters.tsx | 8 +- .../panel/annolist/AnnoListPanel.test.tsx | 2 +- public/app/plugins/panel/barchart/quadtree.ts | 8 +- public/app/plugins/panel/table-old/editor.ts | 5 +- public/app/plugins/panel/table-old/module.ts | 7 +- .../plugins/annotations/AnnotationTooltip.tsx | 4 +- public/sass/base/_grafana_icons.scss | 3 +- public/sass/base/font-awesome/_path.scss | 3 +- public/sass/components/_scrollbar.scss | 20 ++--- public/sass/components/_slate_editor.scss | 7 +- public/sass/components/_tagsinput.scss | 4 +- public/test/matchers/utils.ts | 4 +- public/test/mocks/datasource_srv.ts | 5 +- yarn.lock | 12 +-- 93 files changed, 378 insertions(+), 565 deletions(-) diff --git a/.yarn/sdks/prettier/package.json b/.yarn/sdks/prettier/package.json index 3c1bb0be150..f2362f14d65 100644 --- a/.yarn/sdks/prettier/package.json +++ b/.yarn/sdks/prettier/package.json @@ -1,6 +1,6 @@ { "name": "prettier", - "version": "3.0.0-sdk", + "version": "2.8.4-sdk", "main": "./index.js", "type": "commonjs" } diff --git a/e2e/cloud-plugins-suite/azure-monitor.spec.ts b/e2e/cloud-plugins-suite/azure-monitor.spec.ts index 5fceb7bbb4a..98a2e0de423 100644 --- a/e2e/cloud-plugins-suite/azure-monitor.spec.ts +++ b/e2e/cloud-plugins-suite/azure-monitor.spec.ts @@ -92,62 +92,26 @@ const addAzureMonitorVariable = ( .type(`${type.replace('Azure', '').trim()}{enter}`); switch (type) { case AzureQueryType.ResourceGroupsQuery: - e2eSelectors.variableEditor.subscription - .input() - .find('input') - .type(`${options?.subscription}{enter}`); + e2eSelectors.variableEditor.subscription.input().find('input').type(`${options?.subscription}{enter}`); break; case AzureQueryType.LocationsQuery: - e2eSelectors.variableEditor.subscription - .input() - .find('input') - .type(`${options?.subscription}{enter}`); + e2eSelectors.variableEditor.subscription.input().find('input').type(`${options?.subscription}{enter}`); break; case AzureQueryType.NamespacesQuery: - e2eSelectors.variableEditor.subscription - .input() - .find('input') - .type(`${options?.subscription}{enter}`); - e2eSelectors.variableEditor.resourceGroup - .input() - .find('input') - .type(`${options?.resourceGroup}{enter}`); + e2eSelectors.variableEditor.subscription.input().find('input').type(`${options?.subscription}{enter}`); + e2eSelectors.variableEditor.resourceGroup.input().find('input').type(`${options?.resourceGroup}{enter}`); break; case AzureQueryType.ResourceNamesQuery: - e2eSelectors.variableEditor.subscription - .input() - .find('input') - .type(`${options?.subscription}{enter}`); - e2eSelectors.variableEditor.resourceGroup - .input() - .find('input') - .type(`${options?.resourceGroup}{enter}`); - e2eSelectors.variableEditor.namespace - .input() - .find('input') - .type(`${options?.namespace}{enter}`); - e2eSelectors.variableEditor.region - .input() - .find('input') - .type(`${options?.region}{enter}`); + e2eSelectors.variableEditor.subscription.input().find('input').type(`${options?.subscription}{enter}`); + e2eSelectors.variableEditor.resourceGroup.input().find('input').type(`${options?.resourceGroup}{enter}`); + e2eSelectors.variableEditor.namespace.input().find('input').type(`${options?.namespace}{enter}`); + e2eSelectors.variableEditor.region.input().find('input').type(`${options?.region}{enter}`); break; case AzureQueryType.MetricNamesQuery: - e2eSelectors.variableEditor.subscription - .input() - .find('input') - .type(`${options?.subscription}{enter}`); - e2eSelectors.variableEditor.resourceGroup - .input() - .find('input') - .type(`${options?.resourceGroup}{enter}`); - e2eSelectors.variableEditor.namespace - .input() - .find('input') - .type(`${options?.namespace}{enter}`); - e2eSelectors.variableEditor.resource - .input() - .find('input') - .type(`${options?.resource}{enter}`); + e2eSelectors.variableEditor.subscription.input().find('input').type(`${options?.subscription}{enter}`); + e2eSelectors.variableEditor.resourceGroup.input().find('input').type(`${options?.resourceGroup}{enter}`); + e2eSelectors.variableEditor.namespace.input().find('input').type(`${options?.namespace}{enter}`); + e2eSelectors.variableEditor.resource.input().find('input').type(`${options?.resource}{enter}`); break; } e2e.pages.Dashboard.Settings.Variables.Edit.General.submitButton().click(); diff --git a/package.json b/package.json index f7bc66c2513..98ca3278735 100644 --- a/package.json +++ b/package.json @@ -31,8 +31,8 @@ "packages:pack": "mkdir -p ./npm-artifacts && lerna exec --no-private -- yarn pack --out \"../../npm-artifacts/%s-%v.tgz\"", "packages:typecheck": "lerna run typecheck", "precommit": "yarn run lint-staged", - "prettier:check": "prettier --check --list-different=false --log-level=warn \"**/*.{ts,tsx,scss,md,mdx}\"", - "prettier:checkDocs": "prettier --check --list-different=false --log-level=warn \"docs/**/*.md\" \"*.md\" \"packages/**/*.{ts,tsx,scss,md,mdx}\"", + "prettier:check": "prettier --check --list-different=false --loglevel=warn \"**/*.{ts,tsx,scss,md,mdx}\"", + "prettier:checkDocs": "prettier --check --list-different=false --loglevel=warn \"docs/**/*.md\" \"*.md\" \"packages/**/*.{ts,tsx,scss,md,mdx}\"", "prettier:write": "prettier --list-different \"**/*.{js,ts,tsx,scss,md,mdx}\" --write", "start": "yarn themes:generate && yarn dev --watch", "start:noTsCheck": "yarn start --env noTsCheck=1", @@ -223,7 +223,7 @@ "postcss-loader": "7.3.3", "postcss-reporter": "7.0.5", "postcss-scss": "4.0.6", - "prettier": "3.0.0", + "prettier": "2.8.4", "react-refresh": "0.14.0", "react-select-event": "5.5.1", "react-simple-compat": "1.2.3", diff --git a/packages/grafana-data/src/events/EventBus.ts b/packages/grafana-data/src/events/EventBus.ts index 2caf8a5c807..4296d98c668 100644 --- a/packages/grafana-data/src/events/EventBus.ts +++ b/packages/grafana-data/src/events/EventBus.ts @@ -113,11 +113,7 @@ class ScopedEventBus implements EventBus { filterConfig: EventFilterOptions; // The path is not yet exposed, but can be used to indicate nested groups and support faster filtering - constructor( - public path: string[], - private eventBus: EventBus, - filter?: EventFilterOptions - ) { + constructor(public path: string[], private eventBus: EventBus, filter?: EventFilterOptions) { this.filterConfig = filter ?? { onlyLocal: false }; } diff --git a/packages/grafana-data/src/panel/PanelPlugin.ts b/packages/grafana-data/src/panel/PanelPlugin.ts index c0860426f7d..150c53e7895 100644 --- a/packages/grafana-data/src/panel/PanelPlugin.ts +++ b/packages/grafana-data/src/panel/PanelPlugin.ts @@ -94,7 +94,7 @@ export type PanelOptionsSupplier = ( export class PanelPlugin< TOptions = any, - TFieldConfigOptions extends object = any, + TFieldConfigOptions extends object = any > extends GrafanaPlugin { private _defaults?: TOptions; private _fieldConfigDefaults: FieldConfigSource = { diff --git a/packages/grafana-data/src/types/OptionsUIRegistryBuilder.ts b/packages/grafana-data/src/types/OptionsUIRegistryBuilder.ts index 0765f1987a3..72bc00abfac 100644 --- a/packages/grafana-data/src/types/OptionsUIRegistryBuilder.ts +++ b/packages/grafana-data/src/types/OptionsUIRegistryBuilder.ts @@ -33,7 +33,7 @@ export interface OptionsEditorItem export interface OptionsUIRegistryBuilderAPI< TOptions, TEditorProps, - T extends OptionsEditorItem, + T extends OptionsEditorItem > { addNumberInput?( config: OptionEditorConfig @@ -80,7 +80,7 @@ export interface OptionsUIRegistryBuilderAPI< export abstract class OptionsUIRegistryBuilder< TOptions, TEditorProps, - T extends OptionsEditorItem, + T extends OptionsEditorItem > implements OptionsUIRegistryBuilderAPI { private properties: T[] = []; diff --git a/packages/grafana-data/src/types/datasource.ts b/packages/grafana-data/src/types/datasource.ts index a2d839736c4..9a33ca35d5a 100644 --- a/packages/grafana-data/src/types/datasource.ts +++ b/packages/grafana-data/src/types/datasource.ts @@ -18,7 +18,7 @@ import { DataSourceRef, WithAccessControlMetadata } from '.'; export interface DataSourcePluginOptionsEditorProps< JSONData extends DataSourceJsonData = DataSourceJsonData, - SecureJSONData = {}, + SecureJSONData = {} > { options: DataSourceSettings; onOptionsChange: (options: DataSourceSettings) => void; @@ -34,7 +34,7 @@ export class DataSourcePlugin< DSType extends DataSourceApi, TQuery extends DataQuery = DataSourceQueryType, TOptions extends DataSourceJsonData = DataSourceOptionsType, - TSecureOptions = {}, + TSecureOptions = {} > extends GrafanaPlugin> { components: DataSourcePluginComponents = {}; @@ -155,7 +155,7 @@ export interface DataSourcePluginComponents< DSType extends DataSourceApi, TQuery extends DataQuery = DataQuery, TOptions extends DataSourceJsonData = DataSourceJsonData, - TSecureOptions = {}, + TSecureOptions = {} > { QueryCtrl?: any; AnnotationsQueryCtrl?: any; @@ -176,7 +176,7 @@ export interface DataSourcePluginComponents< export interface DataSourceConstructor< DSType extends DataSourceApi, TQuery extends DataQuery = DataQuery, - TOptions extends DataSourceJsonData = DataSourceJsonData, + TOptions extends DataSourceJsonData = DataSourceJsonData > { new (instanceSettings: DataSourceInstanceSettings, ...args: any[]): DSType; } @@ -197,7 +197,7 @@ type VariableSupport = {}, + TQueryImportConfiguration extends Record = {} > { /** * Set in constructor @@ -375,7 +375,7 @@ abstract class DataSourceApi< export interface MetadataInspectorProps< DSType extends DataSourceApi, TQuery extends DataQuery = DataQuery, - TOptions extends DataSourceJsonData = DataSourceJsonData, + TOptions extends DataSourceJsonData = DataSourceJsonData > { datasource: DSType; @@ -387,7 +387,7 @@ export interface QueryEditorProps< DSType extends DataSourceApi, TQuery extends DataQuery = DataQuery, TOptions extends DataSourceJsonData = DataSourceJsonData, - TVQuery extends DataQuery = TQuery, + TVQuery extends DataQuery = TQuery > { datasource: DSType; query: TVQuery; @@ -419,7 +419,7 @@ export enum ExploreMode { export type ExploreQueryFieldProps< DSType extends DataSourceApi, TQuery extends DataQuery = DataQuery, - TOptions extends DataSourceJsonData = DataSourceJsonData, + TOptions extends DataSourceJsonData = DataSourceJsonData > = QueryEditorProps; export interface QueryEditorHelpProps { diff --git a/packages/grafana-data/src/types/variables.ts b/packages/grafana-data/src/types/variables.ts index 43978fe69a8..f8d8666c09e 100644 --- a/packages/grafana-data/src/types/variables.ts +++ b/packages/grafana-data/src/types/variables.ts @@ -32,7 +32,7 @@ export enum VariableSupportType { export abstract class VariableSupportBase< DSType extends DataSourceApi, TQuery extends DataQuery = DataSourceQueryType, - TOptions extends DataSourceJsonData = DataSourceOptionsType, + TOptions extends DataSourceJsonData = DataSourceOptionsType > { abstract getType(): VariableSupportType; @@ -50,7 +50,7 @@ export abstract class VariableSupportBase< export abstract class StandardVariableSupport< DSType extends DataSourceApi, TQuery extends DataQuery = DataSourceQueryType, - TOptions extends DataSourceJsonData = DataSourceOptionsType, + TOptions extends DataSourceJsonData = DataSourceOptionsType > extends VariableSupportBase { getType(): VariableSupportType { return VariableSupportType.Standard; @@ -69,7 +69,7 @@ export abstract class CustomVariableSupport< DSType extends DataSourceApi, VariableQuery extends DataQuery = any, TQuery extends DataQuery = DataSourceQueryType, - TOptions extends DataSourceJsonData = DataSourceOptionsType, + TOptions extends DataSourceJsonData = DataSourceOptionsType > extends VariableSupportBase { getType(): VariableSupportType { return VariableSupportType.Custom; @@ -87,7 +87,7 @@ export abstract class CustomVariableSupport< export abstract class DataSourceVariableSupport< DSType extends DataSourceApi, TQuery extends DataQuery = DataSourceQueryType, - TOptions extends DataSourceJsonData = DataSourceOptionsType, + TOptions extends DataSourceJsonData = DataSourceOptionsType > extends VariableSupportBase { getType(): VariableSupportType { return VariableSupportType.Datasource; diff --git a/packages/grafana-data/src/vector/SortedVector.ts b/packages/grafana-data/src/vector/SortedVector.ts index 8ed64671688..5e3dd5176ba 100644 --- a/packages/grafana-data/src/vector/SortedVector.ts +++ b/packages/grafana-data/src/vector/SortedVector.ts @@ -9,10 +9,7 @@ import { vectorToArray } from './vectorToArray'; * @deprecated use a simple Arrays */ export class SortedVector extends FunctionalVector { - constructor( - private source: Vector, - private order: number[] - ) { + constructor(private source: Vector, private order: number[]) { super(); return makeArrayIndexableVector(this); } diff --git a/packages/grafana-runtime/src/utils/DataSourceWithBackend.ts b/packages/grafana-runtime/src/utils/DataSourceWithBackend.ts index 5e9c758c2a3..482427e5187 100644 --- a/packages/grafana-runtime/src/utils/DataSourceWithBackend.ts +++ b/packages/grafana-runtime/src/utils/DataSourceWithBackend.ts @@ -113,7 +113,7 @@ export interface HealthCheckResult { */ class DataSourceWithBackend< TQuery extends DataQuery = DataQuery, - TOptions extends DataSourceJsonData = DataSourceJsonData, + TOptions extends DataSourceJsonData = DataSourceJsonData > extends DataSourceApi { constructor(instanceSettings: DataSourceInstanceSettings) { super(instanceSettings); diff --git a/packages/grafana-toolkit/src/cli/tasks/task.ts b/packages/grafana-toolkit/src/cli/tasks/task.ts index 73973c8b50f..4524508bd83 100644 --- a/packages/grafana-toolkit/src/cli/tasks/task.ts +++ b/packages/grafana-toolkit/src/cli/tasks/task.ts @@ -3,10 +3,7 @@ export type TaskRunner = (options: T) => Promise; export class Task { options: TOptions = {} as any; - constructor( - public name: string, - public runner: TaskRunner - ) {} + constructor(public name: string, public runner: TaskRunner) {} setName = (name: string) => { this.name = name; }; diff --git a/packages/grafana-ui/src/components/ConfirmButton/ConfirmButton.tsx b/packages/grafana-ui/src/components/ConfirmButton/ConfirmButton.tsx index aa806566705..18ce89de782 100644 --- a/packages/grafana-ui/src/components/ConfirmButton/ConfirmButton.tsx +++ b/packages/grafana-ui/src/components/ConfirmButton/ConfirmButton.tsx @@ -164,9 +164,7 @@ const getStyles = stylesFactory((theme: GrafanaTheme2) => { `, buttonHide: css` opacity: 0; - transition: - opacity 0.1s ease, - visibility 0 0.1s; + transition: opacity 0.1s ease, visibility 0 0.1s; visibility: hidden; z-index: 0; `, @@ -180,19 +178,14 @@ const getStyles = stylesFactory((theme: GrafanaTheme2) => { confirmButtonShow: css` z-index: 1; opacity: 1; - transition: - opacity 0.08s ease-out, - transform 0.1s ease-out; + transition: opacity 0.08s ease-out, transform 0.1s ease-out; transform: translateX(0); pointer-events: all; `, confirmButtonHide: css` opacity: 0; visibility: hidden; - transition: - opacity 0.12s ease-in, - transform 0.14s ease-in, - visibility 0s 0.12s; + transition: opacity 0.12s ease-in, transform 0.14s ease-in, visibility 0s 0.12s; transform: translateX(100px); `, disabled: css` diff --git a/packages/grafana-ui/src/components/Forms/Legacy/Select/_Select.scss b/packages/grafana-ui/src/components/Forms/Legacy/Select/_Select.scss index ace4fcc36e6..62028ed1dd4 100644 --- a/packages/grafana-ui/src/components/Forms/Legacy/Select/_Select.scss +++ b/packages/grafana-ui/src/components/Forms/Legacy/Select/_Select.scss @@ -11,7 +11,6 @@ $select-input-bg-disabled: $input-bg-disabled; @mixin select-control-focus() { border-color: $input-border-focus; outline: none; - // prettier-ignore $shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px $input-box-shadow-focus; @include box-shadow($shadow); } diff --git a/packages/grafana-ui/src/components/Forms/RadioButtonList/RadioButtonDot.tsx b/packages/grafana-ui/src/components/Forms/RadioButtonList/RadioButtonDot.tsx index 55e6ce11a24..78761cc4e77 100644 --- a/packages/grafana-ui/src/components/Forms/RadioButtonList/RadioButtonDot.tsx +++ b/packages/grafana-ui/src/components/Forms/RadioButtonList/RadioButtonDot.tsx @@ -75,9 +75,7 @@ const getStyles = (theme: GrafanaTheme2) => ({ :focus { outline: none !important; - box-shadow: - 0 0 0 1px ${theme.colors.background.canvas}, - 0 0 0 3px ${theme.colors.primary.main}; + box-shadow: 0 0 0 1px ${theme.colors.background.canvas}, 0 0 0 3px ${theme.colors.primary.main}; } `, label: css` diff --git a/packages/grafana-ui/src/components/Forms/commonStyles.ts b/packages/grafana-ui/src/components/Forms/commonStyles.ts index d4ae7e92eef..ddc3399a740 100644 --- a/packages/grafana-ui/src/components/Forms/commonStyles.ts +++ b/packages/grafana-ui/src/components/Forms/commonStyles.ts @@ -33,20 +33,15 @@ export const sharedInputStyle = (theme: GrafanaTheme2, invalid = false) => { &:-webkit-autofill, &:-webkit-autofill:hover { /* Welcome to 2005. This is a HACK to get rid od Chromes default autofill styling */ - box-shadow: - inset 0 0 0 1px rgba(255, 255, 255, 0), - inset 0 0 0 100px ${background}!important; + box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0), inset 0 0 0 100px ${background}!important; -webkit-text-fill-color: ${textColor} !important; border-color: ${autoFillBorder}; } &:-webkit-autofill:focus { /* Welcome to 2005. This is a HACK to get rid od Chromes default autofill styling */ - box-shadow: - 0 0 0 2px ${theme.colors.background.primary}, - 0 0 0px 4px ${theme.colors.primary.main}, - inset 0 0 0 1px rgba(255, 255, 255, 0), - inset 0 0 0 100px ${background}!important; + box-shadow: 0 0 0 2px ${theme.colors.background.primary}, 0 0 0px 4px ${theme.colors.primary.main}, + inset 0 0 0 1px rgba(255, 255, 255, 0), inset 0 0 0 100px ${background}!important; -webkit-text-fill-color: ${textColor} !important; } diff --git a/packages/grafana-ui/src/components/Input/Input.tsx b/packages/grafana-ui/src/components/Input/Input.tsx index 7eb170c228c..fdbf6f666f8 100644 --- a/packages/grafana-ui/src/components/Input/Input.tsx +++ b/packages/grafana-ui/src/components/Input/Input.tsx @@ -100,33 +100,35 @@ export const getInputStyles = stylesFactory(({ theme, invalid = false, width }: return { // Wraps inputWrapper and addons - wrapper: cx(css` - label: input-wrapper; - display: flex; - width: ${width ? `${theme.spacing(width)}` : '100%'}; - height: ${theme.spacing(theme.components.height.md)}; - border-radius: ${theme.shape.borderRadius()}; - &:hover { - > .prefix, - .suffix, - .input { - border-color: ${invalid ? theme.colors.error.border : theme.colors.primary.border}; - } + wrapper: cx( + css` + label: input-wrapper; + display: flex; + width: ${width ? `${theme.spacing(width)}` : '100%'}; + height: ${theme.spacing(theme.components.height.md)}; + border-radius: ${theme.shape.borderRadius()}; + &:hover { + > .prefix, + .suffix, + .input { + border-color: ${invalid ? theme.colors.error.border : theme.colors.primary.border}; + } - // only show number buttons on hover - input[type='number'] { - -moz-appearance: number-input; - -webkit-appearance: number-input; - appearance: textfield; - } + // only show number buttons on hover + input[type='number'] { + -moz-appearance: number-input; + -webkit-appearance: number-input; + appearance: textfield; + } - input[type='number']::-webkit-inner-spin-button, - input[type='number']::-webkit-outer-spin-button { - -webkit-appearance: inner-spin-button !important; - opacity: 1; + input[type='number']::-webkit-inner-spin-button, + input[type='number']::-webkit-outer-spin-button { + -webkit-appearance: inner-spin-button !important; + opacity: 1; + } } - } - `), + ` + ), // Wraps input and prefix/suffix inputWrapper: css` label: input-inputWrapper; diff --git a/packages/grafana-ui/src/components/Menu/utils.test.ts b/packages/grafana-ui/src/components/Menu/utils.test.ts index 6960813bea1..11ab59f1d6c 100644 --- a/packages/grafana-ui/src/components/Menu/utils.test.ts +++ b/packages/grafana-ui/src/components/Menu/utils.test.ts @@ -8,7 +8,7 @@ describe('utils', () => { getBoundingClientRect: () => ({ right }), }, getBoundingClientRect: () => ({ width }), - }) as HTMLElement; + } as HTMLElement); Object.defineProperty(window, 'innerWidth', { value: 1000 }); diff --git a/packages/grafana-ui/src/components/PanelContainer/PanelContainer.tsx b/packages/grafana-ui/src/components/PanelContainer/PanelContainer.tsx index fe2ed4bc149..7add88dc4cc 100644 --- a/packages/grafana-ui/src/components/PanelContainer/PanelContainer.tsx +++ b/packages/grafana-ui/src/components/PanelContainer/PanelContainer.tsx @@ -16,8 +16,9 @@ export const PanelContainer = ({ children, className, ...props }: Props) => { ); }; -const getStyles = (theme: GrafanaTheme2) => css` - background-color: ${theme.components.panel.background}; - border: 1px solid ${theme.components.panel.borderColor}; - border-radius: ${theme.shape.radius.default}; -`; +const getStyles = (theme: GrafanaTheme2) => + css` + background-color: ${theme.components.panel.background}; + border: 1px solid ${theme.components.panel.borderColor}; + border-radius: ${theme.shape.radius.default}; + `; diff --git a/packages/grafana-ui/src/components/Typeahead/TypeaheadItem.tsx b/packages/grafana-ui/src/components/Typeahead/TypeaheadItem.tsx index b9cab738685..89750758c0a 100644 --- a/packages/grafana-ui/src/components/Typeahead/TypeaheadItem.tsx +++ b/packages/grafana-ui/src/components/Typeahead/TypeaheadItem.tsx @@ -36,11 +36,8 @@ const getStyles = (theme: GrafanaTheme2) => ({ display: block; white-space: nowrap; cursor: pointer; - transition: - color 0.3s cubic-bezier(0.645, 0.045, 0.355, 1), - border-color 0.3s cubic-bezier(0.645, 0.045, 0.355, 1), - background 0.3s cubic-bezier(0.645, 0.045, 0.355, 1), - padding 0.15s cubic-bezier(0.645, 0.045, 0.355, 1); + transition: color 0.3s cubic-bezier(0.645, 0.045, 0.355, 1), border-color 0.3s cubic-bezier(0.645, 0.045, 0.355, 1), + background 0.3s cubic-bezier(0.645, 0.045, 0.355, 1), padding 0.15s cubic-bezier(0.645, 0.045, 0.355, 1); `, typeaheadItemSelected: css` diff --git a/packages/grafana-ui/src/components/transitions/SlideOutTransition.tsx b/packages/grafana-ui/src/components/transitions/SlideOutTransition.tsx index ff0dbee6034..4bdac36eb2c 100644 --- a/packages/grafana-ui/src/components/transitions/SlideOutTransition.tsx +++ b/packages/grafana-ui/src/components/transitions/SlideOutTransition.tsx @@ -15,9 +15,7 @@ const getStyles = stylesFactory((duration: number, measurement: 'width' | 'heigh label: enterActive; ${measurement}: ${size}px; opacity: 1; - transition: - opacity ${duration}ms ease-out, - ${measurement} ${duration}ms ease-out; + transition: opacity ${duration}ms ease-out, ${measurement} ${duration}ms ease-out; `, exit: css` label: exit; @@ -28,9 +26,7 @@ const getStyles = stylesFactory((duration: number, measurement: 'width' | 'heigh label: exitActive; opacity: 0; ${measurement}: 0; - transition: - opacity ${duration}ms ease-out, - ${measurement} ${duration}ms ease-out; + transition: opacity ${duration}ms ease-out, ${measurement} ${duration}ms ease-out; `, }; }); diff --git a/packages/grafana-ui/src/utils/storybook/withStoryContainer.tsx b/packages/grafana-ui/src/utils/storybook/withStoryContainer.tsx index c600c4673f5..baed4477e01 100644 --- a/packages/grafana-ui/src/utils/storybook/withStoryContainer.tsx +++ b/packages/grafana-ui/src/utils/storybook/withStoryContainer.tsx @@ -17,9 +17,7 @@ const StoryContainer = ({ width, height, showBoundaries, children }: React.Props css` background-color: white; background-size: 30px 30px; - background-position: - 0 0, - 15px 15px; + background-position: 0 0, 15px 15px; background-image: linear-gradient( 45deg, ${checkColor} 25%, diff --git a/packages/grafana-ui/src/utils/storybook/withTheme.tsx b/packages/grafana-ui/src/utils/storybook/withTheme.tsx index 45cec079dd5..447b6b38a55 100644 --- a/packages/grafana-ui/src/utils/storybook/withTheme.tsx +++ b/packages/grafana-ui/src/utils/storybook/withTheme.tsx @@ -52,4 +52,5 @@ export const renderComponentWithTheme = (component: React.ComponentType, pr export const withTheme = (handleSassThemeChange: SassThemeChangeHandler): DecoratorFn => // eslint-disable-next-line react/display-name - (story) => {story()}; + (story) => + {story()}; diff --git a/public/app/angular/components/form_dropdown/form_dropdown.ts b/public/app/angular/components/form_dropdown/form_dropdown.ts index dc3716615bd..3637a2f0487 100644 --- a/public/app/angular/components/form_dropdown/form_dropdown.ts +++ b/public/app/angular/components/form_dropdown/form_dropdown.ts @@ -41,12 +41,7 @@ export class FormDropdownCtrl { static $inject = ['$scope', '$element', '$sce', 'templateSrv']; - constructor( - private $scope: any, - $element: JQLite, - private $sce: ISCEService, - private templateSrv: any - ) { + constructor(private $scope: any, $element: JQLite, private $sce: ISCEService, private templateSrv: any) { this.inputElement = $element.find('input').first(); this.linkElement = $element.find('a').first(); this.linkMode = true; diff --git a/public/app/angular/components/switch.ts b/public/app/angular/components/switch.ts index d67531ba174..341dbcb8943 100644 --- a/public/app/angular/components/switch.ts +++ b/public/app/angular/components/switch.ts @@ -39,10 +39,7 @@ export class SwitchCtrl { static $inject = ['$scope', '$timeout']; - constructor( - $scope: any, - private $timeout: any - ) { + constructor($scope: any, private $timeout: any) { this.show = true; this.id = $scope.$id; } diff --git a/public/app/angular/diff-view.ts b/public/app/angular/diff-view.ts index fa7a0a06b7c..23fc8280fad 100644 --- a/public/app/angular/diff-view.ts +++ b/public/app/angular/diff-view.ts @@ -42,11 +42,7 @@ coreModule.directive('diffDelta', delta); export class LinkJSONCtrl { static $inject = ['$scope', '$rootScope', '$anchorScroll']; - constructor( - private $scope: any, - private $rootScope: GrafanaRootScope, - private $anchorScroll: any - ) {} + constructor(private $scope: any, private $rootScope: GrafanaRootScope, private $anchorScroll: any) {} goToLine(line: number) { let unbind: () => void; diff --git a/public/app/angular/panel/query_ctrl.ts b/public/app/angular/panel/query_ctrl.ts index ac8dd17b895..1a02ba248bf 100644 --- a/public/app/angular/panel/query_ctrl.ts +++ b/public/app/angular/panel/query_ctrl.ts @@ -10,10 +10,7 @@ export class QueryCtrl { error?: string | null; isLastQuery: boolean; - constructor( - public $scope: any, - public $injector: auto.IInjectorService - ) { + constructor(public $scope: any, public $injector: auto.IInjectorService) { this.panelCtrl = this.panelCtrl ?? $scope.ctrl.panelCtrl; this.target = this.target ?? $scope.ctrl.target; this.datasource = this.datasource ?? $scope.ctrl.datasource; diff --git a/public/app/angular/services/AngularLoader.ts b/public/app/angular/services/AngularLoader.ts index 4244eebdd2b..a006bbd14ce 100644 --- a/public/app/angular/services/AngularLoader.ts +++ b/public/app/angular/services/AngularLoader.ts @@ -8,10 +8,7 @@ import coreModule from 'app/angular/core_module'; export class AngularLoader implements AngularLoaderInterface { static $inject = ['$compile', '$rootScope']; - constructor( - private $compile: any, - private $rootScope: GrafanaRootScope - ) {} + constructor(private $compile: any, private $rootScope: GrafanaRootScope) {} load(elem: any, scopeProps: any, template: string): AngularComponent { const scope = this.$rootScope.$new(); diff --git a/public/app/core/components/AppChrome/SectionNav/SectionNavItem.tsx b/public/app/core/components/AppChrome/SectionNav/SectionNavItem.tsx index 7865ac56343..d7e0579adfc 100644 --- a/public/app/core/components/AppChrome/SectionNav/SectionNavItem.tsx +++ b/public/app/core/components/AppChrome/SectionNav/SectionNavItem.tsx @@ -56,7 +56,9 @@ export function SectionNavItem({ item, isSectionRoot = false }: Props) { {item.text} {item.tabSuffix && } - {children?.map((child, index) => )} + {children?.map((child, index) => ( + + ))} ); } diff --git a/public/app/core/components/CloseButton/CloseButton.tsx b/public/app/core/components/CloseButton/CloseButton.tsx index 77b40669936..f00aa961b6d 100644 --- a/public/app/core/components/CloseButton/CloseButton.tsx +++ b/public/app/core/components/CloseButton/CloseButton.tsx @@ -24,8 +24,9 @@ export const CloseButton = ({ onClick, 'aria-label': ariaLabel, style }: Props) ); }; -const getStyles = (theme: GrafanaTheme2) => css` - position: absolute; - right: ${theme.spacing(0.5)}; - top: ${theme.spacing(1)}; -`; +const getStyles = (theme: GrafanaTheme2) => + css` + position: absolute; + right: ${theme.spacing(0.5)}; + top: ${theme.spacing(1)}; + `; diff --git a/public/app/core/components/RolePicker/RolePickerInput.tsx b/public/app/core/components/RolePicker/RolePickerInput.tsx index cfd357601ea..c3e6a4e2089 100644 --- a/public/app/core/components/RolePicker/RolePickerInput.tsx +++ b/public/app/core/components/RolePicker/RolePickerInput.tsx @@ -101,7 +101,9 @@ export const RolesLabel = ({ showBuiltInRole, numberOfRoles, appliedRoles }: Rol - {appliedRoles?.map((role) =>

{role.displayName}

)} + {appliedRoles?.map((role) => ( +

{role.displayName}

+ ))} } > diff --git a/public/app/core/components/help/HelpModal.tsx b/public/app/core/components/help/HelpModal.tsx index 7761c3e4d6e..d78d3d74c4c 100644 --- a/public/app/core/components/help/HelpModal.tsx +++ b/public/app/core/components/help/HelpModal.tsx @@ -140,12 +140,7 @@ function getStyles(theme: GrafanaTheme2) { text-align: center; margin-right: ${theme.spacing(0.5)}; padding: 3px 5px; - font: - 11px Consolas, - 'Liberation Mono', - Menlo, - Courier, - monospace; + font: 11px Consolas, 'Liberation Mono', Menlo, Courier, monospace; line-height: 10px; vertical-align: middle; border: solid 1px ${theme.colors.border.medium}; diff --git a/public/app/core/history/richHistoryLocalStorageUtils.ts b/public/app/core/history/richHistoryLocalStorageUtils.ts index f5ff6da8150..7f58de9a860 100644 --- a/public/app/core/history/richHistoryLocalStorageUtils.ts +++ b/public/app/core/history/richHistoryLocalStorageUtils.ts @@ -57,8 +57,8 @@ function filterQueriesBySearchFilter(queries: RichHistoryQuery[], searchFilter: const listOfMatchingQueries = query.queries.filter((query) => // Remove fields in which we don't want to be searching - Object.values(omit(query, ['datasource', 'key', 'refId', 'hide', 'queryType'])).some( - (value) => value?.toString().includes(searchFilter) + Object.values(omit(query, ['datasource', 'key', 'refId', 'hide', 'queryType'])).some((value) => + value?.toString().includes(searchFilter) ) ); diff --git a/public/app/core/services/keybindingSrv.ts b/public/app/core/services/keybindingSrv.ts index 8a836dc2d90..5874414764f 100644 --- a/public/app/core/services/keybindingSrv.ts +++ b/public/app/core/services/keybindingSrv.ts @@ -29,10 +29,7 @@ import { toggleTheme } from './theme'; import { withFocusedPanel } from './withFocusedPanelId'; export class KeybindingSrv { - constructor( - private locationService: LocationService, - private chromeService: AppChromeService - ) {} + constructor(private locationService: LocationService, private chromeService: AppChromeService) {} clearAndInitGlobalBindings(route: RouteDescriptor) { Mousetrap.reset(); diff --git a/public/app/features/alerting/unified/components/alert-groups/AlertGroupHeader.tsx b/public/app/features/alerting/unified/components/alert-groups/AlertGroupHeader.tsx index 6a4b7a2ca22..421bc369b53 100644 --- a/public/app/features/alerting/unified/components/alert-groups/AlertGroupHeader.tsx +++ b/public/app/features/alerting/unified/components/alert-groups/AlertGroupHeader.tsx @@ -13,17 +13,14 @@ interface Props { export const AlertGroupHeader = ({ group }: Props) => { const textStyles = useStyles2(getNotificationsTextColors); const total = group.alerts.length; - const countByStatus = group.alerts.reduce( - (statusObj, alert) => { - if (statusObj[alert.status.state]) { - statusObj[alert.status.state] += 1; - } else { - statusObj[alert.status.state] = 1; - } - return statusObj; - }, - {} as Record - ); + const countByStatus = group.alerts.reduce((statusObj, alert) => { + if (statusObj[alert.status.state]) { + statusObj[alert.status.state] += 1; + } else { + statusObj[alert.status.state] = 1; + } + return statusObj; + }, {} as Record); return (
diff --git a/public/app/features/alerting/unified/components/notification-policies/Modals.tsx b/public/app/features/alerting/unified/components/notification-policies/Modals.tsx index 7719426d6ad..f6c01c0b24c 100644 --- a/public/app/features/alerting/unified/components/notification-policies/Modals.tsx +++ b/public/app/features/alerting/unified/components/notification-policies/Modals.tsx @@ -206,7 +206,7 @@ const useDeletePolicyModal = (handleDelete: (route: RouteWithID) => void, loadin const useAlertGroupsModal = (): [ JSX.Element, (alertGroups: AlertmanagerGroup[], matchers?: ObjectMatcher[]) => void, - () => void, + () => void ] => { const [showModal, setShowModal] = useState(false); const [alertGroups, setAlertGroups] = useState([]); diff --git a/public/app/features/alerting/unified/components/receivers/editor/autocomplete.ts b/public/app/features/alerting/unified/components/receivers/editor/autocomplete.ts index 97e4db27e20..a844123d5d8 100644 --- a/public/app/features/alerting/unified/components/receivers/editor/autocomplete.ts +++ b/public/app/features/alerting/unified/components/receivers/editor/autocomplete.ts @@ -63,10 +63,7 @@ function isInsideGoExpression(model: editor.ITextModel, position: Position) { } export class CompletionProvider { - constructor( - private readonly monaco: Monaco, - private readonly range: IRange - ) {} + constructor(private readonly monaco: Monaco, private readonly range: IRange) {} getSnippetsSuggestions = (): languages.ProviderResult => { return this.getCompletionsFromDefinitions(getSnippetsSuggestions(this.monaco)); diff --git a/public/app/features/alerting/unified/components/receivers/form/GrafanaReceiverForm.tsx b/public/app/features/alerting/unified/components/receivers/form/GrafanaReceiverForm.tsx index bc45af1f128..e68361c2be0 100644 --- a/public/app/features/alerting/unified/components/receivers/form/GrafanaReceiverForm.tsx +++ b/public/app/features/alerting/unified/components/receivers/form/GrafanaReceiverForm.tsx @@ -59,7 +59,7 @@ export const GrafanaReceiverForm = ({ existing, alertManagerSourceName, config } // transform receiver DTO to form values const [existingValue, id2original] = useMemo((): [ ReceiverFormValues | undefined, - Record, + Record ] => { if (!existing || !grafanaNotifiers.result) { return [undefined, {}]; diff --git a/public/app/features/alerting/unified/components/rule-editor/QueryOptions.tsx b/public/app/features/alerting/unified/components/rule-editor/QueryOptions.tsx index 0e135599e12..7f3c8661fb5 100644 --- a/public/app/features/alerting/unified/components/rule-editor/QueryOptions.tsx +++ b/public/app/features/alerting/unified/components/rule-editor/QueryOptions.tsx @@ -62,11 +62,7 @@ export const QueryOptions = ({
- - {dateTime(timeRange?.from) - .locale('en') - .fromNow(true)} - + {dateTime(timeRange?.from).locale('en').fromNow(true)} {queryOptions.maxDataPoints && , MD {queryOptions.maxDataPoints}}
diff --git a/public/app/features/alerting/unified/components/rules/RuleDetailsDataSources.tsx b/public/app/features/alerting/unified/components/rules/RuleDetailsDataSources.tsx index c3cfa95dfa3..0734db52c61 100644 --- a/public/app/features/alerting/unified/components/rules/RuleDetailsDataSources.tsx +++ b/public/app/features/alerting/unified/components/rules/RuleDetailsDataSources.tsx @@ -27,19 +27,16 @@ export function RuleDetailsDataSources(props: Props): JSX.Element | null { if (isGrafanaRulerRule(rule.rulerRule)) { const { data } = rule.rulerRule.grafana_alert; - const unique = data.reduce( - (dataSources, query) => { - const ds = getDataSourceSrv().getInstanceSettings(query.datasourceUid); + const unique = data.reduce((dataSources, query) => { + const ds = getDataSourceSrv().getInstanceSettings(query.datasourceUid); - if (!ds || ds.uid === ExpressionDatasourceUID) { - return dataSources; - } - - dataSources[ds.name] = { name: ds.name, icon: ds.meta.info.logos.small }; + if (!ds || ds.uid === ExpressionDatasourceUID) { return dataSources; - }, - {} as Record - ); + } + + dataSources[ds.name] = { name: ds.name, icon: ds.meta.info.logos.small }; + return dataSources; + }, {} as Record); return Object.values(unique); } diff --git a/public/app/features/alerting/unified/components/rules/state-history/LogRecordViewer.tsx b/public/app/features/alerting/unified/components/rules/state-history/LogRecordViewer.tsx index eaa8cd9bc05..d167d8c507a 100644 --- a/public/app/features/alerting/unified/components/rules/state-history/LogRecordViewer.tsx +++ b/public/app/features/alerting/unified/components/rules/state-history/LogRecordViewer.tsx @@ -181,9 +181,7 @@ const getStyles = (theme: GrafanaTheme2) => ({ background: transparent; outline: 1px solid transparent; - transition: - background 150ms, - outline 150ms; + transition: background 150ms, outline 150ms; padding: ${theme.spacing(1)} ${theme.spacing(1.5)}; `, }); diff --git a/public/app/features/alerting/unified/components/silences/SilencesTable.tsx b/public/app/features/alerting/unified/components/silences/SilencesTable.tsx index 5ea21ded2a3..3d456e17e53 100644 --- a/public/app/features/alerting/unified/components/silences/SilencesTable.tsx +++ b/public/app/features/alerting/unified/components/silences/SilencesTable.tsx @@ -148,15 +148,14 @@ const useFilteredSilences = (silences: Silence[], expired = false) => { } if (queryString) { const matchers = parseMatchers(queryString); - const matchersMatch = matchers.every( - (matcher) => - silence.matchers?.some( - ({ name, value, isEqual, isRegex }) => - matcher.name === name && - matcher.value === value && - matcher.isEqual === isEqual && - matcher.isRegex === isRegex - ) + const matchersMatch = matchers.every((matcher) => + silence.matchers?.some( + ({ name, value, isEqual, isRegex }) => + matcher.name === name && + matcher.value === value && + matcher.isEqual === isEqual && + matcher.isRegex === isRegex + ) ); if (!matchersMatch) { return false; diff --git a/public/app/features/alerting/unified/hooks/useURLSearchParams.ts b/public/app/features/alerting/unified/hooks/useURLSearchParams.ts index 3203c883afc..f67cecda4bb 100644 --- a/public/app/features/alerting/unified/hooks/useURLSearchParams.ts +++ b/public/app/features/alerting/unified/hooks/useURLSearchParams.ts @@ -5,7 +5,7 @@ import { locationService } from '@grafana/runtime'; export function useURLSearchParams(): [ URLSearchParams, - (searchValues: Record, replace?: boolean) => void, + (searchValues: Record, replace?: boolean) => void ] { const { search } = useLocation(); const queryParams = useMemo(() => new URLSearchParams(search), [search]); diff --git a/public/app/features/alerting/unified/state/AlertingQueryRunner.ts b/public/app/features/alerting/unified/state/AlertingQueryRunner.ts index 62fd898c836..b8aa462e620 100644 --- a/public/app/features/alerting/unified/state/AlertingQueryRunner.ts +++ b/public/app/features/alerting/unified/state/AlertingQueryRunner.ts @@ -35,10 +35,7 @@ export class AlertingQueryRunner { private subscription?: Unsubscribable; private lastResult: Record; - constructor( - private backendSrv = getBackendSrv(), - private dataSourceSrv = getDataSourceSrv() - ) { + constructor(private backendSrv = getBackendSrv(), private dataSourceSrv = getDataSourceSrv()) { this.subject = new ReplaySubject(1); this.lastResult = {}; } diff --git a/public/app/features/alerting/unified/utils/rules.ts b/public/app/features/alerting/unified/utils/rules.ts index 1a94e098e7c..5cc7210935b 100644 --- a/public/app/features/alerting/unified/utils/rules.ts +++ b/public/app/features/alerting/unified/utils/rules.ts @@ -169,20 +169,17 @@ export function getFirstActiveAt(promRule?: AlertingRule) { if (!promRule?.alerts) { return null; } - return promRule.alerts.reduce( - (prev, alert) => { - const isNotNormal = - mapStateWithReasonToBaseState(alert.state as GrafanaAlertStateWithReason) !== GrafanaAlertState.Normal; - if (alert.activeAt && isNotNormal) { - const activeAt = new Date(alert.activeAt); - if (prev === null || prev.getTime() > activeAt.getTime()) { - return activeAt; - } + return promRule.alerts.reduce((prev, alert) => { + const isNotNormal = + mapStateWithReasonToBaseState(alert.state as GrafanaAlertStateWithReason) !== GrafanaAlertState.Normal; + if (alert.activeAt && isNotNormal) { + const activeAt = new Date(alert.activeAt); + if (prev === null || prev.getTime() > activeAt.getTime()) { + return activeAt; } - return prev; - }, - null as Date | null - ); + } + return prev; + }, null as Date | null); } /** diff --git a/public/app/features/auth-config/ErrorContainer.tsx b/public/app/features/auth-config/ErrorContainer.tsx index e237aa629f0..fbb039896f0 100644 --- a/public/app/features/auth-config/ErrorContainer.tsx +++ b/public/app/features/auth-config/ErrorContainer.tsx @@ -26,12 +26,16 @@ export const ErrorContainerUnconnected = ({ error, warning, resetError, resetWar
{error && ( resetError()}> - {error.errors?.map((e, i) =>
{e}
)} + {error.errors?.map((e, i) => ( +
{e}
+ ))}
)} {warning && ( resetWarning()} severity="warning"> - {warning.errors?.map((e, i) =>
{e}
)} + {warning.errors?.map((e, i) => ( +
{e}
+ ))}
)}
diff --git a/public/app/features/canvas/runtime/element.tsx b/public/app/features/canvas/runtime/element.tsx index 74852198ae9..94f8b41cfcd 100644 --- a/public/app/features/canvas/runtime/element.tsx +++ b/public/app/features/canvas/runtime/element.tsx @@ -36,11 +36,7 @@ export class ElementState implements LayerElement { // Calculated data?: any; // depends on the type - constructor( - public item: CanvasElementItem, - public options: CanvasElementOptions, - public parent?: FrameState - ) { + constructor(public item: CanvasElementItem, public options: CanvasElementOptions, public parent?: FrameState) { const fallbackName = `Element ${Date.now()}`; if (!options) { this.options = { type: item.id, name: fallbackName }; diff --git a/public/app/features/canvas/runtime/frame.tsx b/public/app/features/canvas/runtime/frame.tsx index 0d8ef5ee588..fd1cc9c8dfd 100644 --- a/public/app/features/canvas/runtime/frame.tsx +++ b/public/app/features/canvas/runtime/frame.tsx @@ -36,11 +36,7 @@ export class FrameState extends ElementState { elements: ElementState[] = []; scene: Scene; - constructor( - public options: CanvasFrameOptions, - scene: Scene, - public parent?: FrameState - ) { + constructor(public options: CanvasFrameOptions, scene: Scene, public parent?: FrameState) { super(frameItemDummy, options, parent); this.scene = scene; diff --git a/public/app/features/canvas/runtime/root.tsx b/public/app/features/canvas/runtime/root.tsx index 955d1db57e1..9faebe93379 100644 --- a/public/app/features/canvas/runtime/root.tsx +++ b/public/app/features/canvas/runtime/root.tsx @@ -6,11 +6,7 @@ import { FrameState } from './frame'; import { Scene } from './scene'; export class RootElement extends FrameState { - constructor( - public options: CanvasFrameOptions, - public scene: Scene, - private changeCallback: () => void - ) { + constructor(public options: CanvasFrameOptions, public scene: Scene, private changeCallback: () => void) { super(options, scene); this.sizeStyle = { diff --git a/public/app/features/correlations/Forms/ConfigureCorrelationSourceForm.tsx b/public/app/features/correlations/Forms/ConfigureCorrelationSourceForm.tsx index f692b547d02..e44fd529290 100644 --- a/public/app/features/correlations/Forms/ConfigureCorrelationSourceForm.tsx +++ b/public/app/features/correlations/Forms/ConfigureCorrelationSourceForm.tsx @@ -37,9 +37,9 @@ export const ConfigureCorrelationSourceForm = () => { return ( <>

Define what data source will display the correlation, and what data will replace previously defined variables. diff --git a/public/app/features/dashboard/components/AddPanelWidget/AddPanelWidget.tsx b/public/app/features/dashboard/components/AddPanelWidget/AddPanelWidget.tsx index a1020e1a613..4966670094d 100644 --- a/public/app/features/dashboard/components/AddPanelWidget/AddPanelWidget.tsx +++ b/public/app/features/dashboard/components/AddPanelWidget/AddPanelWidget.tsx @@ -232,10 +232,10 @@ const getStyles = (theme: GrafanaTheme2) => { const pulsate = keyframes` 0% {box-shadow: 0 0 0 2px ${theme.colors.background.canvas}, 0 0 0px 4px ${theme.colors.primary.main};} 50% {box-shadow: 0 0 0 2px ${theme.components.dashboard.background}, 0 0 0px 4px ${tinycolor( - theme.colors.primary.main - ) - .darken(20) - .toHexString()};} + theme.colors.primary.main + ) + .darken(20) + .toHexString()};} 100% {box-shadow: 0 0 0 2px ${theme.components.dashboard.background}, 0 0 0px 4px ${theme.colors.primary.main};} `; @@ -249,9 +249,7 @@ const getStyles = (theme: GrafanaTheme2) => { overflow: hidden; outline: 2px dotted transparent; outline-offset: 2px; - box-shadow: - 0 0 0 2px black, - 0 0 0px 4px #1f60c4; + box-shadow: 0 0 0 2px black, 0 0 0px 4px #1f60c4; animation: ${pulsate} 2s ease infinite; `, actionsWrapper: css` diff --git a/public/app/features/dashboard/components/DashboardSettings/AutoRefreshIntervals.test.tsx b/public/app/features/dashboard/components/DashboardSettings/AutoRefreshIntervals.test.tsx index 5ab5d6638a6..27bc5ba5cb9 100644 --- a/public/app/features/dashboard/components/DashboardSettings/AutoRefreshIntervals.test.tsx +++ b/public/app/features/dashboard/components/DashboardSettings/AutoRefreshIntervals.test.tsx @@ -100,7 +100,7 @@ describe('getValidIntervals', () => { getTimeSrv: () => ({ getValidIntervals: (intervals: string[]) => intervals, - }) as unknown as TimeSrv, + } as unknown as TimeSrv), }; const result = getValidIntervals(emptyIntervals, dependencies); @@ -116,7 +116,7 @@ describe('getValidIntervals', () => { getTimeSrv: () => ({ getValidIntervals: (intervals: string[]) => intervals, - }) as unknown as TimeSrv, + } as unknown as TimeSrv), }; const result = getValidIntervals(duplicateIntervals, dependencies); @@ -132,7 +132,7 @@ describe('getValidIntervals', () => { getTimeSrv: () => ({ getValidIntervals: (intervals: string[]) => intervals, - }) as unknown as TimeSrv, + } as unknown as TimeSrv), }; const result = getValidIntervals(duplicateIntervals, dependencies); @@ -149,7 +149,7 @@ describe('validateIntervals', () => { getTimeSrv: () => ({ getValidIntervals: (intervals: string[]) => intervals, - }) as unknown as TimeSrv, + } as unknown as TimeSrv), }; const result = validateIntervals(defaultIntervals, dependencies); @@ -166,7 +166,7 @@ describe('validateIntervals', () => { getValidIntervals: () => { throw new Error('Some error'); }, - }) as unknown as TimeSrv, + } as unknown as TimeSrv), }; const result = validateIntervals(defaultIntervals, dependencies); diff --git a/public/app/features/dashboard/components/PanelEditor/DynamicConfigValueEditor.tsx b/public/app/features/dashboard/components/PanelEditor/DynamicConfigValueEditor.tsx index bd31fb439a8..d4c28d49211 100644 --- a/public/app/features/dashboard/components/PanelEditor/DynamicConfigValueEditor.tsx +++ b/public/app/features/dashboard/components/PanelEditor/DynamicConfigValueEditor.tsx @@ -53,29 +53,30 @@ export const DynamicConfigValueEditor = ({ /* eslint-disable react/display-name */ const renderLabel = (includeDescription = true, includeCounter = false) => - (isExpanded = false) => ( - -

+ +
)} - - {!isSystemOverride && ( -
- -
- )} - - ); + + ); /* eslint-enable react/display-name */ if (isCollapsible) { diff --git a/public/app/features/dashboard/state/PanelModel.test.ts b/public/app/features/dashboard/state/PanelModel.test.ts index 67eed4ed7cf..d4c1ddac190 100644 --- a/public/app/features/dashboard/state/PanelModel.test.ts +++ b/public/app/features/dashboard/state/PanelModel.test.ts @@ -499,7 +499,7 @@ describe('PanelModel', () => { describe('destroy', () => { it('Should still preserve last query result', () => { model.getQueryRunner().useLastResultFrom({ - getLastResult: () => ({}) as PanelData, + getLastResult: () => ({} as PanelData), } as PanelQueryRunner); model.destroy(); diff --git a/public/app/features/datasources/state/actions.test.ts b/public/app/features/datasources/state/actions.test.ts index dc88dc9bee9..6749ad8a230 100644 --- a/public/app/features/datasources/state/actions.test.ts +++ b/public/app/features/datasources/state/actions.test.ts @@ -50,7 +50,7 @@ const getBackendSrvMock = () => }), }), withNoBackendCache: jest.fn().mockImplementationOnce((cb) => cb()), - }) as any; + } as any); const failDataSourceTest = async (error: object) => { const dependencies: TestDataSourceDependencies = { @@ -61,7 +61,7 @@ const failDataSourceTest = async (error: object) => { throw error; }), }), - }) as any, + } as any), getBackendSrv: getBackendSrvMock, }; const state = { @@ -223,7 +223,7 @@ describe('testDataSource', () => { type: 'cloudwatch', uid: 'CW1234', }), - }) as any, + } as any), getBackendSrv: getBackendSrvMock, }; const state = { @@ -258,7 +258,7 @@ describe('testDataSource', () => { type: 'azure-monitor', uid: 'azM0nit0R', }), - }) as any, + } as any), getBackendSrv: getBackendSrvMock, }; const result = { diff --git a/public/app/features/datasources/state/reducers.test.ts b/public/app/features/datasources/state/reducers.test.ts index ff8c49a4bbe..078b28fbe24 100644 --- a/public/app/features/datasources/state/reducers.test.ts +++ b/public/app/features/datasources/state/reducers.test.ts @@ -37,7 +37,7 @@ const mockPlugin = () => pinned: true, type: PluginType.datasource, module: 'path/to/module', - }) as PluginMeta; + } as PluginMeta); describe('dataSourcesReducer', () => { describe('when dataSourcesLoaded is dispatched', () => { diff --git a/public/app/features/explore/FeatureTogglePage.tsx b/public/app/features/explore/FeatureTogglePage.tsx index 254da695d93..a10df73f183 100644 --- a/public/app/features/explore/FeatureTogglePage.tsx +++ b/public/app/features/explore/FeatureTogglePage.tsx @@ -7,9 +7,10 @@ import { Page } from 'app/core/components/Page/Page'; export default function FeatureTogglePage() { const styles = useStyles2( - (theme: GrafanaTheme2) => css` - margin-top: ${theme.spacing(2)}; - ` + (theme: GrafanaTheme2) => + css` + margin-top: ${theme.spacing(2)}; + ` ); return ( diff --git a/public/app/features/explore/RichHistory/RichHistoryCard.tsx b/public/app/features/explore/RichHistory/RichHistoryCard.tsx index ca78122403e..6cb7d708d8e 100644 --- a/public/app/features/explore/RichHistory/RichHistoryCard.tsx +++ b/public/app/features/explore/RichHistory/RichHistoryCard.tsx @@ -403,13 +403,14 @@ const Query = ({ query, showDsInfo = false }: QueryProps) => { ); }; -const getDsInfoStyles = (size: 'sm' | 'md') => (theme: GrafanaTheme2) => css` - display: flex; - align-items: center; - font-size: ${theme.typography[size === 'sm' ? 'bodySmall' : 'body'].fontSize}; - font-weight: ${theme.typography.fontWeightMedium}; - white-space: nowrap; -`; +const getDsInfoStyles = (size: 'sm' | 'md') => (theme: GrafanaTheme2) => + css` + display: flex; + align-items: center; + font-size: ${theme.typography[size === 'sm' ? 'bodySmall' : 'body'].fontSize}; + font-weight: ${theme.typography.fontWeightMedium}; + white-space: nowrap; + `; function DatasourceInfo({ dsApi, size }: { dsApi?: DataSourceApi; size: 'sm' | 'md' }) { const getStyles = useCallback((theme: GrafanaTheme2) => getDsInfoStyles(size)(theme), [size]); diff --git a/public/app/features/explore/TraceView/TraceView.tsx b/public/app/features/explore/TraceView/TraceView.tsx index 8a4ba0d38ba..f3afe636b0b 100644 --- a/public/app/features/explore/TraceView/TraceView.tsx +++ b/public/app/features/explore/TraceView/TraceView.tsx @@ -264,8 +264,8 @@ function useFocusSpanLink(options: { }) ); - const query = useSelector( - (state) => state.explore.panes[options.exploreId]?.queries.find((query) => query.refId === options.refId) + const query = useSelector((state) => + state.explore.panes[options.exploreId]?.queries.find((query) => query.refId === options.refId) ); const createFocusSpanLink = (traceId: string, spanId: string) => { diff --git a/public/app/features/plugins/admin/helpers.ts b/public/app/features/plugins/admin/helpers.ts index e9460d2ded4..eda9ad37d8e 100644 --- a/public/app/features/plugins/admin/helpers.ts +++ b/public/app/features/plugins/admin/helpers.ts @@ -223,13 +223,10 @@ export const sortPlugins = (plugins: CatalogPlugin[], sortBy: Sorters) => { }; function groupErrorsByPluginId(errors: PluginError[] = []): Record { - return errors.reduce( - (byId, error) => { - byId[error.pluginId] = error; - return byId; - }, - {} as Record - ); + return errors.reduce((byId, error) => { + byId[error.pluginId] = error; + return byId; + }, {} as Record); } function getPluginSignature(options: { diff --git a/public/app/features/query/state/PanelQueryRunner.ts b/public/app/features/query/state/PanelQueryRunner.ts index 6fde35c5cd8..ea3f01d0ded 100644 --- a/public/app/features/query/state/PanelQueryRunner.ts +++ b/public/app/features/query/state/PanelQueryRunner.ts @@ -44,7 +44,7 @@ import { runRequest } from './runRequest'; export interface QueryRunnerOptions< TQuery extends DataQuery = DataQuery, - TOptions extends DataSourceJsonData = DataSourceJsonData, + TOptions extends DataSourceJsonData = DataSourceJsonData > { datasource: DataSourceRef | DataSourceApi | null; queries: TQuery[]; diff --git a/public/app/features/storage/RootView.tsx b/public/app/features/storage/RootView.tsx index 62bda7bb4e1..0a2cecdd7fe 100644 --- a/public/app/features/storage/RootView.tsx +++ b/public/app/features/storage/RootView.tsx @@ -72,7 +72,9 @@ export function RootView({ root, onPathChange }: Props) { {s.config.description} {s.config.git?.remote && {s.config.git?.remote}} - {s.notice?.map((notice) => )} + {s.notice?.map((notice) => ( + + ))} diff --git a/public/app/features/transformers/editors/OrganizeFieldsTransformerEditor.tsx b/public/app/features/transformers/editors/OrganizeFieldsTransformerEditor.tsx index da25487528c..e310a41e7fc 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; + }, {} as Record); }; const orderFieldNamesByIndex = (fieldNames: string[], indexByName: Record = {}): string[] => { diff --git a/public/app/features/transformers/utils.ts b/public/app/features/transformers/utils.ts index adf95a8c19e..a3159caf244 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); + }, {} as Record) ); }, [input]); } diff --git a/public/app/features/variables/editor/getVariableQueryEditor.tsx b/public/app/features/variables/editor/getVariableQueryEditor.tsx index 5d2d34d4c0d..d3557d7f07a 100644 --- a/public/app/features/variables/editor/getVariableQueryEditor.tsx +++ b/public/app/features/variables/editor/getVariableQueryEditor.tsx @@ -17,7 +17,7 @@ import { LegacyVariableQueryEditor } from './LegacyVariableQueryEditor'; export async function getVariableQueryEditor< TQuery extends DataQuery = DataQuery, TOptions extends DataSourceJsonData = DataSourceJsonData, - VariableQuery extends DataQuery = TQuery, + VariableQuery extends DataQuery = TQuery >( datasource: DataSourceApi, importDataSourcePluginFunc = importDataSourcePlugin @@ -50,7 +50,7 @@ export async function getVariableQueryEditor< export function StandardVariableQueryEditor< TQuery extends DataQuery = DataQuery, - TOptions extends DataSourceJsonData = DataSourceJsonData, + TOptions extends DataSourceJsonData = DataSourceJsonData >({ datasource: propsDatasource, query: propsQuery, diff --git a/public/app/features/variables/guard.ts b/public/app/features/variables/guard.ts index a953979a33b..a24869c2c67 100644 --- a/public/app/features/variables/guard.ts +++ b/public/app/features/variables/guard.ts @@ -62,7 +62,7 @@ export function isLegacyAdHocDataSource(datasource: null | DataSourceRef | strin interface DataSourceWithLegacyVariableSupport< TQuery extends DataQuery = DataQuery, - TOptions extends DataSourceJsonData = DataSourceJsonData, + TOptions extends DataSourceJsonData = DataSourceJsonData > extends DataSourceApi { metricFindQuery(query: any, options?: any): Promise; variables: undefined; @@ -70,7 +70,7 @@ interface DataSourceWithLegacyVariableSupport< interface DataSourceWithStandardVariableSupport< TQuery extends DataQuery = DataQuery, - TOptions extends DataSourceJsonData = DataSourceJsonData, + TOptions extends DataSourceJsonData = DataSourceJsonData > extends DataSourceApi { variables: { getType(): VariableSupportType; @@ -81,7 +81,7 @@ interface DataSourceWithStandardVariableSupport< interface DataSourceWithCustomVariableSupport< TQuery extends DataQuery = DataQuery, - TOptions extends DataSourceJsonData = DataSourceJsonData, + TOptions extends DataSourceJsonData = DataSourceJsonData > extends DataSourceApi { variables: { getType(): VariableSupportType; @@ -92,7 +92,7 @@ interface DataSourceWithCustomVariableSupport< interface DataSourceWithDatasourceVariableSupport< TQuery extends DataQuery = DataQuery, - TOptions extends DataSourceJsonData = DataSourceJsonData, + TOptions extends DataSourceJsonData = DataSourceJsonData > extends DataSourceApi { variables: { getType(): VariableSupportType; @@ -105,7 +105,7 @@ interface DataSourceWithDatasourceVariableSupport< * */ export const hasLegacyVariableSupport = < TQuery extends DataQuery = DataQuery, - TOptions extends DataSourceJsonData = DataSourceJsonData, + TOptions extends DataSourceJsonData = DataSourceJsonData >( datasource: DataSourceApi ): datasource is DataSourceWithLegacyVariableSupport => { @@ -114,7 +114,7 @@ export const hasLegacyVariableSupport = < export const hasStandardVariableSupport = < TQuery extends DataQuery = DataQuery, - TOptions extends DataSourceJsonData = DataSourceJsonData, + TOptions extends DataSourceJsonData = DataSourceJsonData >( datasource: DataSourceApi ): datasource is DataSourceWithStandardVariableSupport => { @@ -132,7 +132,7 @@ export const hasStandardVariableSupport = < export const hasCustomVariableSupport = < TQuery extends DataQuery = DataQuery, - TOptions extends DataSourceJsonData = DataSourceJsonData, + TOptions extends DataSourceJsonData = DataSourceJsonData >( datasource: DataSourceApi ): datasource is DataSourceWithCustomVariableSupport => { @@ -155,7 +155,7 @@ export const hasCustomVariableSupport = < export const hasDatasourceVariableSupport = < TQuery extends DataQuery = DataQuery, - TOptions extends DataSourceJsonData = DataSourceJsonData, + TOptions extends DataSourceJsonData = DataSourceJsonData >( datasource: DataSourceApi ): datasource is DataSourceWithDatasourceVariableSupport => { @@ -168,7 +168,7 @@ export const hasDatasourceVariableSupport = < export function isLegacyQueryEditor< TQuery extends DataQuery = DataQuery, - TOptions extends DataSourceJsonData = DataSourceJsonData, + TOptions extends DataSourceJsonData = DataSourceJsonData >( component: VariableQueryEditorType, datasource: DataSourceApi @@ -182,7 +182,7 @@ export function isLegacyQueryEditor< export function isQueryEditor< TQuery extends DataQuery = DataQuery, - TOptions extends DataSourceJsonData = DataSourceJsonData, + TOptions extends DataSourceJsonData = DataSourceJsonData >( component: VariableQueryEditorType, datasource: DataSourceApi diff --git a/public/app/features/variables/inspect/utils.ts b/public/app/features/variables/inspect/utils.ts index f123858d113..3ff5b9993ba 100644 --- a/public/app/features/variables/inspect/utils.ts +++ b/public/app/features/variables/inspect/utils.ts @@ -118,58 +118,52 @@ const validVariableNames: Record = { }; export const getPropsWithVariable = (variableId: string, parent: { key: string; value: any }, result: any) => { - const stringValues = Object.keys(parent.value).reduce( - (all, key) => { - const value = parent.value[key]; - if (!value || typeof value !== 'string') { - return all; + const stringValues = Object.keys(parent.value).reduce((all, key) => { + const value = parent.value[key]; + if (!value || typeof value !== 'string') { + return all; + } + + const isValidName = validVariableNames[key] + ? validVariableNames[key].find((regex: RegExp) => regex.test(variableId)) + : undefined; + + let hasVariable = containsVariable(value, variableId); + if (key === 'repeat' && value === variableId) { + // repeat stores value without variable format + hasVariable = true; + } + + if (!isValidName && hasVariable) { + all = { + ...all, + [key]: value, + }; + } + + return all; + }, {} as Record); + + const objectValues = Object.keys(parent.value).reduce((all, key) => { + const value = parent.value[key]; + if (value && typeof value === 'object' && Object.keys(value).length) { + let id = value.title || value.name || value.id || key; + if (Array.isArray(parent.value) && parent.key === 'panels') { + id = `${id}[${value.id}]`; } - const isValidName = validVariableNames[key] - ? validVariableNames[key].find((regex: RegExp) => regex.test(variableId)) - : undefined; + const newResult = getPropsWithVariable(variableId, { key, value }, {}); - let hasVariable = containsVariable(value, variableId); - if (key === 'repeat' && value === variableId) { - // repeat stores value without variable format - hasVariable = true; - } - - if (!isValidName && hasVariable) { + if (Object.keys(newResult).length) { all = { ...all, - [key]: value, + [id]: newResult, }; } + } - return all; - }, - {} as Record - ); - - const objectValues = Object.keys(parent.value).reduce( - (all, key) => { - const value = parent.value[key]; - if (value && typeof value === 'object' && Object.keys(value).length) { - let id = value.title || value.name || value.id || key; - if (Array.isArray(parent.value) && parent.key === 'panels') { - id = `${id}[${value.id}]`; - } - - const newResult = getPropsWithVariable(variableId, { key, value }, {}); - - if (Object.keys(newResult).length) { - all = { - ...all, - [id]: newResult, - }; - } - } - - return all; - }, - {} as Record - ); + return all; + }, {} as Record); if (Object.keys(stringValues).length || Object.keys(objectValues).length) { result = { diff --git a/public/app/features/variables/query/actions.ts b/public/app/features/variables/query/actions.ts index 41b3131846e..a5b3a5d58d0 100644 --- a/public/app/features/variables/query/actions.ts +++ b/public/app/features/variables/query/actions.ts @@ -184,25 +184,22 @@ export function flattenQuery(query: any): any { } const keys = Object.keys(query); - const flattened = keys.reduce( - (all, key) => { - const value = query[key]; - if (typeof value !== 'object' || value === null) { - all[key] = value; - return all; - } - - const result = flattenQuery(value); - for (let childProp in result) { - if (result.hasOwnProperty(childProp)) { - all[`${key}_${childProp}`] = result[childProp]; - } - } - + const flattened = keys.reduce((all, key) => { + const value = query[key]; + if (typeof value !== 'object' || value === null) { + all[key] = value; return all; - }, - {} as Record - ); + } + + const result = flattenQuery(value); + for (let childProp in result) { + if (result.hasOwnProperty(childProp)) { + all[`${key}_${childProp}`] = result[childProp]; + } + } + + return all; + }, {} as Record); return flattened; } diff --git a/public/app/features/variables/shared/testing/datasourceVariableBuilder.ts b/public/app/features/variables/shared/testing/datasourceVariableBuilder.ts index 8f52026e81e..28847c872ae 100644 --- a/public/app/features/variables/shared/testing/datasourceVariableBuilder.ts +++ b/public/app/features/variables/shared/testing/datasourceVariableBuilder.ts @@ -3,7 +3,7 @@ import { DataSourceVariableModel, QueryVariableModel, VariableRefresh } from 'ap import { MultiVariableBuilder } from './multiVariableBuilder'; export class DatasourceVariableBuilder< - T extends DataSourceVariableModel | QueryVariableModel, + T extends DataSourceVariableModel | QueryVariableModel > extends MultiVariableBuilder { withRefresh(refresh: VariableRefresh) { this.variable.refresh = refresh; diff --git a/public/app/features/variables/types.ts b/public/app/features/variables/types.ts index 11c66dcfafd..3b74f7914be 100644 --- a/public/app/features/variables/types.ts +++ b/public/app/features/variables/types.ts @@ -89,7 +89,7 @@ export interface VariableQueryEditorProps { export type VariableQueryEditorType< TQuery extends DataQuery = DataQuery, - TOptions extends DataSourceJsonData = DataSourceJsonData, + TOptions extends DataSourceJsonData = DataSourceJsonData > = ComponentType | ComponentType> | null; export interface VariablesChangedEvent { diff --git a/public/app/plugins/datasource/alertmanager/types.ts b/public/app/plugins/datasource/alertmanager/types.ts index b8ff117bc1d..5d7c2fab86b 100644 --- a/public/app/plugins/datasource/alertmanager/types.ts +++ b/public/app/plugins/datasource/alertmanager/types.ts @@ -218,7 +218,7 @@ export type AlertmanagerAlert = { receivers: [ { name: string; - }, + } ]; fingerprint: string; status: { diff --git a/public/app/plugins/datasource/cloudwatch/query-runner/CloudWatchRequest.ts b/public/app/plugins/datasource/cloudwatch/query-runner/CloudWatchRequest.ts index 8570f18393d..beaf0424414 100644 --- a/public/app/plugins/datasource/cloudwatch/query-runner/CloudWatchRequest.ts +++ b/public/app/plugins/datasource/cloudwatch/query-runner/CloudWatchRequest.ts @@ -20,10 +20,7 @@ export abstract class CloudWatchRequest { AppNotificationTimeout.Error ); - constructor( - public instanceSettings: DataSourceInstanceSettings, - templateSrv: TemplateSrv - ) { + constructor(public instanceSettings: DataSourceInstanceSettings, templateSrv: TemplateSrv) { this.templateSrv = templateSrv; this.ref = getDataSourceRef(instanceSettings); } diff --git a/public/app/plugins/datasource/elasticsearch/ElasticResponse.ts b/public/app/plugins/datasource/elasticsearch/ElasticResponse.ts index f76107b0376..cd74a7147b8 100644 --- a/public/app/plugins/datasource/elasticsearch/ElasticResponse.ts +++ b/public/app/plugins/datasource/elasticsearch/ElasticResponse.ts @@ -27,10 +27,7 @@ interface TopMetricBucket { } export class ElasticResponse { - constructor( - private targets: ElasticsearchQuery[], - private response: any - ) { + constructor(private targets: ElasticsearchQuery[], private response: any) { this.targets = targets; this.response = response; } @@ -787,10 +784,8 @@ const addPreferredVisualisationType = (series: any, type: PreferredVisualisation const toNameTypePair = (docs: Array>) => - (propName: string): [string, FieldType] => [ - propName, - guessType(docs.find((doc) => doc[propName] !== undefined)?.[propName]), - ]; + (propName: string): [string, FieldType] => + [propName, guessType(docs.find((doc) => doc[propName] !== undefined)?.[propName])]; /** * Trying to guess data type from its value. This is far from perfect, as in order to have accurate guess diff --git a/public/app/plugins/datasource/elasticsearch/IndexPattern.ts b/public/app/plugins/datasource/elasticsearch/IndexPattern.ts index a0334e712bb..4f8b1221c4d 100644 --- a/public/app/plugins/datasource/elasticsearch/IndexPattern.ts +++ b/public/app/plugins/datasource/elasticsearch/IndexPattern.ts @@ -21,10 +21,7 @@ export const intervalMap: IntervalMap = { export class IndexPattern { private dateLocale = 'en'; - constructor( - private pattern: string, - private interval?: keyof typeof intervalMap - ) {} + constructor(private pattern: string, private interval?: keyof typeof intervalMap) {} getIndexForToday() { if (this.interval) { diff --git a/public/app/plugins/datasource/graphite/datasource.ts b/public/app/plugins/datasource/graphite/datasource.ts index c8de04dc765..98260c728ce 100644 --- a/public/app/plugins/datasource/graphite/datasource.ts +++ b/public/app/plugins/datasource/graphite/datasource.ts @@ -84,10 +84,7 @@ export class GraphiteDatasource requestCounter = 100; private readonly metricMappings: GraphiteLokiMapping[]; - constructor( - instanceSettings: any, - private readonly templateSrv: TemplateSrv = getTemplateSrv() - ) { + constructor(instanceSettings: any, private readonly templateSrv: TemplateSrv = getTemplateSrv()) { super(instanceSettings); this.basicAuth = instanceSettings.basicAuth; this.url = instanceSettings.url; diff --git a/public/app/plugins/datasource/loki/components/monaco-query-field/monaco-completion-provider/CompletionDataProvider.ts b/public/app/plugins/datasource/loki/components/monaco-query-field/monaco-completion-provider/CompletionDataProvider.ts index eb515bf1521..d435fb1ab86 100644 --- a/public/app/plugins/datasource/loki/components/monaco-query-field/monaco-completion-provider/CompletionDataProvider.ts +++ b/public/app/plugins/datasource/loki/components/monaco-query-field/monaco-completion-provider/CompletionDataProvider.ts @@ -13,10 +13,7 @@ interface HistoryRef { } export class CompletionDataProvider { - constructor( - private languageProvider: LanguageProvider, - private historyRef: HistoryRef = { current: [] } - ) {} + constructor(private languageProvider: LanguageProvider, private historyRef: HistoryRef = { current: [] }) {} private buildSelector(labels: Label[]): string { const allLabelTexts = labels.map( diff --git a/public/app/plugins/datasource/mysql/sqlCompletionProvider.ts b/public/app/plugins/datasource/mysql/sqlCompletionProvider.ts index b44b2475027..18446a98df7 100644 --- a/public/app/plugins/datasource/mysql/sqlCompletionProvider.ts +++ b/public/app/plugins/datasource/mysql/sqlCompletionProvider.ts @@ -53,47 +53,48 @@ export const customStatementPlacementProvider: StatementPlacementProvider = () = ]; export const customSuggestionKinds: (getMeta: CompletionProviderGetterArgs['getMeta']) => SuggestionKindProvider = - (getMeta) => () => [ - { - id: SuggestionKind.Tables, - overrideDefault: true, - suggestionsResolver: async (ctx) => { - const databaseName = getDatabaseName(ctx.currentToken); + (getMeta) => () => + [ + { + id: SuggestionKind.Tables, + overrideDefault: true, + suggestionsResolver: async (ctx) => { + const databaseName = getDatabaseName(ctx.currentToken); - const suggestions = await getMeta({ schema: databaseName }); + const suggestions = await getMeta({ schema: databaseName }); - return suggestions.map(mapToSuggestion(ctx)); + return suggestions.map(mapToSuggestion(ctx)); + }, }, - }, - { - id: SuggestionKind.Columns, - overrideDefault: true, - suggestionsResolver: async (ctx) => { - const databaseToken = getDatabaseToken(ctx.currentToken); - const databaseName = getDatabaseName(databaseToken); - const tableName = getTableName(databaseToken); + { + id: SuggestionKind.Columns, + overrideDefault: true, + suggestionsResolver: async (ctx) => { + const databaseToken = getDatabaseToken(ctx.currentToken); + const databaseName = getDatabaseName(databaseToken); + const tableName = getTableName(databaseToken); - if (!databaseName || !tableName) { - return []; - } + if (!databaseName || !tableName) { + return []; + } - const suggestions = await getMeta({ schema: databaseName, table: tableName }); + const suggestions = await getMeta({ schema: databaseName, table: tableName }); - return suggestions.map(mapToSuggestion(ctx)); + return suggestions.map(mapToSuggestion(ctx)); + }, }, - }, - { - id: customSuggestionKind.tablesWithinDatabase, - applyTo: [customStatementPlacement.afterDatabase], - suggestionsResolver: async (ctx) => { - const databaseName = getDatabaseName(ctx.currentToken); + { + id: customSuggestionKind.tablesWithinDatabase, + applyTo: [customStatementPlacement.afterDatabase], + suggestionsResolver: async (ctx) => { + const databaseName = getDatabaseName(ctx.currentToken); - const suggestions = await getMeta({ schema: databaseName }); + const suggestions = await getMeta({ schema: databaseName }); - return suggestions.map(mapToSuggestion(ctx)); + return suggestions.map(mapToSuggestion(ctx)); + }, }, - }, - ]; + ]; function mapToSuggestion(ctx: PositionContext) { return function (tableDefinition: TableDefinition) { diff --git a/public/app/plugins/datasource/opentsdb/datasource.ts b/public/app/plugins/datasource/opentsdb/datasource.ts index da0ea1ae059..48048b17408 100644 --- a/public/app/plugins/datasource/opentsdb/datasource.ts +++ b/public/app/plugins/datasource/opentsdb/datasource.ts @@ -46,10 +46,7 @@ export default class OpenTsDatasource extends DataSourceApi { - acc[def.sign] = { - id: def.id, - comparison: def.comparison, - }; - return acc; - }, - {} as Record -); +export const binaryScalarOperatorToOperatorName = binaryScalarDefs.reduce((acc, def) => { + acc[def.sign] = { + id: def.id, + comparison: def.comparison, + }; + return acc; +}, {} as Record); // Not sure about this one. It could also be a more generic 'Simple math operation' where user specifies // both the operator and the operand in a single input diff --git a/public/app/plugins/datasource/prometheus/querybuilder/components/LabelFilters.tsx b/public/app/plugins/datasource/prometheus/querybuilder/components/LabelFilters.tsx index cdc90d0ec48..8bf5e694ced 100644 --- a/public/app/plugins/datasource/prometheus/querybuilder/components/LabelFilters.tsx +++ b/public/app/plugins/datasource/prometheus/querybuilder/components/LabelFilters.tsx @@ -85,9 +85,11 @@ export function LabelFilters({ {variableEditor ? (
({ subscribe: jest.fn(), - }) as any, + } as any), publish: jest.fn(), removeAllListeners: jest.fn(), newScopedBus: jest.fn(), diff --git a/public/app/plugins/panel/barchart/quadtree.ts b/public/app/plugins/panel/barchart/quadtree.ts index 30446cacf31..10e813f63e0 100644 --- a/public/app/plugins/panel/barchart/quadtree.ts +++ b/public/app/plugins/panel/barchart/quadtree.ts @@ -50,13 +50,7 @@ export class Quadtree { o: Rect[]; q: Quads | null; - constructor( - public x: number, - public y: number, - public w: number, - public h: number, - public l: number = 0 - ) { + constructor(public x: number, public y: number, public w: number, public h: number, public l: number = 0) { this.o = []; this.q = null; } diff --git a/public/app/plugins/panel/table-old/editor.ts b/public/app/plugins/panel/table-old/editor.ts index e6cb416ee54..b26f578a852 100644 --- a/public/app/plugins/panel/table-old/editor.ts +++ b/public/app/plugins/panel/table-old/editor.ts @@ -15,10 +15,7 @@ export class TablePanelEditorCtrl { static $inject = ['$scope', 'uiSegmentSrv']; - constructor( - $scope: any, - private uiSegmentSrv: any - ) { + constructor($scope: any, private uiSegmentSrv: any) { $scope.editor = this; this.panelCtrl = $scope.ctrl; this.panel = this.panelCtrl.panel; diff --git a/public/app/plugins/panel/table-old/module.ts b/public/app/plugins/panel/table-old/module.ts index 71bf0cf2db3..1836c6cd5cd 100644 --- a/public/app/plugins/panel/table-old/module.ts +++ b/public/app/plugins/panel/table-old/module.ts @@ -56,12 +56,7 @@ export class TablePanelCtrl extends MetricsPanelCtrl { static $inject = ['$scope', '$injector', 'annotationsSrv', '$sanitize']; - constructor( - $scope: any, - $injector: any, - private annotationsSrv: any, - private $sanitize: any - ) { + constructor($scope: any, $injector: any, private annotationsSrv: any, private $sanitize: any) { super($scope, $injector); this.pageIndex = 0; diff --git a/public/app/plugins/panel/timeseries/plugins/annotations/AnnotationTooltip.tsx b/public/app/plugins/panel/timeseries/plugins/annotations/AnnotationTooltip.tsx index 8de6863218a..fca158f2e4a 100644 --- a/public/app/plugins/panel/timeseries/plugins/annotations/AnnotationTooltip.tsx +++ b/public/app/plugins/panel/timeseries/plugins/annotations/AnnotationTooltip.tsx @@ -82,7 +82,9 @@ export const AnnotationTooltip = ({ {alertText} <> - {tags?.map((t, i) => )} + {tags?.map((t, i) => ( + + ))}
diff --git a/public/sass/base/_grafana_icons.scss b/public/sass/base/_grafana_icons.scss index cfb55f8464d..40fc44da405 100644 --- a/public/sass/base/_grafana_icons.scss +++ b/public/sass/base/_grafana_icons.scss @@ -1,8 +1,7 @@ @font-face { font-family: 'grafana-icons'; src: url('../fonts/grafana-icons.eot?okx5td'); - src: - url('../fonts/grafana-icons.eot?okx5td#iefix') format('embedded-opentype'), + src: url('../fonts/grafana-icons.eot?okx5td#iefix') format('embedded-opentype'), url('../fonts/grafana-icons.ttf?okx5td') format('truetype'), url('../fonts/grafana-icons.woff?okx5td') format('woff'), url('../fonts/grafana-icons.svg?okx5td#grafana-icons') format('svg'); diff --git a/public/sass/base/font-awesome/_path.scss b/public/sass/base/font-awesome/_path.scss index 5c84b7bb940..d452de2170a 100644 --- a/public/sass/base/font-awesome/_path.scss +++ b/public/sass/base/font-awesome/_path.scss @@ -4,8 +4,7 @@ @font-face { font-family: 'FontAwesome'; src: url('#{$fa-font-path}/fontawesome-webfont.eot?v=#{$fa-version}'); - src: - url('#{$fa-font-path}/fontawesome-webfont.eot?#iefix&v=#{$fa-version}') format('embedded-opentype'), + src: url('#{$fa-font-path}/fontawesome-webfont.eot?#iefix&v=#{$fa-version}') format('embedded-opentype'), url('#{$fa-font-path}/fontawesome-webfont.woff2?v=#{$fa-version}') format('woff2'), url('#{$fa-font-path}/fontawesome-webfont.woff?v=#{$fa-version}') format('woff'), url('#{$fa-font-path}/fontawesome-webfont.ttf?v=#{$fa-version}') format('truetype'), diff --git a/public/sass/components/_scrollbar.scss b/public/sass/components/_scrollbar.scss index ee242a0d9aa..281423c8a2d 100644 --- a/public/sass/components/_scrollbar.scss +++ b/public/sass/components/_scrollbar.scss @@ -20,12 +20,8 @@ .ps__rail-x { display: none; opacity: 0; - transition: - background-color 0.2s linear, - opacity 0.2s linear; - -webkit-transition: - background-color 0.2s linear, - opacity 0.2s linear; + transition: background-color 0.2s linear, opacity 0.2s linear; + -webkit-transition: background-color 0.2s linear, opacity 0.2s linear; height: 15px; /* there must be 'bottom' or 'top' for ps__rail-x */ bottom: 0px; @@ -36,12 +32,8 @@ .ps__rail-y { display: none; opacity: 0; - transition: - background-color 0.2s linear, - opacity 0.2s linear; - -webkit-transition: - background-color 0.2s linear, - opacity 0.2s linear; + transition: background-color 0.2s linear, opacity 0.2s linear; + -webkit-transition: background-color 0.2s linear, opacity 0.2s linear; width: 15px; /* there must be 'right' or 'left' for ps__rail-y */ right: 0; @@ -250,9 +242,7 @@ // height: 15px; width: 15px; - transition: - background-color 0.2s linear, - opacity 0.2s linear; + transition: background-color 0.2s linear, opacity 0.2s linear; opacity: 0; } diff --git a/public/sass/components/_slate_editor.scss b/public/sass/components/_slate_editor.scss index bd596c4542a..67647f6f8b8 100644 --- a/public/sass/components/_slate_editor.scss +++ b/public/sass/components/_slate_editor.scss @@ -61,11 +61,8 @@ display: block; white-space: nowrap; cursor: pointer; - transition: - color 0.3s cubic-bezier(0.645, 0.045, 0.355, 1), - border-color 0.3s cubic-bezier(0.645, 0.045, 0.355, 1), - background 0.3s cubic-bezier(0.645, 0.045, 0.355, 1), - padding 0.15s cubic-bezier(0.645, 0.045, 0.355, 1); + transition: color 0.3s cubic-bezier(0.645, 0.045, 0.355, 1), border-color 0.3s cubic-bezier(0.645, 0.045, 0.355, 1), + background 0.3s cubic-bezier(0.645, 0.045, 0.355, 1), padding 0.15s cubic-bezier(0.645, 0.045, 0.355, 1); } .typeahead-item__selected { diff --git a/public/sass/components/_tagsinput.scss b/public/sass/components/_tagsinput.scss index 44a7109196c..8d9d3255bd4 100644 --- a/public/sass/components/_tagsinput.scss +++ b/public/sass/components/_tagsinput.scss @@ -36,9 +36,7 @@ } &:hover { - box-shadow: - inset 0 1px 0 rgba(255, 255, 255, 0.2), - 0 1px 2px rgba(0, 0, 0, 0.05); + box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); &:active { box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125); diff --git a/public/test/matchers/utils.ts b/public/test/matchers/utils.ts index e7758bb9177..26776b1fb1f 100644 --- a/public/test/matchers/utils.ts +++ b/public/test/matchers/utils.ts @@ -15,8 +15,8 @@ export function forceObservableCompletion(subscription: Subscription, resolve: ( `${matcherHint('.toEmitValues')} Expected ${printReceived('Observable')} to be ${printExpected( - `completed within ${OBSERVABLE_TEST_TIMEOUT_IN_MS}ms` - )} but it did not.`, + `completed within ${OBSERVABLE_TEST_TIMEOUT_IN_MS}ms` + )} but it did not.`, }); }) ); diff --git a/public/test/mocks/datasource_srv.ts b/public/test/mocks/datasource_srv.ts index 9da05b83ac2..3f68dded950 100644 --- a/public/test/mocks/datasource_srv.ts +++ b/public/test/mocks/datasource_srv.ts @@ -12,10 +12,7 @@ import { } from '@grafana/data'; export class DatasourceSrvMock { - constructor( - private defaultDS: DataSourceApi, - private datasources: { [name: string]: DataSourceApi } - ) { + constructor(private defaultDS: DataSourceApi, private datasources: { [name: string]: DataSourceApi }) { // } diff --git a/yarn.lock b/yarn.lock index aa7caf67d1a..7805d1d30d4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -19502,7 +19502,7 @@ __metadata: postcss-loader: 7.3.3 postcss-reporter: 7.0.5 postcss-scss: 4.0.6 - prettier: 3.0.0 + prettier: 2.8.4 prismjs: 1.29.0 prop-types: 15.8.1 pseudoizer: ^0.1.0 @@ -26332,12 +26332,12 @@ __metadata: languageName: node linkType: hard -"prettier@npm:3.0.0": - version: 3.0.0 - resolution: "prettier@npm:3.0.0" +"prettier@npm:2.8.4": + version: 2.8.4 + resolution: "prettier@npm:2.8.4" bin: - prettier: bin/prettier.cjs - checksum: 6a832876a1552dc58330d2467874e5a0b46b9ccbfc5d3531eb69d15684743e7f83dc9fbd202db6270446deba9c82b79d24383d09924c462b457136a759425e33 + prettier: bin-prettier.js + checksum: c173064bf3df57b6d93d19aa98753b9b9dd7657212e33b41ada8e2e9f9884066bb9ca0b4005b89b3ab137efffdf8fbe0b462785aba20364798ff4303aadda57e languageName: node linkType: hard