I am encountering issues while attempting to upload my function to Firebase, specifically receiving two errors as follows:
39:1 error This line has a length of 123. Maximum allowed is 80 max-len
39:111 warning 'context' is defined but never used @typescript-eslint/no-unused-vars
48:1 error This line has a length of 118. Maximum allowed is 80 max-len
Below is the code that I want to upload:
export const onConversationUpdated = functions.firestore.document("Conversations/{chatID}").onUpdate((change, context) => {
let data = change?.after.data();
if (data) {
let members = data.members;
let lastMessage = data.messages[data.messages.length - 1];
for (let index = 0; index < members.length; index++) {
let uid = members[index];
let remainingUserIDs = members
.filter((u:string) => u != uid);
remainingUserIDs.forEach((u:string) => {
return admin.firestore().collection("meinprofilsettings").doc(uid).collection("Conversations").doc(u).update({
"lastMessage": lastMessage.message,
"timestamp": lastMessage.timestamp,
"type": lastMessage.type,
"unseenCount": admin.firestore.FieldValue.increment(1),
});
});
}
}
return null;
});
The problematic lines are 39 where it starts and 48 which contains "remainingUserIDs.forEach((u:string) => {....."
If anyone can provide guidance or assistance, please feel free to leave a comment with any additional questions.