Add no-misused/floating-promises lint rule

This commit is contained in:
Fedor Indutny 2022-12-21 10:41:48 -08:00 committed by GitHub
parent 1a68c3db62
commit ed271d92ea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
150 changed files with 1296 additions and 991 deletions

View file

@ -8,6 +8,7 @@ import * as log from '../logging/log';
import * as Errors from '../types/errors';
import { clearTimeoutIfNecessary } from './clearTimeoutIfNecessary';
import { MINUTE } from './durations';
import { drop } from './drop';
declare global {
// We want to extend `window`'s properties, so we need an interface.
@ -67,9 +68,11 @@ export function createBatcher<ItemType>(
const itemsRef = items;
items = [];
queue.add(async () => {
await options.processBatch(itemsRef);
});
drop(
queue.add(async () => {
await options.processBatch(itemsRef);
})
);
}
function add(item: ItemType) {