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:
@@ -56,14 +56,14 @@ export class GoogleSheetsV1 implements INodeType {
|
||||
}
|
||||
|
||||
const returnData: INodePropertyOptions[] = [];
|
||||
for (const sheet of responseData.sheets!) {
|
||||
if (sheet.properties!.sheetType !== 'GRID') {
|
||||
for (const entry of responseData.sheets!) {
|
||||
if (entry.properties!.sheetType !== 'GRID') {
|
||||
continue;
|
||||
}
|
||||
|
||||
returnData.push({
|
||||
name: sheet.properties!.title as string,
|
||||
value: sheet.properties!.sheetId as unknown as string,
|
||||
name: entry.properties!.title as string,
|
||||
value: entry.properties!.sheetId as unknown as string,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@ export class GoogleSheetsV1 implements INodeType {
|
||||
range = this.getNodeParameter('range', 0) as string;
|
||||
}
|
||||
|
||||
const options = this.getNodeParameter('options', 0, {}) as IDataObject;
|
||||
const options = this.getNodeParameter('options', 0, {});
|
||||
|
||||
const valueInputMode = (options.valueInputMode || 'RAW') as ValueInputOption;
|
||||
const valueRenderMode = (options.valueRenderMode || 'UNFORMATTED_VALUE') as ValueRenderOption;
|
||||
@@ -148,7 +148,7 @@ export class GoogleSheetsV1 implements INodeType {
|
||||
// TODO: Should add this data somewhere
|
||||
// TODO: Should have something like add metadata which does not get passed through
|
||||
|
||||
return this.prepareOutputData(items);
|
||||
return await this.prepareOutputData(items);
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
return this.prepareOutputData([{ json: { error: error.message } }]);
|
||||
@@ -163,7 +163,7 @@ export class GoogleSheetsV1 implements INodeType {
|
||||
await sheet.clearData(sheet.encodeRange(range));
|
||||
|
||||
const items = this.getInputData();
|
||||
return this.prepareOutputData(items);
|
||||
return await this.prepareOutputData(items);
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
return this.prepareOutputData([{ json: { error: error.message } }]);
|
||||
@@ -176,13 +176,13 @@ export class GoogleSheetsV1 implements INodeType {
|
||||
let responseData;
|
||||
for (let i = 0; i < this.getInputData().length; i++) {
|
||||
try {
|
||||
const spreadsheetId = this.getNodeParameter('sheetId', i) as string;
|
||||
const options = this.getNodeParameter('options', i, {}) as IDataObject;
|
||||
const sheetId = this.getNodeParameter('sheetId', i) as string;
|
||||
const iterationOptions = this.getNodeParameter('options', i, {});
|
||||
const simple = this.getNodeParameter('simple', 0) as boolean;
|
||||
const properties = { ...options };
|
||||
const properties = { ...iterationOptions };
|
||||
|
||||
if (options.tabColor) {
|
||||
const { red, green, blue } = hexToRgb(options.tabColor as string)!;
|
||||
if (iterationOptions.tabColor) {
|
||||
const { red, green, blue } = hexToRgb(iterationOptions.tabColor as string)!;
|
||||
properties.tabColor = { red: red / 255, green: green / 255, blue: blue / 255 };
|
||||
}
|
||||
|
||||
@@ -197,11 +197,11 @@ export class GoogleSheetsV1 implements INodeType {
|
||||
responseData = await googleApiRequest.call(
|
||||
this,
|
||||
'POST',
|
||||
`/v4/spreadsheets/${spreadsheetId}:batchUpdate`,
|
||||
`/v4/spreadsheets/${sheetId}:batchUpdate`,
|
||||
{ requests },
|
||||
);
|
||||
|
||||
if (simple === true) {
|
||||
if (simple) {
|
||||
Object.assign(responseData, responseData.replies[0].addSheet.properties);
|
||||
delete responseData.replies;
|
||||
}
|
||||
@@ -232,16 +232,16 @@ export class GoogleSheetsV1 implements INodeType {
|
||||
|
||||
for (const propertyName of Object.keys(deletePropertyToDimensions)) {
|
||||
if (toDelete[propertyName] !== undefined) {
|
||||
toDelete[propertyName]!.forEach((range) => {
|
||||
toDelete[propertyName]!.forEach((entry) => {
|
||||
requests.push({
|
||||
deleteDimension: {
|
||||
range: {
|
||||
sheetId: range.sheetId,
|
||||
sheetId: entry.sheetId,
|
||||
dimension: deletePropertyToDimensions[propertyName] as string,
|
||||
startIndex: range.startIndex,
|
||||
startIndex: entry.startIndex,
|
||||
endIndex:
|
||||
parseInt(range.startIndex.toString(), 10) +
|
||||
parseInt(range.amount.toString(), 10),
|
||||
parseInt(entry.startIndex.toString(), 10) +
|
||||
parseInt(entry.amount.toString(), 10),
|
||||
},
|
||||
},
|
||||
});
|
||||
@@ -252,7 +252,7 @@ export class GoogleSheetsV1 implements INodeType {
|
||||
const _data = await sheet.spreadsheetBatchUpdate(requests);
|
||||
|
||||
const items = this.getInputData();
|
||||
return this.prepareOutputData(items);
|
||||
return await this.prepareOutputData(items);
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
return this.prepareOutputData([{ json: { error: error.message } }]);
|
||||
@@ -314,14 +314,14 @@ export class GoogleSheetsV1 implements INodeType {
|
||||
// read
|
||||
// ----------------------------------
|
||||
try {
|
||||
const rawData = this.getNodeParameter('rawData', 0) as boolean;
|
||||
const rawData = this.getNodeParameter('rawData', 0);
|
||||
|
||||
const sheetData = await sheet.getData(sheet.encodeRange(range), valueRenderMode);
|
||||
|
||||
let returnData: IDataObject[];
|
||||
if (!sheetData) {
|
||||
returnData = [];
|
||||
} else if (rawData === true) {
|
||||
} else if (rawData) {
|
||||
const dataProperty = this.getNodeParameter('dataProperty', 0) as string;
|
||||
returnData = [
|
||||
{
|
||||
@@ -352,13 +352,13 @@ export class GoogleSheetsV1 implements INodeType {
|
||||
let responseData;
|
||||
for (let i = 0; i < this.getInputData().length; i++) {
|
||||
try {
|
||||
const sheetId = this.getNodeParameter('id', i) as string;
|
||||
const spreadsheetId = this.getNodeParameter('sheetId', i) as string;
|
||||
const id = this.getNodeParameter('id', i) as string;
|
||||
const sheetId = this.getNodeParameter('sheetId', i) as string;
|
||||
|
||||
const requests = [
|
||||
{
|
||||
deleteSheet: {
|
||||
sheetId,
|
||||
sheetId: id,
|
||||
},
|
||||
},
|
||||
];
|
||||
@@ -366,7 +366,7 @@ export class GoogleSheetsV1 implements INodeType {
|
||||
responseData = await googleApiRequest.call(
|
||||
this,
|
||||
'POST',
|
||||
`/v4/spreadsheets/${spreadsheetId}:batchUpdate`,
|
||||
`/v4/spreadsheets/${sheetId}:batchUpdate`,
|
||||
{ requests },
|
||||
);
|
||||
delete responseData.replies;
|
||||
@@ -387,11 +387,11 @@ export class GoogleSheetsV1 implements INodeType {
|
||||
// ----------------------------------
|
||||
const upsert = operation === 'upsert' ? true : false;
|
||||
try {
|
||||
const rawData = this.getNodeParameter('rawData', 0) as boolean;
|
||||
const rawData = this.getNodeParameter('rawData', 0);
|
||||
|
||||
const items = this.getInputData();
|
||||
|
||||
if (rawData === true) {
|
||||
if (rawData) {
|
||||
const dataProperty = this.getNodeParameter('dataProperty', 0) as string;
|
||||
|
||||
const updateData: ISheetUpdateData[] = [];
|
||||
@@ -427,7 +427,7 @@ export class GoogleSheetsV1 implements INodeType {
|
||||
// TODO: Should add this data somewhere
|
||||
// TODO: Should have something like add metadata which does not get passed through
|
||||
|
||||
return this.prepareOutputData(items);
|
||||
return await this.prepareOutputData(items);
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
return this.prepareOutputData([{ json: { error: error.message } }]);
|
||||
@@ -462,7 +462,7 @@ export class GoogleSheetsV1 implements INodeType {
|
||||
sheets: [] as IDataObject[],
|
||||
};
|
||||
|
||||
const options = this.getNodeParameter('options', i, {}) as IDataObject;
|
||||
const options = this.getNodeParameter('options', i, {});
|
||||
|
||||
if (Object.keys(sheetsUi).length) {
|
||||
const data = [];
|
||||
@@ -476,10 +476,10 @@ export class GoogleSheetsV1 implements INodeType {
|
||||
body.sheets = data;
|
||||
}
|
||||
|
||||
body.properties!.autoRecalc = options.autoRecalc
|
||||
body.properties.autoRecalc = options.autoRecalc
|
||||
? (options.autoRecalc as string)
|
||||
: undefined;
|
||||
body.properties!.locale = options.locale ? (options.locale as string) : undefined;
|
||||
body.properties.locale = options.locale ? (options.locale as string) : undefined;
|
||||
|
||||
responseData = await googleApiRequest.call(this, 'POST', `/v4/spreadsheets`, body);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user