fix: Set '@typescript-eslint/return-await' rule to 'always' for node code (no-changelog) (#8363)

Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
This commit is contained in:
Tomi Turtiainen
2024-01-17 17:08:50 +02:00
committed by GitHub
parent 2eb829a6b4
commit 9a1cc56806
369 changed files with 1041 additions and 928 deletions

View File

@@ -16,5 +16,9 @@ module.exports = {
'@typescript-eslint/no-redundant-type-constituents': 'warn',
'@typescript-eslint/prefer-nullish-coalescing': 'warn',
'@typescript-eslint/prefer-optional-chain': 'warn',
/**
* https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/return-await.md
*/
'@typescript-eslint/return-await': ['error', 'always'],
},
};

View File

@@ -6,9 +6,9 @@ export interface IDeferredPromise<T> {
}
export async function createDeferredPromise<T = void>(): Promise<IDeferredPromise<T>> {
return new Promise<IDeferredPromise<T>>((resolveCreate) => {
return await new Promise<IDeferredPromise<T>>((resolveCreate) => {
const promise = new Promise<T>((resolve, reject) => {
resolveCreate({ promise: async () => promise, resolve, reject });
resolveCreate({ promise: async () => await promise, resolve, reject });
});
});
}

View File

@@ -284,7 +284,7 @@ export class RoutingNode {
runIndex: number,
): Promise<INodeExecutionData[]> {
if (typeof action === 'function') {
return action.call(executeSingleFunctions, inputData, responseData);
return await action.call(executeSingleFunctions, inputData, responseData);
}
if (action.type === 'rootProperty') {
try {
@@ -534,19 +534,20 @@ export class RoutingNode {
const executePaginationFunctions = {
...executeSingleFunctions,
makeRoutingRequest: async (requestOptions: DeclarativeRestApiSettings.ResultOptions) => {
return this.rawRoutingRequest(
return await this.rawRoutingRequest(
executeSingleFunctions,
requestOptions,
credentialType,
credentialsDecrypted,
).then(async (data) =>
this.postProcessResponseData(
executeSingleFunctions,
data,
requestData,
itemIndex,
runIndex,
),
).then(
async (data) =>
await this.postProcessResponseData(
executeSingleFunctions,
data,
requestData,
itemIndex,
runIndex,
),
);
},
};
@@ -649,14 +650,15 @@ export class RoutingNode {
requestData,
credentialType,
credentialsDecrypted,
).then(async (data) =>
this.postProcessResponseData(
executeSingleFunctions,
data,
requestData,
itemIndex,
runIndex,
),
).then(
async (data) =>
await this.postProcessResponseData(
executeSingleFunctions,
data,
requestData,
itemIndex,
runIndex,
),
);
(requestData.options[optionsType] as IDataObject)[properties.offsetParameter] =
@@ -694,14 +696,15 @@ export class RoutingNode {
requestData,
credentialType,
credentialsDecrypted,
).then(async (data) =>
this.postProcessResponseData(
executeSingleFunctions,
data,
requestData,
itemIndex,
runIndex,
),
).then(
async (data) =>
await this.postProcessResponseData(
executeSingleFunctions,
data,
requestData,
itemIndex,
runIndex,
),
);
}
return responseData;

View File

@@ -1058,7 +1058,7 @@ export class Workflow {
webhookData,
);
return webhookFn.call(thisArgs);
return await webhookFn.call(thisArgs);
}
/**
@@ -1143,7 +1143,7 @@ export class Workflow {
return triggerResponse;
}
// In all other modes simply start the trigger
return nodeType.trigger.call(triggerFunctions);
return await nodeType.trigger.call(triggerFunctions);
}
/**
@@ -1172,7 +1172,7 @@ export class Workflow {
});
}
return nodeType.poll.call(pollFunctions);
return await nodeType.poll.call(pollFunctions);
}
/**
@@ -1208,7 +1208,9 @@ export class Workflow {
webhookData,
closeFunctions,
);
return nodeType instanceof Node ? nodeType.webhook(context) : nodeType.webhook.call(context);
return nodeType instanceof Node
? await nodeType.webhook(context)
: await nodeType.webhook.call(context);
}
/**
@@ -1322,7 +1324,7 @@ export class Workflow {
: await nodeType.execute.call(context);
const closeFunctionsResults = await Promise.allSettled(
closeFunctions.map(async (fn) => fn()),
closeFunctions.map(async (fn) => await fn()),
);
const closingErrors = closeFunctionsResults

View File

@@ -107,7 +107,7 @@ export const jsonStringify = (obj: unknown, options: JSONStringifyOptions = {}):
};
export const sleep = async (ms: number): Promise<void> =>
new Promise((resolve) => {
await new Promise((resolve) => {
setTimeout(resolve, ms);
});

View File

@@ -189,7 +189,7 @@ export function getExecuteFunctions(
workflowInfo: IExecuteWorkflowInfo,
inputData?: INodeExecutionData[],
): Promise<any> {
return additionalData.executeWorkflow(workflowInfo, additionalData, { inputData });
return await additionalData.executeWorkflow(workflowInfo, additionalData, { inputData });
},
getContext(type: string): IContextObject {
return NodeHelpers.getContext(runExecutionData, type, node);