Add eslint rules for dealing with promises

This commit is contained in:
Ajay
2022-09-07 20:01:11 -04:00
parent 0ca134dc8f
commit bd7dfc63ff
15 changed files with 79 additions and 63 deletions

View File

@@ -53,7 +53,7 @@ async function getAndSplit<T, U extends string>(fetchFromDB: (values: U[]) => Pr
if (valuesToBeFetched.length > 0) {
data = await fetchFromDB(valuesToBeFetched);
new Promise(() => {
void new Promise(() => {
const newResults: Record<string, T[]> = {};
for (const item of data) {
const splitValue = (item as unknown as Record<string, string>)[splitKey];

View File

@@ -28,7 +28,7 @@ let exportClient: RedisSB = {
if (config.redis?.enabled) {
Logger.info("Connected to redis");
const client = createClient(config.redis);
client.connect();
void client.connect(); // void as we don't care about the promise
exportClient = client as RedisSB;
const get = client.get.bind(client);
@@ -40,7 +40,7 @@ if (config.redis?.enabled) {
}).catch((err) => reject(err));
});
exportClient.increment = (key) => new Promise((resolve, reject) =>
client.multi()
void client.multi()
.incr(key)
.expire(key, 60)
.exec()

View File

@@ -39,8 +39,8 @@ export class YouTubeAPI {
}
const apiResult = data as APIVideoData;
DiskCache.set(cacheKey, apiResult)
.catch((err: any) => Logger.warn(err))
.then(() => Logger.debug(`YouTube API: video information cache set for: ${videoID}`));
.then(() => Logger.debug(`YouTube API: video information cache set for: ${videoID}`))
.catch((err: any) => Logger.warn(err));
return { err: false, data: apiResult };
} else {