diff --git a/package.json b/package.json index c4283dc..bbbccce 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,6 @@ "xo": { "rules": { "@typescript-eslint/naming-convention": 0, - "@typescript-eslint/no-unsafe-assignment": 0, "@typescript-eslint/no-unsafe-return": 0, "@typescript-eslint/no-redundant-type-constituents": 0, "no-console": 0, diff --git a/src/provider-service.ts b/src/provider-service.ts index 60d8280..6430991 100644 --- a/src/provider-service.ts +++ b/src/provider-service.ts @@ -20,6 +20,7 @@ export class ProviderService { constructor(options?: any) { if (options) { + // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment this.options = {...this.options, ...options}; } diff --git a/src/providers/firebase-messaging.ts b/src/providers/firebase-messaging.ts index bed7809..ae05ffa 100644 --- a/src/providers/firebase-messaging.ts +++ b/src/providers/firebase-messaging.ts @@ -25,11 +25,14 @@ export class FirebaseMessaging implements ProviderInterface { } public async send(to: string, from: string, message: string) { + // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment const {title, body} = JSON.parse(message); const parameters: firebase.messaging.Message = { notification: { + // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment title, + // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment body, }, token: to, diff --git a/src/providers/webhook.ts b/src/providers/webhook.ts index c16c8ff..2f00457 100644 --- a/src/providers/webhook.ts +++ b/src/providers/webhook.ts @@ -7,6 +7,7 @@ export class WebHook implements ProviderInterface { type = AirhornProviderType.WEBHOOK; public async send(to: string, from: string, message: string, subject?: string): Promise { + // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment const messageData = JSON.parse(message); if (!subject) { diff --git a/src/template-providers/mongo.ts b/src/template-providers/mongo.ts index b0d5ca2..76ffead 100644 --- a/src/template-providers/mongo.ts +++ b/src/template-providers/mongo.ts @@ -92,6 +92,7 @@ export class MongoTemplateProvider implements AirhornTemplateProvider { mapDocumentToTemplate(document: Document): AirhornTemplate { const template = new AirhornTemplate(document.name as string); + // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment template.text = document.text; return template; diff --git a/test/airhorn.test.ts b/test/airhorn.test.ts index c571086..0fa14bf 100644 --- a/test/airhorn.test.ts +++ b/test/airhorn.test.ts @@ -122,6 +122,7 @@ describe('Airhorn', async () => { const airhorn = await createAirhorn(options); + // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment airhorn.send = vi.fn().mockReturnValue(true) as any; const userData = new TestingData(); @@ -161,6 +162,7 @@ describe('Airhorn', async () => { airhorn.providers.removeProvider('firebase-messaging'); const firebaseAdmin = new FirebaseMessaging('{}'); + // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment firebaseAdmin.client = { send: vi.fn().mockReturnValue({}), } as any; @@ -183,6 +185,7 @@ describe('Airhorn', async () => { airhorn.providers.removeProvider('firebase-messaging'); const firebaseAdmin = new FirebaseMessaging(FIREBASE_CERT); + // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment firebaseAdmin.client = { send: vi.fn().mockReturnValue({}), } as any; diff --git a/test/providers/aws-ses.test.ts b/test/providers/aws-ses.test.ts index 95fbe08..0b56a0f 100644 --- a/test/providers/aws-ses.test.ts +++ b/test/providers/aws-ses.test.ts @@ -10,6 +10,7 @@ test('AWS SES - Init', () => { test('AWS SES - Send', async () => { const awsSES = new AWSSES(AWS_SES_REGION); + // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment awsSES.client = { send: vi.fn().mockReturnValue({}), } as any; @@ -20,6 +21,7 @@ test('AWS SES - Send', async () => { test('AWS SES - Send with no Subject', async () => { const awsSES = new AWSSES(AWS_SES_REGION); + // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment awsSES.client = { send: vi.fn().mockReturnValue({}), } as any; diff --git a/test/providers/aws-sms.test.ts b/test/providers/aws-sms.test.ts index c66f15a..32f2173 100644 --- a/test/providers/aws-sms.test.ts +++ b/test/providers/aws-sms.test.ts @@ -10,6 +10,7 @@ test('AWS SNS - Init', () => { test('AWS SMS - Send', async () => { const awsSMS = new AWSSMS(AWS_SES_REGION); + // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment awsSMS.client = { publish: vi.fn().mockReturnValue({ promise: vi.fn(), diff --git a/test/providers/aws-sns.test.ts b/test/providers/aws-sns.test.ts index db1a3be..4c02659 100644 --- a/test/providers/aws-sns.test.ts +++ b/test/providers/aws-sns.test.ts @@ -11,6 +11,7 @@ test('AWS SNS - Send to TopicArn', async () => { const awsSNS = new AWSSNS(AWS_SNS_REGION); const topicArn = 'topicArnDeviceIdFromSns'; + // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment awsSNS.client = { publish: vi.fn().mockReturnValue({ promise: vi.fn(), diff --git a/test/providers/firebase-messaging.test.ts b/test/providers/firebase-messaging.test.ts index 549adbe..3abf372 100644 --- a/test/providers/firebase-messaging.test.ts +++ b/test/providers/firebase-messaging.test.ts @@ -31,6 +31,7 @@ test('Firebase Messaging to Device - Send', async () => { const token = 'deviceIdToken'; const message = JSON.stringify(notification); + // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment firebaseAdmin.client = { send: vi.fn().mockReturnValue({}), } as any; @@ -43,6 +44,7 @@ test('Firebase Messaging to Device - JSON', async () => { const token = 'deviceIdToken'; const message = JSON.stringify(notification); + // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment firebaseAdmin.client = { send: vi.fn().mockReturnValue({}), } as any; diff --git a/test/providers/twilio-sendgrid.test.ts b/test/providers/twilio-sendgrid.test.ts index f249040..2417927 100644 --- a/test/providers/twilio-sendgrid.test.ts +++ b/test/providers/twilio-sendgrid.test.ts @@ -13,6 +13,8 @@ test('TwilioSendgrid - Init with No Api Key', () => { test('TwilioSMS - Send', async () => { const twilioSendgrid = new TwilioSendgrid(TWILIO_SENGRID_API_KEY); + + // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment twilioSendgrid.client = { setApiKey: vi.fn().mockReturnValue({}), send: vi.fn().mockReturnValue({}), @@ -24,6 +26,7 @@ test('TwilioSMS - Send', async () => { test('TwilioSMS - Send with undefined subject will replace with `no subject` in the field', async () => { const twilioSendgrid = new TwilioSendgrid(TWILIO_SENGRID_API_KEY); + // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment twilioSendgrid.client = { setApiKey: vi.fn().mockReturnValue({}), send: vi.fn().mockReturnValue({}), diff --git a/test/providers/twilio-sms.test.ts b/test/providers/twilio-sms.test.ts index 5a349d4..36c8203 100644 --- a/test/providers/twilio-sms.test.ts +++ b/test/providers/twilio-sms.test.ts @@ -11,6 +11,7 @@ test('TwilioSMS - Init', () => { test('TwilioSMS - Send', async () => { const twilioSMS = new TwilioSMS(TWILIO_SMS_ACCOUNT_SID, TWILIO_SMS_AUTH_TOKEN); + // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment twilioSMS.client = { messages: { create: vi.fn().mockReturnValue({}),