ci: Fix linting issues (no-changelog) (#6788)

* ci: Fix linting (no-changelog)

* lintfix for nodes-base as well
This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2023-07-28 18:28:17 +02:00
committed by GitHub
parent 4e491b754f
commit 6fb8a9ee39
40 changed files with 204 additions and 154 deletions

View File

@@ -18,7 +18,14 @@ module.exports = {
// TODO: Remove this
'import/no-cycle': 'warn',
'import/order': 'off',
'import/extensions': 'off',
'import/extensions': 'warn',
'@typescript-eslint/ban-ts-comment': ['warn', { 'ts-ignore': true }],
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/no-base-to-string': 'warn',
'@typescript-eslint/prefer-nullish-coalescing': 'warn',
'@typescript-eslint/no-redundant-type-constituents': 'warn',
'@typescript-eslint/ban-types': 'warn',
'@typescript-eslint/no-unsafe-enum-comparison': 'warn',
'@typescript-eslint/no-unsafe-declaration-merging': 'warn',
},
};

View File

@@ -58,13 +58,16 @@ import type { WorkflowEntity } from '@db/entities/WorkflowEntity';
import type { WebhookEntity } from '@db/entities/WebhookEntity';
import { ActiveExecutions } from '@/ActiveExecutions';
import { createErrorExecution } from '@/GenericHelpers';
import { WORKFLOW_REACTIVATE_INITIAL_TIMEOUT, WORKFLOW_REACTIVATE_MAX_TIMEOUT } from '@/constants';
import {
STARTING_NODES,
WORKFLOW_REACTIVATE_INITIAL_TIMEOUT,
WORKFLOW_REACTIVATE_MAX_TIMEOUT,
} from '@/constants';
import { NodeTypes } from '@/NodeTypes';
import { WorkflowRunner } from '@/WorkflowRunner';
import { ExternalHooks } from '@/ExternalHooks';
import { whereClause } from './UserManagement/UserManagementHelper';
import { WorkflowsService } from './workflows/workflows.services';
import { STARTING_NODES } from './constants';
import { webhookNotFoundErrorMessage } from './utils';
import { In } from 'typeorm';
import { WebhookRepository } from '@db/repositories';

View File

@@ -172,7 +172,7 @@ export class CredentialsHelper extends ICredentialsHelper {
(property) => property.type === 'hidden' && property?.typeOptions?.expirable === true,
);
if (expirableProperty === undefined || expirableProperty.name === undefined) {
if (expirableProperty?.name === undefined) {
return undefined;
}

View File

@@ -1,6 +1,6 @@
import config from '@/config';
import type { ICredentialDataDecryptedObject, ICredentialTypes } from 'n8n-workflow';
import { deepCopy, LoggerProxy as Logger, jsonParse } from 'n8n-workflow';
import type { ICredentialDataDecryptedObject } from 'n8n-workflow';
import { deepCopy, LoggerProxy as Logger, jsonParse, ICredentialTypes } from 'n8n-workflow';
import type { ICredentialsOverwrite } from '@/Interfaces';
class CredentialsOverwritesClass {

View File

@@ -35,7 +35,10 @@ export class TestWebhooks {
};
} = {};
constructor(private activeWebhooks: ActiveWebhooks, private push: Push) {
constructor(
private activeWebhooks: ActiveWebhooks,
private push: Push,
) {
activeWebhooks.testWebhooks = true;
}

View File

@@ -16,7 +16,10 @@ import { ExecutionRepository } from '@db/repositories';
@Service()
export class WaitingWebhooks {
constructor(private nodeTypes: NodeTypes, private executionRepository: ExecutionRepository) {}
constructor(
private nodeTypes: NodeTypes,
private executionRepository: ExecutionRepository,
) {}
async executeWebhook(
httpMethod: WebhookHttpMethod,

View File

@@ -70,11 +70,7 @@ export class Execute extends BaseCommand {
// Do a basic check if the data in the file looks right
// TODO: Later check with the help of TypeScript data if it is valid or not
if (
workflowData === null ||
workflowData.nodes === undefined ||
workflowData.connections === undefined
) {
if (workflowData?.nodes === undefined || workflowData.connections === undefined) {
this.logger.info(`The file "${flags.file}" does not contain valid workflow data.`);
return;
}

View File

@@ -17,7 +17,10 @@ export declare namespace TranslationRequest {
@Authorized()
@RestController('/')
export class TranslationController {
constructor(private config: Config, private credentialTypes: ICredentialTypes) {}
constructor(
private config: Config,
private credentialTypes: ICredentialTypes,
) {}
@Get('/credential-translation')
async getCredentialTranslation(req: TranslationRequest.Credential) {

View File

@@ -3,7 +3,7 @@ import { DateTime } from 'luxon';
import type { EventMessageTypeNames, JsonObject } from 'n8n-workflow';
import { v4 as uuid } from 'uuid';
import type { AbstractEventPayload } from './AbstractEventPayload';
import type { AbstractEventMessageOptions } from './AbstractEventMessageOptions';
import { AbstractEventMessageOptions } from './AbstractEventMessageOptions';
import type { EventNamesTypes } from '.';
function modifyUnderscoredKeys(

View File

@@ -1,12 +1,17 @@
import { v4 as uuid } from 'uuid';
import type { INodeCredentials, MessageEventBusDestinationOptions } from 'n8n-workflow';
import { LoggerProxy, MessageEventBusDestinationTypeNames } from 'n8n-workflow';
import type { INodeCredentials } from 'n8n-workflow';
import {
LoggerProxy,
MessageEventBusDestinationTypeNames,
MessageEventBusDestinationOptions,
} from 'n8n-workflow';
import * as Db from '@/Db';
import type { AbstractEventMessage } from '../EventMessageClasses/AbstractEventMessage';
import type { EventMessageTypes } from '../EventMessageClasses';
import type { DeleteResult, InsertResult } from 'typeorm';
import type { EventMessageConfirmSource } from '../EventMessageClasses/EventMessageConfirm';
import type { MessageEventBus, MessageWithCallback } from '../MessageEventBus/MessageEventBus';
import { MessageEventBus } from '../MessageEventBus/MessageEventBus';
import type { MessageWithCallback } from '../MessageEventBus/MessageEventBus';
export abstract class MessageEventBusDestination implements MessageEventBusDestinationOptions {
// Since you can't have static abstract functions - this just serves as a reminder that you need to implement these. Please.

View File

@@ -3,15 +3,17 @@
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
import { MessageEventBusDestination } from './MessageEventBusDestination.ee';
import * as Sentry from '@sentry/node';
import { LoggerProxy, MessageEventBusDestinationTypeNames } from 'n8n-workflow';
import type {
MessageEventBusDestinationOptions,
import {
LoggerProxy,
MessageEventBusDestinationTypeNames,
MessageEventBusDestinationSentryOptions,
} from 'n8n-workflow';
import type { MessageEventBusDestinationOptions } from 'n8n-workflow';
import { isLogStreamingEnabled } from '../MessageEventBus/MessageEventBusHelper';
import { eventMessageGenericDestinationTestEvent } from '../EventMessageClasses/EventMessageGeneric';
import { N8N_VERSION } from '@/constants';
import type { MessageEventBus, MessageWithCallback } from '../MessageEventBus/MessageEventBus';
import { MessageEventBus } from '../MessageEventBus/MessageEventBus';
import type { MessageWithCallback } from '../MessageEventBus/MessageEventBus';
export const isMessageEventBusDestinationSentryOptions = (
candidate: unknown,

View File

@@ -2,15 +2,17 @@
/* eslint-disable @typescript-eslint/no-non-null-assertion */
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
import syslog from 'syslog-client';
import type {
MessageEventBusDestinationOptions,
import type { MessageEventBusDestinationOptions } from 'n8n-workflow';
import {
LoggerProxy,
MessageEventBusDestinationTypeNames,
MessageEventBusDestinationSyslogOptions,
} from 'n8n-workflow';
import { LoggerProxy, MessageEventBusDestinationTypeNames } from 'n8n-workflow';
import { MessageEventBusDestination } from './MessageEventBusDestination.ee';
import { isLogStreamingEnabled } from '../MessageEventBus/MessageEventBusHelper';
import { eventMessageGenericDestinationTestEvent } from '../EventMessageClasses/EventMessageGeneric';
import type { MessageEventBus, MessageWithCallback } from '../MessageEventBus/MessageEventBus';
import { MessageEventBus } from '../MessageEventBus/MessageEventBus';
import type { MessageWithCallback } from '../MessageEventBus/MessageEventBus';
export const isMessageEventBusDestinationSyslogOptions = (
candidate: unknown,

View File

@@ -40,7 +40,10 @@ export class Telemetry {
private executionCountsBuffer: IExecutionsBuffer = {};
constructor(private postHog: PostHogClient, private license: License) {}
constructor(
private postHog: PostHogClient,
private license: License,
) {}
setInstanceId(instanceId: string) {
this.instanceId = instanceId;
@@ -70,9 +73,12 @@ export class Telemetry {
}
private startPulse() {
this.pulseIntervalReference = setInterval(async () => {
void this.pulse();
}, 6 * 60 * 60 * 1000); // every 6 hours
this.pulseIntervalReference = setInterval(
async () => {
void this.pulse();
},
6 * 60 * 60 * 1000,
); // every 6 hours
}
private async pulse(): Promise<unknown> {

View File

@@ -169,8 +169,7 @@ workflowsController.get(
// Do a very basic check if it is really a n8n-workflow-json
if (
workflowData === undefined ||
workflowData.nodes === undefined ||
workflowData?.nodes === undefined ||
!Array.isArray(workflowData.nodes) ||
workflowData.connections === undefined ||
typeof workflowData.connections !== 'object' ||

View File

@@ -90,9 +90,8 @@ export class EEWorkflowsService extends WorkflowsService {
}
static addOwnerId(workflow: WorkflowForList, workflowOwnerRole: Role): void {
const ownerId = workflow.shared?.find(
({ roleId }) => String(roleId) === workflowOwnerRole.id,
)?.userId;
const ownerId = workflow.shared?.find(({ roleId }) => String(roleId) === workflowOwnerRole.id)
?.userId;
workflow.ownedBy = ownerId ? { id: ownerId } : null;
delete workflow.shared;
}

View File

@@ -577,7 +577,7 @@ export const getBootstrapDBOptions = (type: TestDBType) =>
name: type,
database: type,
...baseOptions(type),
} as const);
}) as const;
const getDBOptions = (type: TestDBType, name: string) => ({
type,