chore: add sort linting (#169)

This commit is contained in:
Jef LeCompte
2020-09-22 19:31:49 -04:00
committed by GitHub
parent 6409646d57
commit cf0eac2b23
34 changed files with 300 additions and 171 deletions
+3 -3
View File
@@ -1,5 +1,5 @@
import notifier from 'node-notifier';
import {Link} from '../store/model';
import notifier from 'node-notifier';
export function sendDesktopNotification(cartUrl: string, link: Link) {
(async () => {
@@ -7,8 +7,8 @@ export function sendDesktopNotification(cartUrl: string, link: Link) {
const message = cartUrl;
notifier.notify({
title,
message
message,
title
});
})();
}
+2 -2
View File
@@ -1,7 +1,7 @@
import {Webhook, MessageBuilder} from 'discord-webhook-node';
import {MessageBuilder, Webhook} from 'discord-webhook-node';
import {Config} from '../config';
import {Logger} from '../logger';
import {Link} from '../store/model';
import {Logger} from '../logger';
const hook = new Webhook(Config.notifications.discord.webHookUrl);
const notifyGroup = Config.notifications.discord.notifyGroup;
+9 -9
View File
@@ -1,24 +1,24 @@
import nodemailer from 'nodemailer';
import Mail from 'nodemailer/lib/mailer';
import {Config} from '../config';
import {Logger} from '../logger';
import {Link} from '../store/model';
import {Logger} from '../logger';
import Mail from 'nodemailer/lib/mailer';
import nodemailer from 'nodemailer';
const email = Config.notifications.email;
const subject = 'NVIDIA - BUY NOW';
const transporter = nodemailer.createTransport({
service: 'gmail',
auth: {
user: email.username,
pass: email.password
}
pass: email.password,
user: email.username
},
service: 'gmail'
});
const mailOptions: Mail.Options = {
from: email.username,
to: email.username,
subject
subject,
to: email.username
};
export function sendEmail(cartUrl: string, link: Link) {
+9 -10
View File
@@ -1,14 +1,13 @@
import {Config} from '../config';
import {sendEmail} from './email';
import {sendSMS} from './sms';
import {playSound} from './sound';
import {sendSlackMessage} from './slack';
import {sendPushoverNotification} from './pushover';
import {sendTelegramMessage} from './telegram';
import {sendDiscordMessage} from './discord';
import {sendDesktopNotification} from './desktop';
import {Link} from '../store/model';
import {playSound} from './sound';
import {sendDesktopNotification} from './desktop';
import {sendDiscordMessage} from './discord';
import {sendEmail} from './email';
import {sendPushoverNotification} from './pushover';
import {sendSMS} from './sms';
import {sendSlackMessage} from './slack';
import {sendTelegramMessage} from './telegram';
const notifications = Config.notifications;
@@ -36,7 +35,7 @@ export function sendNotification(cartUrl: string, link: Link) {
}
}
if (notifications.pushover.token && notifications.pushover.user) {
if (notifications.pushover.token && notifications.pushover.username) {
sendPushoverNotification(cartUrl);
}
+3 -3
View File
@@ -1,11 +1,11 @@
import Push from 'pushover-notifications';
import {Config} from '../config';
import {Logger} from '../logger';
import Push from 'pushover-notifications';
const pushover = Config.notifications.pushover;
const push = new Push({
user: pushover.user,
token: pushover.token
token: pushover.token,
user: pushover.username
});
export function sendPushoverNotification(cartUrl: string) {
+2 -2
View File
@@ -1,6 +1,6 @@
import {WebClient} from '@slack/web-api';
import {Config} from '../config';
import {Logger} from '../logger';
import {WebClient} from '@slack/web-api';
const channel = Config.notifications.slack.channel;
const token = Config.notifications.slack.token;
@@ -9,7 +9,7 @@ const web = new WebClient(token);
export function sendSlackMessage(cartUrl: string) {
(async () => {
try {
const result = await web.chat.postMessage({text: cartUrl, channel});
const result = await web.chat.postMessage({channel, text: cartUrl});
if (!result.ok) {
Logger.error(result.error);
return;
+9 -9
View File
@@ -1,24 +1,24 @@
import nodemailer from 'nodemailer';
import Mail from 'nodemailer/lib/mailer';
import {Config} from '../config';
import {Logger} from '../logger';
import {Link} from '../store/model';
import {Logger} from '../logger';
import Mail from 'nodemailer/lib/mailer';
import nodemailer from 'nodemailer';
const subject = 'NVIDIA - BUY NOW';
const [email, phone] = [Config.notifications.email, Config.notifications.phone];
const transporter = nodemailer.createTransport({
service: 'gmail',
auth: {
user: email.username,
pass: email.password
}
pass: email.password,
user: email.username
},
service: 'gmail'
});
const mailOptions: Mail.Options = {
from: Config.notifications.email.username,
to: generateAddress(),
subject
subject,
to: generateAddress()
};
export function sendSMS(text: string, link: Link) {
+1 -1
View File
@@ -1,7 +1,7 @@
import playerLib from 'play-sound';
import {Config} from '../config';
import {Logger} from '../logger';
import fs from 'fs';
import playerLib from 'play-sound';
const notificationSound = Config.notifications.playSound;
const player = playerLib();