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:
@@ -1,8 +1,12 @@
|
||||
import { IExecuteFunctions } from 'n8n-core';
|
||||
import { ISheetUpdateData, SheetProperties } from '../../helpers/GoogleSheets.types';
|
||||
import {
|
||||
ISheetUpdateData,
|
||||
SheetProperties,
|
||||
ValueInputOption,
|
||||
ValueRenderOption,
|
||||
} from '../../helpers/GoogleSheets.types';
|
||||
import { IDataObject, INodeExecutionData, NodeOperationError } from 'n8n-workflow';
|
||||
import { GoogleSheet } from '../../helpers/GoogleSheet';
|
||||
import { ValueInputOption, ValueRenderOption } from '../../helpers/GoogleSheets.types';
|
||||
import { untilSheetSelected } from '../../helpers/GoogleSheets.utils';
|
||||
import { cellFormat, handlingExtraData, locationDefine } from './commonDescription';
|
||||
|
||||
@@ -166,21 +170,21 @@ export async function execute(
|
||||
const valueInputMode = this.getNodeParameter('options.cellFormat', 0, 'RAW') as ValueInputOption;
|
||||
const range = `${sheetName}!A:Z`;
|
||||
|
||||
const options = this.getNodeParameter('options', 0, {}) as IDataObject;
|
||||
const options = this.getNodeParameter('options', 0, {});
|
||||
|
||||
const valueRenderMode = (options.valueRenderMode || 'UNFORMATTED_VALUE') as ValueRenderOption;
|
||||
|
||||
const locationDefine = ((options.locationDefine as IDataObject) || {}).values as IDataObject;
|
||||
const locationDefineOption = (options.locationDefine as IDataObject)?.values as IDataObject;
|
||||
|
||||
let headerRow = 0;
|
||||
let firstDataRow = 1;
|
||||
|
||||
if (locationDefine) {
|
||||
if (locationDefine.headerRow) {
|
||||
headerRow = parseInt(locationDefine.headerRow as string, 10) - 1;
|
||||
if (locationDefineOption) {
|
||||
if (locationDefineOption.headerRow) {
|
||||
headerRow = parseInt(locationDefineOption.headerRow as string, 10) - 1;
|
||||
}
|
||||
if (locationDefine.firstDataRow) {
|
||||
firstDataRow = parseInt(locationDefine.firstDataRow as string, 10) - 1;
|
||||
if (locationDefineOption.firstDataRow) {
|
||||
firstDataRow = parseInt(locationDefineOption.firstDataRow as string, 10) - 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -223,13 +227,13 @@ export async function execute(
|
||||
const data: IDataObject[] = [];
|
||||
|
||||
if (dataMode === 'autoMapInputData') {
|
||||
const handlingExtraData = (options.handlingExtraData as string) || 'insertInNewColumn';
|
||||
if (handlingExtraData === 'ignoreIt') {
|
||||
const handlingExtraDataOption = (options.handlingExtraData as string) || 'insertInNewColumn';
|
||||
if (handlingExtraDataOption === 'ignoreIt') {
|
||||
data.push(items[i].json);
|
||||
}
|
||||
if (handlingExtraData === 'error') {
|
||||
if (handlingExtraDataOption === 'error') {
|
||||
Object.keys(items[i].json).forEach((key) => {
|
||||
if (columnNames.includes(key) === false) {
|
||||
if (!columnNames.includes(key)) {
|
||||
throw new NodeOperationError(this.getNode(), `Unexpected fields in node input`, {
|
||||
itemIndex: i,
|
||||
description: `The input field '${key}' doesn't match any column in the Sheet. You can ignore this by changing the 'Handling extra data' field, which you can find under 'Options'.`,
|
||||
@@ -238,9 +242,9 @@ export async function execute(
|
||||
});
|
||||
data.push(items[i].json);
|
||||
}
|
||||
if (handlingExtraData === 'insertInNewColumn') {
|
||||
if (handlingExtraDataOption === 'insertInNewColumn') {
|
||||
Object.keys(items[i].json).forEach((key) => {
|
||||
if (columnNames.includes(key) === false) {
|
||||
if (!columnNames.includes(key)) {
|
||||
newColumns.add(key);
|
||||
}
|
||||
});
|
||||
@@ -255,7 +259,7 @@ export async function execute(
|
||||
if (entry.column === 'newColumn') {
|
||||
const columnName = entry.columnName as string;
|
||||
|
||||
if (columnNames.includes(columnName) === false) {
|
||||
if (!columnNames.includes(columnName)) {
|
||||
newColumns.add(columnName);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user