refactor(core): Remove linting exceptions in nodes-base (no-changelog) (#4944)

This commit is contained in:
Michael Kret
2023-01-13 19:11:56 +02:00
committed by GitHub
parent d7732ea150
commit 6608e69457
254 changed files with 2687 additions and 2675 deletions

View File

@@ -37,7 +37,7 @@ export async function koBoToolboxApiRequest(
Object.assign(options, option);
}
if (options.url && !/^http(s)?:/.test(options.url)) {
options.url = credentials.URL + options.url;
options.url = (credentials.URL as string) + options.url;
}
let results = null;
@@ -63,12 +63,11 @@ export async function koBoToolboxApiRequest(
export async function koBoToolboxRawRequest(
this: IExecuteFunctions | IWebhookFunctions | IHookFunctions | ILoadOptionsFunctions,
option: IHttpRequestOptions,
// tslint:disable-next-line:no-any
): Promise<any> {
const credentials = await this.getCredentials('koBoToolboxApi');
if (option.url && !/^http(s)?:/.test(option.url)) {
option.url = credentials.URL + option.url;
option.url = (credentials.URL as string) + option.url;
}
return this.helpers.httpRequestWithAuthentication.call(this, 'koBoToolboxApi', option);
@@ -159,7 +158,7 @@ export function formatSubmission(
.split('/')
.map((k) => _.trim(k, ' _'))
.join('.');
const leafKey = sanitizedKey.split('.').pop() || '';
const leafKey = sanitizedKey.split('.').pop() ?? '';
let format = 'string';
if (_.some(numberMasks, (mask) => matchWildcard(leafKey, mask))) {
format = 'number';
@@ -205,7 +204,7 @@ export async function downloadAttachments(
const credentials = await this.getCredentials('koBoToolboxApi');
// Look for attachment links - there can be more than one
const attachmentList = (submission._attachments || submission.attachments) as any[]; // tslint:disable-line:no-any
const attachmentList = (submission._attachments ?? submission.attachments) as any[];
if (attachmentList?.length) {
for (const [index, attachment] of attachmentList.entries()) {
@@ -267,7 +266,7 @@ export async function downloadAttachments(
if ('question' === options.binaryNamingScheme && relatedQuestion) {
binaryName = relatedQuestion;
} else {
binaryName = `${options.dataPropertyAttachmentsPrefixName || 'attachment_'}${index}`;
binaryName = `${options.dataPropertyAttachmentsPrefixName ?? 'attachment_'}${index}`;
}
binaryItem.binary![binaryName] = await this.helpers.prepareBinaryData(

View File

@@ -79,7 +79,7 @@ export class KoBoToolboxTrigger implements INodeType {
async checkExists(this: IHookFunctions): Promise<boolean> {
const webhookData = this.getWorkflowStaticData('node');
const webhookUrl = this.getNodeWebhookUrl('default');
const formId = this.getNodeParameter('formId') as string; //tslint:disable-line:variable-name
const formId = this.getNodeParameter('formId') as string;
const webhooks = await koBoToolboxApiRequest.call(this, {
url: `/api/v2/assets/${formId}/hooks/`,
});
@@ -96,7 +96,7 @@ export class KoBoToolboxTrigger implements INodeType {
const webhookData = this.getWorkflowStaticData('node');
const webhookUrl = this.getNodeWebhookUrl('default');
const workflow = this.getWorkflow();
const formId = this.getNodeParameter('formId') as string; //tslint:disable-line:variable-name
const formId = this.getNodeParameter('formId') as string;
const response = await koBoToolboxApiRequest.call(this, {
method: 'POST',
@@ -118,7 +118,7 @@ export class KoBoToolboxTrigger implements INodeType {
async delete(this: IHookFunctions): Promise<boolean> {
const webhookData = this.getWorkflowStaticData('node');
const formId = this.getNodeParameter('formId') as string; //tslint:disable-line:variable-name
const formId = this.getNodeParameter('formId') as string;
try {
await koBoToolboxApiRequest.call(this, {
method: 'DELETE',