mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
refactor(core): Lintfix core and workflow packages (#17096)
This commit is contained in:
@@ -12,10 +12,8 @@ function augment<T>(value: T): T {
|
||||
if (value instanceof Date) return new Date(value.valueOf()) as T;
|
||||
if (value instanceof Uint8Array) return value.slice() as T;
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
||||
if (Array.isArray(value)) return augmentArray(value) as T;
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
||||
return augmentObject(value) as T;
|
||||
}
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ export abstract class NodeError extends ExecutionBaseError {
|
||||
if (typeof value === 'number') return value.toString();
|
||||
if (Array.isArray(value)) {
|
||||
const resolvedErrors: string[] = value
|
||||
// eslint-disable-next-line @typescript-eslint/no-shadow
|
||||
|
||||
.map((jsonError) => {
|
||||
if (typeof jsonError === 'string') return jsonError;
|
||||
if (typeof jsonError === 'number') return jsonError.toString();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { ExecutionBaseError } from './abstract/execution-base.error';
|
||||
import type { IDataObject } from '../interfaces';
|
||||
import { ExecutionBaseError } from './abstract/execution-base.error';
|
||||
|
||||
export interface ExpressionErrorOptions {
|
||||
cause?: Error;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { ExecutionBaseError } from './abstract/execution-base.error';
|
||||
import type { INode } from '../interfaces';
|
||||
import { ExecutionBaseError } from './abstract/execution-base.error';
|
||||
|
||||
/**
|
||||
* Class for instantiating an operational error, e.g. a timeout error.
|
||||
|
||||
@@ -14,7 +14,6 @@ export const PrototypeSanitizer: ASTAfterHook = (ast, dataNode) => {
|
||||
if (!node.computed) {
|
||||
// This is static, so we're safe to error here
|
||||
if (node.property.type !== 'Identifier') {
|
||||
// eslint-disable-next-line n8n-local-rules/no-plain-errors
|
||||
throw new ExpressionError(
|
||||
`Unknown property type ${node.property.type} while sanitising expression`,
|
||||
);
|
||||
|
||||
@@ -5,6 +5,7 @@ import { ExpressionExtensionError } from './errors/expression-extension.error';
|
||||
import { ExpressionError } from './errors/expression.error';
|
||||
import { evaluateExpression, setErrorHandler } from './expression-evaluator-proxy';
|
||||
import { sanitizer, sanitizerName } from './expression-sandboxing';
|
||||
import { isExpression } from './expressions/expression-helpers';
|
||||
import { extend, extendOptional } from './extensions';
|
||||
import { extendSyntax } from './extensions/expression-extension';
|
||||
import { extendedFunctions } from './extensions/extended-functions';
|
||||
@@ -25,7 +26,6 @@ import type {
|
||||
} from './interfaces';
|
||||
import type { Workflow } from './workflow';
|
||||
import { WorkflowDataProxy } from './workflow-data-proxy';
|
||||
import { isExpression } from './expressions/expression-helpers';
|
||||
|
||||
const IS_FRONTEND_IN_DEV_MODE =
|
||||
typeof process === 'object' &&
|
||||
|
||||
@@ -136,7 +136,6 @@ export const extendTransform = (expression: string): { code: string } | undefine
|
||||
|
||||
// This is to match behavior in our original expression evaluator (tmpl)
|
||||
const globalIdentifier = types.builders.identifier(
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
typeof window !== 'object' ? 'global' : 'window',
|
||||
);
|
||||
// We want to define all of our commonly used identifiers and member
|
||||
|
||||
@@ -893,7 +893,7 @@ type BaseExecutionFunctions = FunctionsBaseWithRequiredKeys<'getMode'> & {
|
||||
getInputSourceData(inputIndex?: number, connectionType?: NodeConnectionType): ISourceData;
|
||||
getExecutionCancelSignal(): AbortSignal | undefined;
|
||||
onExecutionCancellation(handler: () => unknown): void;
|
||||
logAiEvent(eventName: AiEvent, msg?: string | undefined): void;
|
||||
logAiEvent(eventName: AiEvent, msg?: string): void;
|
||||
};
|
||||
|
||||
// TODO: Create later own type only for Config-Nodes
|
||||
@@ -1002,7 +1002,7 @@ export type ISupplyDataFunctions = ExecuteFunctions.GetNodeParameterFn &
|
||||
getWorkflowDataProxy(itemIndex: number): IWorkflowDataProxyData;
|
||||
getExecutionCancelSignal(): AbortSignal | undefined;
|
||||
onExecutionCancellation(handler: () => unknown): void;
|
||||
logAiEvent(eventName: AiEvent, msg?: string | undefined): void;
|
||||
logAiEvent(eventName: AiEvent, msg?: string): void;
|
||||
cloneWith(replacements: {
|
||||
runIndex: number;
|
||||
inputData: INodeExecutionData[][];
|
||||
@@ -1551,7 +1551,7 @@ export interface INodePropertyValueExtractorFunction {
|
||||
(
|
||||
this: IExecuteSingleFunctions,
|
||||
value: string | NodeParameterValue,
|
||||
): Promise<string | NodeParameterValue> | (string | NodeParameterValue);
|
||||
): Promise<string | NodeParameterValue> | string;
|
||||
}
|
||||
export type INodePropertyValueExtractor = INodePropertyValueExtractorRegex;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
/* eslint-disable @typescript-eslint/no-use-before-define */
|
||||
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
|
||||
/* eslint-disable prefer-spread */
|
||||
@@ -840,7 +840,6 @@ export function getNodeParameters(
|
||||
itemName
|
||||
] as INodeParameters[]) {
|
||||
nodePropertyOptions = nodeProperties.options!.find(
|
||||
// eslint-disable-next-line @typescript-eslint/no-shadow
|
||||
(nodePropertyOptions) => nodePropertyOptions.name === itemName,
|
||||
) as INodePropertyCollection;
|
||||
|
||||
@@ -875,7 +874,7 @@ export function getNodeParameters(
|
||||
tempNodeParameters = {};
|
||||
|
||||
// Get the options of the current item
|
||||
// eslint-disable-next-line @typescript-eslint/no-shadow
|
||||
|
||||
const nodePropertyOptions = nodeProperties.options!.find(
|
||||
(data) => data.name === itemName,
|
||||
);
|
||||
|
||||
@@ -60,7 +60,6 @@ const withIndefiniteArticle = (noun: string): string => {
|
||||
return `${article} ${noun}`;
|
||||
};
|
||||
|
||||
// eslint-disable-next-line complexity
|
||||
function parseFilterConditionValues(
|
||||
condition: FilterConditionValue,
|
||||
options: FilterOptionsValue,
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
/* eslint-disable @typescript-eslint/no-shadow */
|
||||
|
||||
import type { IDataObject, IObservableObject } from './interfaces';
|
||||
|
||||
|
||||
@@ -1030,7 +1030,7 @@ export class WorkflowDataProxy {
|
||||
const placeholdersDataInputData =
|
||||
inputData?.[NodeConnectionTypes.AiTool]?.[0]?.[itemIndex].json;
|
||||
|
||||
if (Boolean(!placeholdersDataInputData)) {
|
||||
if (!placeholdersDataInputData) {
|
||||
throw new ExpressionError('No execution data available', {
|
||||
runIndex,
|
||||
itemIndex,
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/no-use-before-define */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
/* eslint-disable @typescript-eslint/no-for-in-array */
|
||||
@@ -534,7 +533,7 @@ export class Workflow {
|
||||
}
|
||||
connectionsByIndex =
|
||||
this.connectionsByDestinationNode[nodeName][NodeConnectionTypes.Main][connectionIndex];
|
||||
// eslint-disable-next-line @typescript-eslint/no-loop-func
|
||||
|
||||
connectionsByIndex?.forEach((connection) => {
|
||||
if (checkedNodes.includes(connection.node)) {
|
||||
// Node got checked already before
|
||||
@@ -730,7 +729,6 @@ export class Workflow {
|
||||
const toAdd = [...queue];
|
||||
queue = [];
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-loop-func
|
||||
toAdd.forEach((curr) => {
|
||||
if (visited[curr.name]) {
|
||||
visited[curr.name].indicies = dedupe(visited[curr.name].indicies.concat(curr.indicies));
|
||||
@@ -770,7 +768,7 @@ export class Workflow {
|
||||
const outputs = NodeHelpers.getNodeOutputs(this, node, nodeType.description);
|
||||
|
||||
if (
|
||||
!!outputs.find(
|
||||
outputs.find(
|
||||
(output) =>
|
||||
((output as INodeOutputConfiguration)?.type ?? output) !== NodeConnectionTypes.Main,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user