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

@@ -395,7 +395,7 @@ export class SurveyMonkeyTrigger implements INodeType {
);
if (
webhookDetails.subscription_url === webhookUrl &&
idsExist(webhookDetails.object_ids as string[], ids as string[]) &&
idsExist(webhookDetails.object_ids as string[], ids) &&
webhookDetails.event_type === event
) {
// Set webhook-id to be sure that it can be deleted
@@ -574,7 +574,7 @@ export class SurveyMonkeyTrigger implements INodeType {
responseQuestions.set(heading, answers.get(question.id)![0].text as string);
} else {
const results: IDataObject = {};
const keys = (question.answers.rows as IRow[]).map((e) => e.text) as string[];
const keys = (question.answers.rows as IRow[]).map((e) => e.text);
const values = answers.get(question.id)?.map((e) => e.text) as string[];
for (let i = 0; i < keys.length; i++) {
// if for some reason there are questions texts repeted add the index to the key
@@ -591,13 +591,12 @@ export class SurveyMonkeyTrigger implements INodeType {
if (question.family === 'single_choice') {
const other = question.answers.other as IOther;
if (
other &&
other.visible &&
other?.visible &&
other.is_answer_choice &&
answers.get(question.id)![0].other_id
) {
responseQuestions.set(heading, answers.get(question.id)![0].text as string);
} else if (other && other.visible && !other.is_answer_choice) {
} else if (other?.visible && !other.is_answer_choice) {
const choiceId = answers.get(question.id)![0].choice_id;
const choice = (question.answers.choices as IChoice[]).filter(
@@ -621,9 +620,9 @@ export class SurveyMonkeyTrigger implements INodeType {
const choiceIds = answers.get(question.id)?.map((e) => e.choice_id);
const value = (question.answers.choices as IChoice[])
.filter((e) => choiceIds?.includes(e.id))
.map((e) => e.text) as string[];
.map((e) => e.text);
// if "Add an "Other" Answer Option for Comments" is active and was selected
if (other && other.is_answer_choice && other.visible) {
if (other?.is_answer_choice && other.visible) {
const text = answers.get(question.id)?.find((e) => e.other_id === other.id)
?.text as string;
value.push(text);
@@ -641,11 +640,11 @@ export class SurveyMonkeyTrigger implements INodeType {
const rowIds = answers.get(question.id)?.map((e) => e.row_id) as string[];
const rowsValues = (question.answers.rows as IRow[])
.filter((e) => rowIds!.includes(e.id as string))
.filter((e) => rowIds.includes(e.id))
.map((e) => e.text);
const choicesValues = (question.answers.choices as IChoice[])
.filter((e) => choiceIds!.includes(e.id as string))
.filter((e) => choiceIds.includes(e.id))
.map((e) => e.text);
for (let i = 0; i < rowsValues.length; i++) {
@@ -660,7 +659,7 @@ export class SurveyMonkeyTrigger implements INodeType {
}
// the comment then add the comment
const other = question.answers.other as IOther;
if (other !== undefined && other.visible) {
if (other?.visible) {
results.comment = answers.get(question.id)?.filter((e) => e.other_id)[0].text;
}
@@ -668,13 +667,13 @@ export class SurveyMonkeyTrigger implements INodeType {
} else {
const choiceIds = answers.get(question.id)?.map((e) => e.choice_id);
const value = (question.answers.choices as IChoice[])
.filter((e) => choiceIds!.includes(e.id as string))
.filter((e) => choiceIds!.includes(e.id))
.map((e) => (e.text === '' ? e.weight : e.text))[0];
responseQuestions.set(heading, value);
// if "Add an Other Answer Option for Comments" is active then add comment to the answer
const other = question.answers.other as IOther;
if (other !== undefined && other.visible) {
if (other?.visible) {
const response: IDataObject = {};
//const questionName = (question.answers.other as IOther).text as string;
const text = answers.get(question.id)?.filter((e) => e.other_id)[0].text;