mirror of
https://github.com/opelly27/streetmerchant.git
synced 2026-05-20 14:37:41 +00:00
chore: update dependencies (#874)
Additional linting fixes Signed-off-by: Jef LeCompte <jeffreylec@gmail.com>
This commit is contained in:
@@ -72,7 +72,6 @@ export async function extractPageContents(
|
||||
selector: Selector
|
||||
): Promise<string | null> {
|
||||
return page.evaluate((options: Selector) => {
|
||||
// eslint-disable-next-line no-undef
|
||||
const element: globalThis.HTMLElement | null = document.querySelector(
|
||||
options.selector
|
||||
);
|
||||
|
||||
+9
-11
@@ -57,7 +57,7 @@ async function lookup(browser: Browser, store: Store) {
|
||||
if (store.disableAdBlocker) {
|
||||
try {
|
||||
await disableBlockerInPage(page);
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
logger.error(error);
|
||||
}
|
||||
}
|
||||
@@ -66,10 +66,10 @@ async function lookup(browser: Browser, store: Store) {
|
||||
|
||||
try {
|
||||
statusCode = await lookupCard(browser, store, page, link);
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
logger.error(
|
||||
`✖ [${store.name}] ${link.brand} ${link.series} ${link.model} - ${
|
||||
error.message as string
|
||||
(error as Error).message
|
||||
}`
|
||||
);
|
||||
const client = await page.target().createCDPSession();
|
||||
@@ -122,11 +122,9 @@ async function lookupCard(
|
||||
logger.info(`${Print.inStock(link, store, true)}\n${givenUrl}`);
|
||||
|
||||
if (config.browser.open) {
|
||||
if (link.openCartAction === undefined) {
|
||||
await open(givenUrl);
|
||||
} else {
|
||||
await link.openCartAction(browser);
|
||||
}
|
||||
await (link.openCartAction === undefined
|
||||
? open(givenUrl)
|
||||
: link.openCartAction(browser));
|
||||
}
|
||||
|
||||
sendNotification(link, store);
|
||||
@@ -232,8 +230,8 @@ export async function tryLookupAndLoop(browser: Browser, store: Store) {
|
||||
try {
|
||||
await fetchLinks(store, browser);
|
||||
linkBuilderLastRunTimes[store.name] = Date.now();
|
||||
} catch (error) {
|
||||
logger.error(error.message);
|
||||
} catch (error: unknown) {
|
||||
logger.error((error as Error).message);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -241,7 +239,7 @@ export async function tryLookupAndLoop(browser: Browser, store: Store) {
|
||||
logger.debug(`[${store.name}] Starting lookup...`);
|
||||
try {
|
||||
await lookup(browser, store);
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
logger.error(error);
|
||||
}
|
||||
|
||||
|
||||
@@ -24,13 +24,10 @@ export function getProductLinksBuilder(options: LinksBuilderOptions) {
|
||||
for (let i = 0; i < productElements.length; i++) {
|
||||
const productElement = productElements.eq(i);
|
||||
const titleElement = productElement.find(options.titleSelector).first();
|
||||
let title: string;
|
||||
|
||||
if (options.titleAttribute) {
|
||||
title = titleElement.attr()?.[options.titleAttribute];
|
||||
} else {
|
||||
title = titleElement.text()?.replace(/\n/g, ' ').trim();
|
||||
}
|
||||
const title = options.titleAttribute
|
||||
? titleElement.attr()?.[options.titleAttribute]
|
||||
: titleElement.text()?.replace(/\n/g, ' ').trim();
|
||||
|
||||
if (!title) {
|
||||
continue;
|
||||
|
||||
@@ -73,7 +73,7 @@ export class NvidiaCart {
|
||||
cartUrl = await this.addToCartAndGetLocationRedirect(productId);
|
||||
|
||||
break;
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
logger.error(
|
||||
`✖ [nvidia] ${name} could not automatically add to cart, attempt ${
|
||||
i + 1
|
||||
@@ -82,7 +82,7 @@ export class NvidiaCart {
|
||||
);
|
||||
logger.debug(error);
|
||||
|
||||
lastError = error;
|
||||
lastError = error as Error;
|
||||
}
|
||||
}
|
||||
/* eslint-enable no-await-in-loop */
|
||||
@@ -96,11 +96,11 @@ export class NvidiaCart {
|
||||
logger.info(cartUrl);
|
||||
|
||||
await open(cartUrl);
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
logger.error(
|
||||
`✖ [nvidia] ${name} could not automatically add to cart, opening page`
|
||||
`✖ [nvidia] ${name} could not automatically add to cart, opening page`,
|
||||
error
|
||||
);
|
||||
logger.debug(error);
|
||||
|
||||
cartUrl = this.fallbackCartUrl;
|
||||
|
||||
@@ -142,8 +142,11 @@ export class NvidiaCart {
|
||||
|
||||
this.sessionToken = result.session_token;
|
||||
logger.debug(`ℹ [nvidia] session_token=${result.session_token}`);
|
||||
} catch (error) {
|
||||
const message: string = typeof error === 'object' ? error.message : error;
|
||||
} catch (error: unknown) {
|
||||
const message: string =
|
||||
typeof error === 'object'
|
||||
? (error as Error).message
|
||||
: (error as string);
|
||||
logger.error(`✖ [nvidia] ${message}`);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user