refactor(editor): Stricter linting for promises and async functions (no-changelog) (#4642)

This commit is contained in:
Michael Kret
2023-05-10 18:10:03 +03:00
committed by GitHub
parent 1b1dc0e655
commit ed3bc154b0
114 changed files with 351 additions and 344 deletions

View File

@@ -6,7 +6,7 @@ import { runExternalHook } from '@/utils';
export function useExternalHooks(): IExternalHooks {
return {
async run(eventName: string, metadata?: IDataObject): Promise<void> {
return await runExternalHook(eventName, useWebhooksStore(), metadata);
return runExternalHook(eventName, useWebhooksStore(), metadata);
},
};
}

View File

@@ -27,7 +27,7 @@ export function useHistoryHelper(activeRoute: Route) {
const isNDVOpen = ref<boolean>(ndvStore.activeNodeName !== null);
const undo = () =>
const undo = async () =>
callDebounced(
async () => {
const command = historyStore.popUndoableToUndo();
@@ -56,7 +56,7 @@ export function useHistoryHelper(activeRoute: Route) {
{ debounceTime: UNDO_REDO_DEBOUNCE_INTERVAL },
);
const redo = () =>
const redo = async () =>
callDebounced(
async () => {
const command = historyStore.popUndoableToRedo();
@@ -113,9 +113,9 @@ export function useHistoryHelper(activeRoute: Route) {
event.preventDefault();
if (!isNDVOpen.value) {
if (event.shiftKey) {
redo();
void redo();
} else {
undo();
void undo();
}
} else if (!event.shiftKey) {
trackUndoAttempt(event);

View File

@@ -14,9 +14,9 @@ export function useMessage() {
};
if (typeof configOrTitle === 'string') {
return await MessageBox.alert(message, configOrTitle, resolvedConfig);
return MessageBox.alert(message, configOrTitle, resolvedConfig);
}
return await MessageBox.alert(message, resolvedConfig);
return MessageBox.alert(message, resolvedConfig);
}
async function confirm(
@@ -34,9 +34,9 @@ export function useMessage() {
};
if (typeof configOrTitle === 'string') {
return await MessageBox.confirm(message, configOrTitle, resolvedConfig);
return MessageBox.confirm(message, configOrTitle, resolvedConfig);
}
return await MessageBox.confirm(message, resolvedConfig);
return MessageBox.confirm(message, resolvedConfig);
}
async function prompt(
@@ -51,9 +51,9 @@ export function useMessage() {
};
if (typeof configOrTitle === 'string') {
return await MessageBox.prompt(message, configOrTitle, resolvedConfig);
return MessageBox.prompt(message, configOrTitle, resolvedConfig);
}
return await MessageBox.prompt(message, resolvedConfig);
return MessageBox.prompt(message, resolvedConfig);
}
return {

View File

@@ -120,7 +120,7 @@ export function useToast() {
false,
);
externalHooks.run('showMessage.showError', {
void externalHooks.run('showMessage.showError', {
title,
message,
errorMessage: error.message,

View File

@@ -1,6 +1,6 @@
import type { BaseTextKey } from '@/plugins/i18n';
import { useUIStore, useUsageStore } from '@/stores';
import { useI18n } from '@/composables';
import { useI18n } from './useI18n';
import { computed } from 'vue';
export function useUpgradeLink(queryParams = { default: '', desktop: '' }) {