chore: update dependencies (#874)

Additional linting fixes

Signed-off-by: Jef LeCompte <jeffreylec@gmail.com>
This commit is contained in:
Jef LeCompte
2020-11-21 10:55:03 -05:00
committed by GitHub
parent f6f5c6bfe7
commit 9ad9793dc1
18 changed files with 924 additions and 765 deletions
+874 -711
View File
File diff suppressed because it is too large Load Diff
+5 -5
View File
@@ -42,11 +42,11 @@
"play-sound": "^1.1.3",
"puppeteer": "^5.5.0",
"puppeteer-extra": "^3.1.15",
"puppeteer-extra-plugin-adblocker": "^2.11.8",
"puppeteer-extra-plugin-adblocker": "^2.11.9",
"puppeteer-extra-plugin-block-resources": "^2.2.7",
"puppeteer-extra-plugin-stealth": "^2.6.5",
"pushover-notifications": "^1.2.2",
"twilio": "^3.51.0",
"twilio": "^3.52.0",
"twitch": "^4.3.0",
"twitch-auth": "^4.3.0",
"twitch-chat-client": "^4.3.0",
@@ -56,7 +56,7 @@
"devDependencies": {
"@types/async": "^3.2.4",
"@types/cheerio": "^0.22.22",
"@types/node": "^14.14.8",
"@types/node": "^14.14.9",
"@types/node-fetch": "^2.5.7",
"@types/node-notifier": "^8.0.0",
"@types/nodemailer": "^6.4.0",
@@ -65,9 +65,9 @@
"husky": "^4.3.0",
"nodemon": "^2.0.6",
"ts-node": "^9.0.0",
"typescript": "^4.0.5",
"typescript": "^4.1.2",
"webpack": "^5.6.0",
"xo": "^0.33.1"
"xo": "^0.35.0"
},
"xo": {
"prettier": true,
+1 -1
View File
@@ -94,7 +94,7 @@ async function stopAndExit() {
async function loopMain() {
try {
await main();
} catch (error) {
} catch (error: unknown) {
logger.error(
'✖ something bad happened, resetting streetmerchant in 5 seconds',
error
+1 -1
View File
@@ -38,7 +38,7 @@ export function sendDiscordMessage(link: Link, store: Store) {
await Promise.all(promises);
logger.info('✔ discord message sent');
} catch (error) {
} catch (error: unknown) {
logger.error("✖ couldn't send discord message", error);
}
})();
+1 -1
View File
@@ -44,7 +44,7 @@ export function sendMqttMessage(link: Link, store: Store) {
try {
client.publish(topic, message, pubOptions);
logger.info('✔ mqtt message sent');
} catch (error) {
} catch (error: unknown) {
logger.error("✖ couldn't send mqtt message", error);
}
})();
+4 -3
View File
@@ -60,9 +60,10 @@ const adjustLightsWithAPI = (hueBridge: Api) => {
.then((allLights: any[]) => {
allLights.forEach((light: any) => {
logger.debug('adjusting specified lights');
(hueBridge.lights.setLightState(light, lightState) as Promise<
any
>).catch((error: Error) => {
(hueBridge.lights.setLightState(
light,
lightState
) as Promise<any>).catch((error: Error) => {
logger.error('Failed to adjust specified lights.');
logger.error(error);
throw error;
+1 -1
View File
@@ -27,7 +27,7 @@ export function sendSlackMessage(link: Link, store: Store) {
}
logger.info('✔ slack message sent');
} catch (error) {
} catch (error: unknown) {
logger.error("✖ couldn't send slack message", error);
}
})();
+1 -1
View File
@@ -26,7 +26,7 @@ export function sendTelegramMessage(link: Link, store: Store) {
)
);
logger.info('✔ telegram message sent');
} catch (error) {
} catch (error: unknown) {
logger.error("✖ couldn't send telegram message", error);
}
}
+1 -1
View File
@@ -25,7 +25,7 @@ export function sendTwilioMessage(link: Link, store: Store) {
to: twilio.to
});
logger.info('✔ twilio message sent');
} catch (error) {
} catch (error: unknown) {
logger.error("✖ couldn't send twilio message", error);
}
})();
+1 -1
View File
@@ -65,7 +65,7 @@ chatClient.onJoin((channel: string, user: string) => {
try {
chatClient.say(channel, message);
logger.info('✔ twitch message sent');
} catch (error) {
} catch (error: unknown) {
logger.error("✖ couldn't send twitch message", error);
}
}
-1
View File
@@ -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
View File
@@ -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);
}
+3 -6
View File
@@ -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;
+10 -7
View File
@@ -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}`);
}
}
+1 -3
View File
@@ -4,9 +4,7 @@ declare module 'play-sound' {
player?: string;
}
export interface PlayOptions {
[key: string]: any;
}
export type PlayOptions = Record<string, any>;
export interface PlaySound {
player: string;
+6 -6
View File
@@ -1,5 +1,5 @@
declare module '@jef/pushbullet' {
export type DeviceParams = string | number | Record<string, any>;
export type DeviceParameters = string | number | Record<string, any>;
export type PushBulletCallback =
| ((error: Error) => void)
@@ -38,26 +38,26 @@ declare module '@jef/pushbullet' {
);
deleteDevice(deviceIden: string, callback: PushBulletCallback);
note(
deviceParams: DeviceParams,
deviceParameters: DeviceParameters,
title: string,
body: string,
callback: PushBulletCallback
);
link(
deviceParams: DeviceParams,
deviceParameters: DeviceParameters,
name: string,
url: string,
body: string,
callback: PushBulletCallback
);
file(
deviceParams: DeviceParams,
deviceParameters: DeviceParameters,
filePath: string,
message: string,
callback: PushBulletCallback
);
dismissPush(pushIden: DeviceParams, callback: PushBulletCallback);
deletePush(pushIden: DeviceParams, callback: PushBulletCallback);
dismissPush(pushIden: DeviceParameters, callback: PushBulletCallback);
deletePush(pushIden: DeviceParameters, callback: PushBulletCallback);
deleteAllPushes(callback: PushBulletCallback);
history(options: HistoryOptions, callback: PushBulletCallback);
history(callback: PushBulletCallback);
+1 -1
View File
@@ -62,7 +62,7 @@ export async function usingPage<T>(
} finally {
try {
await closePage(page);
} catch (error) {
} catch (error: unknown) {
logger.error(error);
}
}
+4 -4
View File
@@ -13,7 +13,7 @@ import {join, normalize} from 'path';
const approot = join(__dirname, '../../');
const webroot = join(approot, './web');
const contentTypeMap: {[key: string]: string} = {
const contentTypeMap: Record<string, string> = {
css: 'text/css',
htm: 'text/html',
html: 'text/html',
@@ -49,8 +49,8 @@ function sendFile(
stream.on('end', () => response.end());
stream.pipe(response);
} catch (error) {
sendError(response, error);
} catch (error: unknown) {
sendError(response, (error as Error).message);
}
}
@@ -182,6 +182,6 @@ export async function stopAPIServer() {
return;
}
resolve();
resolve(null);
});
}