eslint: add github/array-foreach rule

This commit is contained in:
undefined committed 2023-10-20 20:59:48 +08:00
1 parent 9901ffa62d
commit 335a272db4
21 files changed
+59 -51

No files matched your search

+1 -1
View File
@@ -142,7 +142,7 @@ class DomainModel {
const affected = await UserModel.getMulti({ _id: { $in: uid } })
.project<{ _id: number, mail: string, uname: string }>({ mail: 1, uname: 1 })
.toArray();
affected.forEach((udoc) => deleteUserCache(udoc));
for (const udoc of affected) deleteUserCache(udoc);
return await collUser.updateMany({ domainId, uid: { $in: uid } }, { $set: { role } }, { upsert: true });
}
+1 -1
View File
@@ -19,7 +19,7 @@ export async function add(data: Partial<OplogDoc> & { type: string }): Promise<O
function safeKeys(data: any) {
if (['string', 'number', 'boolean'].includes(typeof data)) return data;
if (data instanceof Array) data.forEach(safeKeys);
if (data instanceof Array) for (const d of data) safeKeys(d);
else if (data instanceof ObjectId) return data;
else if (data instanceof Object) {
for (const key in data) {