Skip to content

Commit

Permalink
ci: Upgrade eslint, prettier, typescript, and some other dev tooling …
Browse files Browse the repository at this point in the history
…(no-changelog) (#8895)

Co-authored-by: Iván Ovejero <[email protected]>
  • Loading branch information
netroy and ivov authored Mar 26, 2024
1 parent 117b57c commit 372d5c7
Show file tree
Hide file tree
Showing 190 changed files with 1,131 additions and 1,187 deletions.
7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,11 @@
"axios": "1.6.7",
"chokidar": "3.5.2",
"formidable": "3.5.1",
"ip": "2.0.1",
"prettier": "^3.1.0",
"prettier": "^3.2.5",
"semver": "^7.5.4",
"tslib": "^2.6.1",
"tslib": "^2.6.2",
"tsconfig-paths": "^4.2.0",
"typescript": "^5.3.0"
"typescript": "^5.4.2"
},
"patchedDependencies": {
"[email protected]": "patches/[email protected]",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ export class LmChatOpenAi implements INodeType {
modelKwargs: options.responseFormat
? {
response_format: { type: options.responseFormat },
}
}
: undefined,
});

Expand Down
28 changes: 14 additions & 14 deletions packages/@n8n_io/eslint-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,23 @@
"private": true,
"version": "0.0.1",
"devDependencies": {
"@types/eslint": "^8.44.7",
"@typescript-eslint/eslint-plugin": "^6.12.0",
"@typescript-eslint/parser": "^6.12.0",
"@vue/eslint-config-prettier": "^8.0.0",
"@vue/eslint-config-typescript": "^12.0.0",
"eslint": "^8.54.0",
"eslint-config-airbnb-typescript": "^17.1.0",
"eslint-config-prettier": "^9.0.0",
"@types/eslint": "^8.56.5",
"@typescript-eslint/eslint-plugin": "^7.2.0",
"@typescript-eslint/parser": "^7.2.0",
"@vue/eslint-config-prettier": "^9.0.0",
"@vue/eslint-config-typescript": "^13.0.0",
"eslint": "^8.57.0",
"eslint-config-airbnb-typescript": "^18.0.0",
"eslint-config-prettier": "^9.1.0",
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-plugin-import": "^2.29.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-lodash": "^7.4.0",
"eslint-plugin-n8n-local-rules": "^1.0.0",
"eslint-plugin-prettier": "^5.0.1",
"eslint-plugin-unicorn": "^49.0.0",
"eslint-plugin-unused-imports": "^3.0.0",
"eslint-plugin-vue": "^9.18.1",
"vue-eslint-parser": "^9.3.2"
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-unicorn": "^51.0.1",
"eslint-plugin-unused-imports": "^3.1.0",
"eslint-plugin-vue": "^9.23.0",
"vue-eslint-parser": "^9.4.2"
},
"scripts": {
"clean": "rimraf .turbo",
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/InternalHooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ export class InternalHooks {
? this.eventBus.sendWorkflowEvent({
eventName: 'n8n.workflow.success',
payload: sharedEventPayload,
})
})
: this.eventBus.sendWorkflowEvent({
eventName: 'n8n.workflow.failed',
payload: {
Expand All @@ -498,7 +498,7 @@ export class InternalHooks {
errorNodeId: telemetryProperties.error_node_id?.toString(),
errorMessage: telemetryProperties.error_message?.toString(),
},
}),
}),
);

void Promise.all([...promises, this.telemetry.trackWorkflowExecution(telemetryProperties)]);
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/LoadNodesAndCredentials.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ export class LoadNodesAndCredentials {
: [
...(await glob('n8n-nodes-*', globOptions)),
...(await glob('@*/n8n-nodes-*', { ...globOptions, deep: 2 })),
];
];

for (const packagePath of installedPackagePaths) {
try {
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/TestWebhooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export class TestWebhooks implements IWebhookManager {
const executionMode = 'manual';
const executionId = await WebhookHelpers.executeWebhook(
workflow,
webhook!,
webhook,
workflowEntity,
workflowStartNode,
executionMode,
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/WebhookHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -828,7 +828,7 @@ export async function executeWebhook(
: new ApplicationError('There was a problem executing the workflow', {
level: 'warning',
cause: e,
});
});
if (didSendResponse) throw error;
responseCallback(error, {});
return;
Expand Down
33 changes: 17 additions & 16 deletions packages/cli/src/config/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ type GetPathSegments<Traversable, Filter> = Traversable extends Filter
? []
: {
[K in ValidKeys<Traversable>]: [K, ...GetPathSegments<Traversable[K], Filter>];
}[ValidKeys<Traversable>];
}[ValidKeys<Traversable>];

/**
* Transform a union of string arrays (path segments) into a union of strings (dotted paths).
Expand All @@ -31,12 +31,12 @@ type GetPathSegments<Traversable, Filter> = Traversable extends Filter
type JoinByDotting<T extends string[]> = T extends [infer F]
? F
: T extends [infer F, ...infer R]
? F extends string
? F extends string
? R extends string[]
? `${F}.${JoinByDotting<R>}`
: never
: never
: string;
: string;

type ToDottedPath<T> = JoinByDotting<RemoveExcess<T>>;

Expand Down Expand Up @@ -64,14 +64,14 @@ type ConfigOptionPath =
type ToReturnType<T extends ConfigOptionPath> = T extends NumericPath
? number
: T extends BooleanPath
? boolean
: T extends StringLiteralArrayPath
? StringLiteralMap[T]
: T extends keyof ExceptionPaths
? ExceptionPaths[T]
: T extends StringPath
? string
: unknown;
? boolean
: T extends StringLiteralArrayPath
? StringLiteralMap[T]
: T extends keyof ExceptionPaths
? ExceptionPaths[T]
: T extends StringPath
? string
: unknown;

type ExceptionPaths = {
'queue.bull.redis': object;
Expand All @@ -86,11 +86,12 @@ type ExceptionPaths = {
// string literals map
// -----------------------------------

type GetPathSegmentsWithUnions<T> = T extends ReadonlyArray<infer C>
? [C]
: {
[K in ValidKeys<T>]: [K, ...GetPathSegmentsWithUnions<T[K]>];
}[ValidKeys<T>];
type GetPathSegmentsWithUnions<T> =
T extends ReadonlyArray<infer C>
? [C]
: {
[K in ValidKeys<T>]: [K, ...GetPathSegmentsWithUnions<T[K]>];
}[ValidKeys<T>];

type ToPathUnionPair<T extends string[]> = T extends [...infer Path, infer Union]
? Path extends string[]
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/credentials/credentials.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ export class CredentialsController {
);

if (newShareeIds.length) {
await this.enterpriseCredentialsService.share(trx, credential!, newShareeIds);
await this.enterpriseCredentialsService.share(trx, credential, newShareeIds);
}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ export class CreateLdapEntities1674509946020 implements ReversibleMigration {
dbType === 'sqlite'
? 'INTEGER PRIMARY KEY AUTOINCREMENT'
: dbType === 'postgresdb'
? 'SERIAL NOT NULL PRIMARY KEY'
: 'INTEGER NOT NULL AUTO_INCREMENT';
? 'SERIAL NOT NULL PRIMARY KEY'
: 'INTEGER NOT NULL AUTO_INCREMENT';

const timestampColumn =
dbType === 'sqlite'
? 'DATETIME NOT NULL'
: dbType === 'postgresdb'
? 'TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP'
: 'DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP';
? 'TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP'
: 'DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP';

await runQuery(
`CREATE TABLE IF NOT EXISTS ${escape.tableName('auth_provider_sync_history')} (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export class InstalledPackagesRepository extends Repository<InstalledPackages> {

installedPackage.installedNodes = [];

return loadedNodes.map(async (loadedNode) => {
for (const loadedNode of loadedNodes) {
const installedNode = this.installedNodesRepository.create({
name: nodeTypes[loadedNode.name].type.description.displayName,
type: loadedNode.name,
Expand All @@ -41,8 +41,8 @@ export class InstalledPackagesRepository extends Repository<InstalledPackages> {

installedPackage.installedNodes.push(installedNode);

return await manager.save(installedNode);
});
await manager.save(installedNode);
}
});

return installedPackage!;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ export class WorkflowRepository extends Repository<WorkflowEntity> {
updatedAt: true,
versionId: true,
shared: { userId: true, role: true },
};
};

delete select?.ownedBy; // remove non-entity field, handled after query

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export function getLabelsForEvent(event: EventMessageTypes): Record<string, stri
credential_type: getLabelValueForCredential(
event.payload.credentialType ?? 'unknown',
),
}
}
: {};
}

Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/services/credentials-tester.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,11 @@ export class CredentialsTester {
? {
status: 'OK',
message: OAUTH2_CREDENTIAL_TEST_SUCCEEDED,
}
}
: {
status: 'Error',
message: OAUTH2_CREDENTIAL_TEST_FAILED,
};
};
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,12 @@ export function getWorkerCommandReceivedHandler(options: WorkerCommandReceivedHa
arch: os.arch(),
platform: os.platform(),
hostname: os.hostname(),
interfaces: Object.values(os.networkInterfaces()).flatMap(
(interfaces) =>
(interfaces ?? [])?.map((net) => ({
family: net.family,
address: net.address,
internal: net.internal,
})),
interfaces: Object.values(os.networkInterfaces()).flatMap((interfaces) =>
(interfaces ?? [])?.map((net) => ({
family: net.family,
address: net.address,
internal: net.internal,
})),
),
version: N8N_VERSION,
},
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/workflows/workflow.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export class WorkflowService {
? {
workflows: workflows.map((w) => this.ownershipService.addOwnedByAndSharedWith(w)),
count,
}
}
: { workflows, count };
}

Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/workflows/workflows.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ export class WorkflowsController {

if (newShareeIds.length) {
const users = await this.userRepository.getByIds(trx, newShareeIds);
await this.sharedWorkflowRepository.share(trx, workflow!, users);
await this.sharedWorkflowRepository.share(trx, workflow, users);
}
});

Expand Down
8 changes: 4 additions & 4 deletions packages/cli/test/integration/workflowHistory.api.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ describe('GET /workflow-history/:workflowId', () => {
),
);

const last = versions.sort((a, b) => b.createdAt.valueOf() - a.createdAt.valueOf())[0]! as any;
const last = versions.sort((a, b) => b.createdAt.valueOf() - a.createdAt.valueOf())[0] as any;
delete last.nodes;
delete last.connections;

Expand Down Expand Up @@ -95,7 +95,7 @@ describe('GET /workflow-history/:workflowId', () => {
new Array(10).fill(undefined).map(async (_) => await createWorkflowHistoryItem(workflow2.id)),
);

const last = versions.sort((a, b) => b.createdAt.valueOf() - a.createdAt.valueOf())[0]! as any;
const last = versions.sort((a, b) => b.createdAt.valueOf() - a.createdAt.valueOf())[0] as any;
delete last.nodes;
delete last.connections;

Expand All @@ -119,7 +119,7 @@ describe('GET /workflow-history/:workflowId', () => {
),
);

const last = versions.sort((a, b) => b.createdAt.valueOf() - a.createdAt.valueOf())[0]! as any;
const last = versions.sort((a, b) => b.createdAt.valueOf() - a.createdAt.valueOf())[0] as any;
delete last.nodes;
delete last.connections;

Expand All @@ -143,7 +143,7 @@ describe('GET /workflow-history/:workflowId', () => {
),
);

const last = versions.sort((a, b) => b.createdAt.valueOf() - a.createdAt.valueOf())[5]! as any;
const last = versions.sort((a, b) => b.createdAt.valueOf() - a.createdAt.valueOf())[5] as any;
delete last.nodes;
delete last.connections;

Expand Down
10 changes: 5 additions & 5 deletions packages/core/src/NodeExecuteFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -810,7 +810,7 @@ export async function proxyRequestToAxios(
statusCode: response.status,
statusMessage: response.statusText,
request: response.request,
}
}
: body;
} catch (error) {
const { config, response } = error;
Expand Down Expand Up @@ -1042,7 +1042,7 @@ export function assertBinaryData(
propertyName: string,
inputIndex: number,
): IBinaryData {
const binaryKeyData = inputData.main[inputIndex]![itemIndex]!.binary;
const binaryKeyData = inputData.main[inputIndex]![itemIndex].binary;
if (binaryKeyData === undefined) {
throw new NodeOperationError(
node,
Expand Down Expand Up @@ -1079,7 +1079,7 @@ export async function getBinaryDataBuffer(
propertyName: string,
inputIndex: number,
): Promise<Buffer> {
const binaryData = inputData.main[inputIndex]![itemIndex]!.binary![propertyName]!;
const binaryData = inputData.main[inputIndex]![itemIndex].binary![propertyName];
return await Container.get(BinaryDataService).getAsBuffer(binaryData);
}

Expand Down Expand Up @@ -1940,7 +1940,7 @@ export function getAdditionalKeys(
getAll(): Record<string, string> {
return getAllWorkflowExecutionMetadata(runExecutionData);
},
}
}
: undefined,
},
$vars: additionalData.variables,
Expand Down Expand Up @@ -3204,7 +3204,7 @@ const getFileSystemHelperFunctions = (node: INode): FileSystemHelperFunctions =>
? new NodeOperationError(node, error, {
message: `The file "${String(filePath)}" could not be accessed.`,
level: 'warning',
})
})
: error;
}
if (isFilePathBlocked(filePath as string)) {
Expand Down
6 changes: 3 additions & 3 deletions packages/core/src/WorkflowExecute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1575,9 +1575,9 @@ export class WorkflowExecute {
// array as this shows that the parent nodes executed but they did not have any
// data to pass on.
const inputsWithData = this.runExecutionData
.executionData!.waitingExecution[nodeName][firstRunIndex].main.map((data, index) =>
data === null ? null : index,
)
.executionData!.waitingExecution[
nodeName
][firstRunIndex].main.map((data, index) => (data === null ? null : index))
.filter((data) => data !== null);

if (requiredInputs !== undefined) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
:disabled="disabled"
:indeterminate="indeterminate"
:model-value="modelValue"
@update:modelValue="onUpdateModelValue"
@update:model-value="onUpdateModelValue"
>
<slot></slot>
<N8nInputLabel
Expand Down
Loading

0 comments on commit 372d5c7

Please sign in to comment.