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

@@ -177,7 +177,7 @@ function trackActionsView() {
trigger_action_count,
};
runExternalHook('nodeCreateList.onViewActions', useWebhooksStore(), trackingPayload);
void runExternalHook('nodeCreateList.onViewActions', useWebhooksStore(), trackingPayload);
telemetry?.trackNodesPanel('nodeCreateList.onViewActions', trackingPayload);
}
@@ -198,7 +198,7 @@ function addHttpNode() {
if (telemetry) setAddedNodeActionParameters(updateData);
const app_identifier = actions.value[0].key;
runExternalHook('nodeCreateList.onActionsCustmAPIClicked', useWebhooksStore(), {
void runExternalHook('nodeCreateList.onActionsCustmAPIClicked', useWebhooksStore(), {
app_identifier,
});
telemetry?.trackNodesPanel('nodeCreateList.onActionsCustmAPIClicked', { app_identifier });

View File

@@ -36,19 +36,19 @@ const nodeCreatorView = computed(() => useNodeCreatorStore().selectedView);
function onSearch(value: string) {
if (activeViewStack.value.uuid) {
updateCurrentViewStack({ search: value });
setActiveItemIndex(activeViewStack.value.activeIndex ?? 0);
void setActiveItemIndex(activeViewStack.value.activeIndex ?? 0);
}
}
function onTransitionEnd() {
// For actions, set the active focus to the first action, not category
const newStackIndex = activeViewStack.value.mode === 'actions' ? 1 : 0;
setActiveItemIndex(activeViewStack.value.activeIndex || 0 || newStackIndex);
void setActiveItemIndex(activeViewStack.value.activeIndex || 0 || newStackIndex);
}
onMounted(() => {
attachKeydownEvent();
setActiveItemIndex(activeViewStack.value.activeIndex ?? 0);
void setActiveItemIndex(activeViewStack.value.activeIndex ?? 0);
});
onUnmounted(() => {

View File

@@ -60,7 +60,9 @@ function clear() {
}
onMounted(() => {
runExternalHook('nodeCreator_searchBar.mount', useWebhooksStore(), { inputRef: state.inputRef });
void runExternalHook('nodeCreator_searchBar.mount', useWebhooksStore(), {
inputRef: state.inputRef,
});
setTimeout(focus, 0);
});

View File

@@ -94,7 +94,7 @@ describe('NodesListPanel', () => {
expect(container.querySelector('.backButton')).toBeInTheDocument();
fireEvent.click(container.querySelector('.backButton')!);
await fireEvent.click(container.querySelector('.backButton')!);
await Vue.nextTick();
expect(screen.queryAllByTestId('item-iterator-item')).toHaveLength(6);
@@ -265,20 +265,20 @@ describe('NodesListPanel', () => {
screen.getByText('On app event').click();
await Vue.nextTick();
fireEvent.input(screen.getByTestId('node-creator-search-bar'), {
await fireEvent.input(screen.getByTestId('node-creator-search-bar'), {
target: { value: 'Ninth' },
});
await Vue.nextTick();
expect(screen.queryAllByTestId('item-iterator-item')).toHaveLength(1);
fireEvent.input(screen.getByTestId('node-creator-search-bar'), {
await fireEvent.input(screen.getByTestId('node-creator-search-bar'), {
target: { value: 'Non sense' },
});
await Vue.nextTick();
expect(screen.queryAllByTestId('item-iterator-item')).toHaveLength(0);
expect(screen.queryByText("We didn't make that... yet")).toBeInTheDocument();
fireEvent.click(container.querySelector('.clear')!);
await fireEvent.click(container.querySelector('.clear')!);
await Vue.nextTick();
expect(screen.queryAllByTestId('item-iterator-item')).toHaveLength(9);
});

View File

@@ -203,7 +203,7 @@ export const useActions = () => {
source_mode: rootView.toLowerCase(),
resource: (action.value as INodeParameters).resource || '',
};
runExternalHook('nodeCreateList.addAction', useWebhooksStore(), payload);
void runExternalHook('nodeCreateList.addAction', useWebhooksStore(), payload);
telemetry?.trackNodesPanel('nodeCreateList.addAction', payload);
}

View File

@@ -31,7 +31,7 @@ export const useKeyboardNavigation = defineStore('nodeCreatorKeyboardNavigation'
function getElementId(element?: Element) {
return element?.getAttribute(KEYBOARD_ID_ATTR) || undefined;
}
function refreshSelectableItems(): Promise<void> {
async function refreshSelectableItems(): Promise<void> {
return new Promise((resolve) => {
// Wait for DOM to update
cleanupSelectableItems();