В функции 'deleteQueryBatch' в документации firebase ,
exports.batchDelete = function deleteQueryBatch(db, query, batchSize, resolve, reject)
{
query.get()
.then((snapshot) => {
// When there are no documents left, we are done
if (snapshot.size == 0) {
return 0;
}
// Delete documents in a batch
var batch = db.batch();
snapshot.docs.forEach((doc) => {
batch.delete(doc.ref);
});
return batch.commit().then(() => {
return snapshot.size;
});
}).then((numDeleted) => {
if (numDeleted === 0) {
resolve();
return;
}
// Recurse on the next process tick, to avoid
// exploding the stack.
process.nextTick(() => {
deleteQueryBatch(db, query, batchSize, resolve, reject);
});
})
.catch(reject);
}
я вижу следующие ошибки и предупреждения ESLint.
Expected '===' and instead saw '=='. (eqeqeq)
Avoid nesting promises. (promise/no-nesting)
Each then() should return a value or throw (promise/always-return)
Я получилизбавиться от первой ошибки, заменив указанный оператор, однако я не уверен, как решить две другие.