Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

removing global typescript-eslint/no-unsafe-assignment on lint #403

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions src/provider-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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};
}

Expand Down
3 changes: 3 additions & 0 deletions src/providers/firebase-messaging.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions src/providers/webhook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export class WebHook implements ProviderInterface {
type = AirhornProviderType.WEBHOOK;

public async send(to: string, from: string, message: string, subject?: string): Promise<boolean> {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const messageData = JSON.parse(message);

if (!subject) {
Expand Down
1 change: 1 addition & 0 deletions src/template-providers/mongo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 3 additions & 0 deletions test/airhorn.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions test/providers/aws-ses.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
1 change: 1 addition & 0 deletions test/providers/aws-sms.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
1 change: 1 addition & 0 deletions test/providers/aws-sns.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
2 changes: 2 additions & 0 deletions test/providers/firebase-messaging.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
3 changes: 3 additions & 0 deletions test/providers/twilio-sendgrid.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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({}),
Expand All @@ -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({}),
Expand Down
1 change: 1 addition & 0 deletions test/providers/twilio-sms.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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({}),
Expand Down
Loading