fix(core): Remove linting exceptions in nodes-base, @typescript-eslint/no-unsafe-argument (no-changelog)

This commit is contained in:
Michael Kret
2023-02-28 05:39:43 +02:00
committed by GitHub
parent 3172ea376e
commit bb4db58819
560 changed files with 2227 additions and 1919 deletions

View File

@@ -2,7 +2,7 @@ import type { OptionsWithUri } from 'request';
import type { IExecuteFunctions, ILoadOptionsFunctions } from 'n8n-core';
import type { IDataObject, INodePropertyOptions } from 'n8n-workflow';
import type { IDataObject, INodePropertyOptions, JsonObject } from 'n8n-workflow';
import { NodeApiError } from 'n8n-workflow';
export async function homeAssistantApiRequest(
@@ -32,7 +32,7 @@ export async function homeAssistantApiRequest(
};
options = Object.assign({}, options, option);
if (Object.keys(options.body).length === 0) {
if (Object.keys(options.body as IDataObject).length === 0) {
delete options.body;
}
try {
@@ -40,7 +40,7 @@ export async function homeAssistantApiRequest(
return await this.helpers.request(options);
}
} catch (error) {
throw new NodeApiError(this.getNode(), error);
throw new NodeApiError(this.getNode(), error as JsonObject);
}
}
@@ -72,13 +72,18 @@ export async function getHomeAssistantServices(
if (domain === '') {
// If no domain specified return domains
const domains = services.map(({ domain: service }: IDataObject) => service as string).sort();
returnData.push(...domains.map((service: string) => ({ name: service, value: service })));
returnData.push(
...(domains.map((service: string) => ({
name: service,
value: service,
})) as INodePropertyOptions[]),
);
return returnData;
} else {
// If we have a domain, return all relevant services
const domainServices = services.filter((service: IDataObject) => service.domain === domain);
for (const domainService of domainServices) {
for (const [serviceID, value] of Object.entries(domainService.services)) {
for (const [serviceID, value] of Object.entries(domainService.services as IDataObject)) {
const serviceProperties = value as IDataObject;
const serviceName = serviceProperties.description || serviceID;
returnData.push({