mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
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:
@@ -177,16 +177,14 @@ export function prepareSheetData(
|
||||
|
||||
export function getRangeString(sheetName: string, options: RangeDetectionOptions) {
|
||||
if (options.rangeDefinition === 'specifyRangeA1') {
|
||||
return options.range ? `${sheetName}!${options.range as string}` : sheetName;
|
||||
return options.range ? `${sheetName}!${options.range}` : sheetName;
|
||||
}
|
||||
return sheetName;
|
||||
}
|
||||
|
||||
export async function getExistingSheetNames(sheet: GoogleSheet) {
|
||||
const { sheets } = await sheet.spreadsheetGetSheets();
|
||||
return ((sheets as IDataObject[]) || []).map(
|
||||
(sheet) => ((sheet.properties as IDataObject) || {}).title,
|
||||
);
|
||||
return ((sheets as IDataObject[]) || []).map((entry) => (entry.properties as IDataObject)?.title);
|
||||
}
|
||||
|
||||
export function mapFields(this: IExecuteFunctions, inputSize: number) {
|
||||
@@ -213,7 +211,7 @@ export async function autoMapInputData(
|
||||
) {
|
||||
const returnData: IDataObject[] = [];
|
||||
const [sheetName, _sheetRange] = sheetNameWithRange.split('!');
|
||||
const locationDefine = ((options.locationDefine as IDataObject) || {}).values as IDataObject;
|
||||
const locationDefine = (options.locationDefine as IDataObject)?.values as IDataObject;
|
||||
const handlingExtraData = (options.handlingExtraData as string) || 'insertInNewColumn';
|
||||
|
||||
let headerRow = 1;
|
||||
@@ -242,7 +240,7 @@ export async function autoMapInputData(
|
||||
|
||||
items.forEach((item) => {
|
||||
Object.keys(item.json).forEach((key) => {
|
||||
if (key !== ROW_NUMBER && columnNames.includes(key) === false) {
|
||||
if (key !== ROW_NUMBER && !columnNames.includes(key)) {
|
||||
newColumns.add(key);
|
||||
}
|
||||
});
|
||||
@@ -268,7 +266,7 @@ export async function autoMapInputData(
|
||||
if (handlingExtraData === 'error') {
|
||||
items.forEach((item, itemIndex) => {
|
||||
Object.keys(item.json).forEach((key) => {
|
||||
if (columnNames.includes(key) === false) {
|
||||
if (!columnNames.includes(key)) {
|
||||
throw new NodeOperationError(this.getNode(), `Unexpected fields in node input`, {
|
||||
itemIndex,
|
||||
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'.`,
|
||||
@@ -285,8 +283,8 @@ export async function autoMapInputData(
|
||||
export function sortLoadOptions(data: INodePropertyOptions[] | INodeListSearchItems[]) {
|
||||
const returnData = [...data];
|
||||
returnData.sort((a, b) => {
|
||||
const aName = (a.name as string).toLowerCase();
|
||||
const bName = (b.name as string).toLowerCase();
|
||||
const aName = a.name.toLowerCase();
|
||||
const bName = b.name.toLowerCase();
|
||||
if (aName < bName) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user