ci: Expand ESLint to tests in BE packages (no-changelog) (#6147)

* 🔧 Adjust base ESLint config

* 🔧 Adjust `lint` and `lintfix` in `nodes-base`

* 🔧 Include `test` and `utils` in `nodes-base`

* 📘 Convert JS tests to TS

* 👕 Apply lintfixes
This commit is contained in:
Iván Ovejero
2023-05-02 10:37:19 +02:00
committed by GitHub
parent c63181b317
commit 06fa6f1fb3
59 changed files with 390 additions and 307 deletions

View File

@@ -1,9 +1,7 @@
import set from 'lodash.set';
import {
import type {
ICredentialDataDecryptedObject,
ICredentialsHelper,
IDataObject,
IDeferredPromise,
IExecuteWorkflowInfo,
IHttpRequestHelper,
@@ -20,12 +18,12 @@ import {
IVersionedNodeType,
IWorkflowBase,
IWorkflowExecuteAdditionalData,
NodeHelpers,
NodeParameterValue,
WorkflowHooks,
} from 'n8n-workflow';
import { deepCopy } from 'n8n-workflow';
import { ICredentialsHelper, NodeHelpers, WorkflowHooks } from 'n8n-workflow';
import { Credentials } from '@/Credentials';
import { IExecuteFunctions } from '@/Interfaces';
import type { IExecuteFunctions } from '@/Interfaces';
export class CredentialsHelper extends ICredentialsHelper {
async authenticate(
@@ -381,12 +379,12 @@ class NodeTypesClass implements INodeTypes {
compareData.value2 as NodeParameterValue,
);
if (compareOperationResult === true && combineOperation === 'any') {
if (compareOperationResult && combineOperation === 'any') {
// If it passes and the operation is "any" we do not have to check any
// other ones as it should pass anyway. So go on with the next item.
returnDataTrue.push(item);
continue itemLoop;
} else if (compareOperationResult === false && combineOperation === 'all') {
} else if (!compareOperationResult && combineOperation === 'all') {
// If it fails and the operation is "all" we do not have to check any
// other ones as it should be not pass anyway. So go on with the next item.
returnDataFalse.push(item);
@@ -524,7 +522,7 @@ class NodeTypesClass implements INodeTypes {
outputs: ['main'],
properties: [],
},
execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
const items = this.getInputData();
return this.prepareOutputData(items);
},
@@ -570,7 +568,7 @@ class NodeTypesClass implements INodeTypes {
},
],
},
execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
const items = this.getInputData();
const returnData: INodeExecutionData[] = [];
@@ -702,13 +700,14 @@ class NodeTypesClass implements INodeTypes {
name: 'dotNotation',
type: 'boolean',
default: true,
description: `<p>By default, dot-notation is used in property names. This means that "a.b" will set the property "b" underneath "a" so { "a": { "b": value} }.</p><p>If that is not intended this can be deactivated, it will then set { "a.b": value } instead.</p>`,
description:
'<p>By default, dot-notation is used in property names. This means that "a.b" will set the property "b" underneath "a" so { "a": { "b": value} }.</p><p>If that is not intended this can be deactivated, it will then set { "a.b": value } instead.</p>',
},
],
},
],
},
execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
const items = this.getInputData();
if (items.length === 0) {
@@ -722,13 +721,13 @@ class NodeTypesClass implements INodeTypes {
for (let itemIndex = 0; itemIndex < items.length; itemIndex++) {
keepOnlySet = this.getNodeParameter('keepOnlySet', itemIndex, false) as boolean;
item = items[itemIndex];
const options = this.getNodeParameter('options', itemIndex, {}) as IDataObject;
const options = this.getNodeParameter('options', itemIndex, {});
const newItem: INodeExecutionData = {
json: {},
};
if (keepOnlySet !== true) {
if (!keepOnlySet) {
if (item.binary !== undefined) {
// Create a shallow copy of the binary data so that the old
// data references which do not get changed still stay behind
@@ -737,7 +736,7 @@ class NodeTypesClass implements INodeTypes {
Object.assign(newItem.binary, item.binary);
}
newItem.json = JSON.parse(JSON.stringify(item.json));
newItem.json = deepCopy(item.json);
}
// Add boolean values
@@ -797,7 +796,7 @@ class NodeTypesClass implements INodeTypes {
outputs: ['main'],
properties: [],
},
execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
const items = this.getInputData();
return this.prepareOutputData(items);
@@ -851,6 +850,8 @@ export function WorkflowExecuteAdditionalData(
connections: {},
};
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
return {
credentialsHelper: new CredentialsHelper(''),
hooks: new WorkflowHooks(hookFunctions, 'trigger', '1', workflowData),