refactor(core): Remove linting exceptions in nodes-base (#4794)

*  enabled array-type

*  await-thenable on

*  ban-types on

*  default-param-last on

*  dot-notation on

*  member-delimiter-style on

*  no-duplicate-imports on

*  no-empty-interface on

*  no-floating-promises on

*  no-for-in-array on

*  no-invalid-void-type on

*  no-loop-func on

*  no-shadow on

*  ban-ts-comment re enabled

*  @typescript-eslint/lines-between-class-members on

* address my own comment

* @typescript-eslint/return-await on

* @typescript-eslint/promise-function-async on

* @typescript-eslint/no-unnecessary-boolean-literal-compare on

* @typescript-eslint/no-unnecessary-type-assertion on

* prefer-const on

* @typescript-eslint/prefer-optional-chain on

Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
This commit is contained in:
Michael Kret
2022-12-02 22:54:28 +02:00
committed by GitHub
parent 8101c05d6f
commit 61e26804ba
796 changed files with 3735 additions and 2847 deletions

View File

@@ -279,7 +279,7 @@ export class Magento2 implements INodeType {
async getFilterableCustomerAttributes(
this: ILoadOptionsFunctions,
): Promise<INodePropertyOptions[]> {
return getProductAttributes.call(this, (attribute) => attribute.is_filterable === true);
return getProductAttributes.call(this, (attribute) => attribute.is_filterable);
},
async getProductAttributes(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
return getProductAttributes.call(this);
@@ -295,7 +295,7 @@ export class Magento2 implements INodeType {
async getSortableProductAttributes(
this: ILoadOptionsFunctions,
): Promise<INodePropertyOptions[]> {
return getProductAttributes.call(this, (attribute) => attribute.used_for_sort_by === true);
return getProductAttributes.call(this, (attribute) => attribute.used_for_sort_by);
},
async getOrderAttributes(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
return getOrderFields()
@@ -402,7 +402,7 @@ export class Magento2 implements INodeType {
if (operation === 'getAll') {
//https://magento.redoc.ly/2.3.7-admin/tag/customerssearch
const filterType = this.getNodeParameter('filterType', i) as string;
const sort = this.getNodeParameter('options.sort', i, {}) as {
const sortOption = this.getNodeParameter('options.sort', i, {}) as {
sort: [{ direction: string; field: string }];
};
const returnAll = this.getNodeParameter('returnAll', 0);
@@ -411,7 +411,7 @@ export class Magento2 implements INodeType {
if (filterType === 'manual') {
const filters = this.getNodeParameter('filters', i) as { conditions: Filter[] };
const matchType = this.getNodeParameter('matchType', i) as string;
qs = getFilterQuery(Object.assign(filters, { matchType }, sort));
qs = getFilterQuery(Object.assign(filters, { matchType }, sortOption));
} else if (filterType === 'json') {
const filterJson = this.getNodeParameter('filterJson', i) as string;
if (validateJSON(filterJson) !== undefined) {
@@ -426,14 +426,14 @@ export class Magento2 implements INodeType {
search_criteria: {},
};
if (Object.keys(sort).length !== 0) {
if (Object.keys(sortOption).length !== 0) {
qs.search_criteria = {
sort_orders: sort.sort,
sort_orders: sortOption.sort,
};
}
}
if (returnAll === true) {
if (returnAll) {
qs.search_criteria!.page_size = 100;
responseData = await magentoApiRequestAllItems.call(
this,
@@ -581,7 +581,7 @@ export class Magento2 implements INodeType {
if (operation === 'getAll') {
//https://magento.redoc.ly/2.3.7-admin/tag/orders#operation/salesOrderRepositoryV1GetListGet
const filterType = this.getNodeParameter('filterType', i) as string;
const sort = this.getNodeParameter('options.sort', i, {}) as {
const sortOption = this.getNodeParameter('options.sort', i, {}) as {
sort: [{ direction: string; field: string }];
};
const returnAll = this.getNodeParameter('returnAll', 0);
@@ -590,7 +590,7 @@ export class Magento2 implements INodeType {
if (filterType === 'manual') {
const filters = this.getNodeParameter('filters', i) as { conditions: Filter[] };
const matchType = this.getNodeParameter('matchType', i) as string;
qs = getFilterQuery(Object.assign(filters, { matchType }, sort));
qs = getFilterQuery(Object.assign(filters, { matchType }, sortOption));
} else if (filterType === 'json') {
const filterJson = this.getNodeParameter('filterJson', i) as string;
if (validateJSON(filterJson) !== undefined) {
@@ -604,14 +604,14 @@ export class Magento2 implements INodeType {
qs = {
search_criteria: {},
};
if (Object.keys(sort).length !== 0) {
if (Object.keys(sortOption).length !== 0) {
qs.search_criteria = {
sort_orders: sort.sort,
sort_orders: sortOption.sort,
};
}
}
if (returnAll === true) {
if (returnAll) {
qs.search_criteria!.page_size = 100;
responseData = await magentoApiRequestAllItems.call(
this,
@@ -703,7 +703,7 @@ export class Magento2 implements INodeType {
if (operation === 'getAll') {
//https://magento.redoc.ly/2.3.7-admin/tag/customerssearch
const filterType = this.getNodeParameter('filterType', i) as string;
const sort = this.getNodeParameter('options.sort', i, {}) as {
const sortOption = this.getNodeParameter('options.sort', i, {}) as {
sort: [{ direction: string; field: string }];
};
const returnAll = this.getNodeParameter('returnAll', 0);
@@ -712,7 +712,7 @@ export class Magento2 implements INodeType {
if (filterType === 'manual') {
const filters = this.getNodeParameter('filters', i) as { conditions: Filter[] };
const matchType = this.getNodeParameter('matchType', i) as string;
qs = getFilterQuery(Object.assign(filters, { matchType }, sort));
qs = getFilterQuery(Object.assign(filters, { matchType }, sortOption));
} else if (filterType === 'json') {
const filterJson = this.getNodeParameter('filterJson', i) as string;
if (validateJSON(filterJson) !== undefined) {
@@ -726,14 +726,14 @@ export class Magento2 implements INodeType {
qs = {
search_criteria: {},
};
if (Object.keys(sort).length !== 0) {
if (Object.keys(sortOption).length !== 0) {
qs.search_criteria = {
sort_orders: sort.sort,
sort_orders: sortOption.sort,
};
}
}
if (returnAll === true) {
if (returnAll) {
qs.search_criteria!.page_size = 100;
responseData = await magentoApiRequestAllItems.call(
this,