Skip to content

Commit

Permalink
Merge pull request #400 from jaredwray/fixing-object-curly-spacing-to…
Browse files Browse the repository at this point in the history
…-xo-fix

fixing object curly spacing to xo fix
  • Loading branch information
jaredwray authored Dec 6, 2024
2 parents e1f1402 + d140e12 commit 936e51b
Show file tree
Hide file tree
Showing 23 changed files with 65 additions and 66 deletions.
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/object-curly-spacing": 0,
"@typescript-eslint/parameter-properties": 0,
"@typescript-eslint/no-unsafe-call": 0,
"@typescript-eslint/no-unsafe-assignment": 0,
Expand Down
20 changes: 10 additions & 10 deletions src/airhorn.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { type AirhornTemplateProvider, AirhornTemplateService } from './template-service.js';
import { ProviderService } from './provider-service.js';
import { AirhornProviderType } from './provider-type.js';
import { AirhornTemplateSync } from './template-sync.js';
import {type AirhornTemplateProvider, AirhornTemplateService} from './template-service.js';
import {ProviderService} from './provider-service.js';
import {AirhornProviderType} from './provider-type.js';
import {AirhornTemplateSync} from './template-sync.js';

export type CreateAirhornOptions = {
TEMPLATE_PATH?: string;
Expand Down Expand Up @@ -29,7 +29,7 @@ export class Airhorn {

constructor(options?: AirhornOptions) {
if (options) {
this.options = { ...this.options, ...options };
this.options = {...this.options, ...options};

if (this.options.TEMPLATE_PROVIDER) {
this._templates = new AirhornTemplateService(this.options.TEMPLATE_PROVIDER);
Expand Down Expand Up @@ -107,8 +107,8 @@ export const syncTemplatesToAirhorn = async (templatePath: string, airhorn: Airh
await templateSync.sync();
};

export { AirhornProviderType } from './provider-type.js';
export { type AirhornTemplateProvider } from './template-service.js';
export { AirhornTemplateSync } from './template-sync.js';
export { MemoryTemplateProvider } from './template-providers/memory.js';
export { MongoTemplateProvider } from './template-providers/mongo.js';
export {AirhornProviderType} from './provider-type.js';
export {type AirhornTemplateProvider} from './template-service.js';
export {AirhornTemplateSync} from './template-sync.js';
export {MemoryTemplateProvider} from './template-providers/memory.js';
export {MongoTemplateProvider} from './template-providers/mongo.js';
20 changes: 10 additions & 10 deletions src/provider-service.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { AirhornProviderType } from './provider-type.js';
import { WebHook } from './providers/webhook.js';
import { TwilioSMS } from './providers/twilio-sms.js';
import { TwilioSendgrid } from './providers/twilio-sendgrid.js';
import { AWSSES } from './providers/aws-ses.js';
import { AWSSMS } from './providers/aws-sms.js';
import { FirebaseMessaging } from './providers/firebase-messaging.js';
import { AWSSNS } from './providers/aws-sns.js';
import { type AirhornOptions } from './airhorn.js';
import {AirhornProviderType} from './provider-type.js';
import {WebHook} from './providers/webhook.js';
import {TwilioSMS} from './providers/twilio-sms.js';
import {TwilioSendgrid} from './providers/twilio-sendgrid.js';
import {AWSSES} from './providers/aws-ses.js';
import {AWSSMS} from './providers/aws-sms.js';
import {FirebaseMessaging} from './providers/firebase-messaging.js';
import {AWSSNS} from './providers/aws-sns.js';
import {type AirhornOptions} from './airhorn.js';

export type ProviderInterface = {
name: string;
Expand All @@ -20,7 +20,7 @@ export class ProviderService {

constructor(options?: any) {
if (options) {
this.options = { ...this.options, ...options };
this.options = {...this.options, ...options};
}

this.loadProviders();
Expand Down
2 changes: 1 addition & 1 deletion src/providers/firebase-messaging.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable unicorn/no-negated-condition */
import firebase, { type ServiceAccount} from 'firebase-admin';
import firebase, {type ServiceAccount} from 'firebase-admin';
import type {ProviderInterface} from '../provider-service.js';
import {AirhornProviderType} from '../provider-type.js';

Expand Down
4 changes: 2 additions & 2 deletions src/template-providers/memory.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { type AirhornTemplate } from '../template.js';
import { type AirhornTemplateProvider } from '../template-service.js';
import {type AirhornTemplate} from '../template.js';
import {type AirhornTemplateProvider} from '../template-service.js';

export class MemoryTemplateProvider implements AirhornTemplateProvider {
private _name = 'memory';
Expand Down
4 changes: 2 additions & 2 deletions src/template-providers/mongo.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {
MongoClient, type Db, type Collection, ObjectId, type Document,
} from 'mongodb';
import { AirhornTemplate } from '../template.js';
import { type AirhornTemplateProvider } from '../template-service.js';
import {AirhornTemplate} from '../template.js';
import {type AirhornTemplateProvider} from '../template-service.js';

export type MongoStoreProviderOptions = {
uri?: string;
Expand Down
4 changes: 2 additions & 2 deletions src/template-service.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { MemoryTemplateProvider } from './template-providers/memory.js';
import { type AirhornTemplate } from './template.js';
import {MemoryTemplateProvider} from './template-providers/memory.js';
import {type AirhornTemplate} from './template.js';

export type AirhornTemplateProvider = {
name: string;
Expand Down
10 changes: 5 additions & 5 deletions src/template-sync.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { promises as fs } from 'node:fs';
import { Ecto } from 'ecto';
import { type AirhornTemplateProvider } from './template-service.js';
import { AirhornTemplate, AirhornTemplateText } from './template.js';
import { AirhornProviderType } from './provider-type.js';
import {promises as fs} from 'node:fs';
import {Ecto} from 'ecto';
import {type AirhornTemplateProvider} from './template-service.js';
import {AirhornTemplate, AirhornTemplateText} from './template.js';
import {AirhornProviderType} from './provider-type.js';

export class AirhornTemplateSync {
private readonly _src: string;
Expand Down
2 changes: 1 addition & 1 deletion src/template.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {Ecto} from 'ecto';
import { AirhornProviderType } from './provider-type.js';
import {AirhornProviderType} from './provider-type.js';

export type AirhornTemplateTextOptions = {
langCode?: string;
Expand Down
8 changes: 4 additions & 4 deletions test/airhorn.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import type * as admin from 'firebase-admin';
import {AirhornProviderType} from '../src/provider-type.js';
import {Airhorn, createAirhorn} from '../src/airhorn.js';
import {FirebaseMessaging} from '../src/providers/firebase-messaging.js';
import { MemoryTemplateProvider } from '../src/template-providers/memory.js';
import {MemoryTemplateProvider} from '../src/template-providers/memory.js';
import {TestingData, TestingDataTwo} from './testing-data.js';

// eslint-disable-next-line n/prefer-global/process
Expand All @@ -22,7 +22,7 @@ vi.mock('firebase-admin', async () => {
apps: [],
auth: vi.fn(() => ({
...actual.auth(), // Use actual auth methods
verifyIdToken: vi.fn().mockResolvedValue({ uid: 'mocked-uid' }), // Mock specific methods
verifyIdToken: vi.fn().mockResolvedValue({uid: 'mocked-uid'}), // Mock specific methods
})),
};
});
Expand All @@ -39,15 +39,15 @@ describe('Airhorn', async () => {
});

test('Airhorn - Get Templates', async () => {
const options = { TEMPLATE_PATH: './test/templates' };
const options = {TEMPLATE_PATH: './test/templates'};
const airhorn = await createAirhorn(options);

expect(airhorn.templates).toBeDefined();
});

test('Airhorn - set the template provider', async () => {
const TEMPLATE_PROVIDER = new MemoryTemplateProvider();
const options = { TEMPLATE_PROVIDER };
const options = {TEMPLATE_PROVIDER};
const airhorn = await createAirhorn(options);

expect(airhorn.templates.provider).toBeDefined();
Expand Down
2 changes: 1 addition & 1 deletion test/providers/aws-ses.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {test, expect, vi} from 'vitest';
import { AWSSES } from '../../src/providers/aws-ses.js';
import {AWSSES} from '../../src/providers/aws-ses.js';

const AWS_SES_REGION = 'us-east-1';

Expand Down
2 changes: 1 addition & 1 deletion test/providers/aws-sms.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {test, expect, vi} from 'vitest';
import { AWSSMS } from '../../src/providers/aws-sms.js';
import {AWSSMS} from '../../src/providers/aws-sms.js';

const AWS_SES_REGION = 'us-east-1';

Expand Down
2 changes: 1 addition & 1 deletion test/providers/aws-sns.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {test, expect, vi} from 'vitest';
import { AWSSNS } from '../../src/providers/aws-sns.js';
import {AWSSNS} from '../../src/providers/aws-sns.js';

const AWS_SNS_REGION = 'us-east-1';

Expand Down
6 changes: 3 additions & 3 deletions test/providers/firebase-messaging.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { test, expect, vi } from 'vitest';
import {test, expect, vi} from 'vitest';
import type * as admin from 'firebase-admin';

vi.mock('firebase-admin', async () => {
Expand All @@ -11,15 +11,15 @@ vi.mock('firebase-admin', async () => {
apps: [],
auth: vi.fn(() => ({
...actual.auth(), // Use actual auth methods
verifyIdToken: vi.fn().mockResolvedValue({ uid: 'mocked-uid' }), // Mock specific methods
verifyIdToken: vi.fn().mockResolvedValue({uid: 'mocked-uid'}), // Mock specific methods
})),
};
});

// eslint-disable-next-line n/prefer-global/process
const FIREBASE_CERT = process.env.FIREBASE_CERT ?? './firebase-cert.json';

const { FirebaseMessaging } = await import('../../src/providers/firebase-messaging.js');
const {FirebaseMessaging} = await import('../../src/providers/firebase-messaging.js');

const notification = {
title: 'Sample notification Title',
Expand Down
2 changes: 1 addition & 1 deletion test/providers/twilio-sendgrid.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {test, expect, vi} from 'vitest';
import { TwilioSendgrid } from '../../src/providers/twilio-sendgrid.js';
import {TwilioSendgrid} from '../../src/providers/twilio-sendgrid.js';

const TWILIO_SENGRID_API_KEY = 'SG.test-key';

Expand Down
2 changes: 1 addition & 1 deletion test/providers/twilio-sms.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {test, expect, vi} from 'vitest';
import { TwilioSMS } from '../../src/providers/twilio-sms.js';
import {TwilioSMS} from '../../src/providers/twilio-sms.js';

const TWILIO_SMS_ACCOUNT_SID = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
const TWILIO_SMS_AUTH_TOKEN = 'your_auth_token';
Expand Down
4 changes: 2 additions & 2 deletions test/store-providers/memory.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, test, expect} from 'vitest';
import { MemoryTemplateProvider } from '../../src/template-providers/memory.js';
import {describe, test, expect} from 'vitest';
import {MemoryTemplateProvider} from '../../src/template-providers/memory.js';
import {
airhornTestTemplate,
} from '../testing-data.js';
Expand Down
10 changes: 5 additions & 5 deletions test/store-providers/mongo.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { text } from 'node:stream/consumers';
import {text} from 'node:stream/consumers';
import {test, describe, expect} from 'vitest';
import {MongoTemplateProvider} from '../../src/template-providers/mongo.js';
import { airhornTestTemplate } from '../testing-data.js';
import { AirhornTemplateText } from '../../src/template.js';
import { AirhornProviderType } from '../../src/provider-type.js';
import {airhornTestTemplate} from '../testing-data.js';
import {AirhornTemplateText} from '../../src/template.js';
import {AirhornProviderType} from '../../src/provider-type.js';

const uri = 'mongodb://localhost:27017';
const mongoStoreProvider = new MongoTemplateProvider({uri});
Expand Down Expand Up @@ -65,7 +65,7 @@ describe('MongoStoreProvider Templates', () => {
const provider = mongoStoreProvider;
await provider.templatesCollection.deleteMany({});
const template = await provider.createTemplate(airhornTestTemplate);
template.text = [new AirhornTemplateText({ text: 'updated', providerType: AirhornProviderType.SMS })];
template.text = [new AirhornTemplateText({text: 'updated', providerType: AirhornProviderType.SMS})];
const updatedTemplate = await provider.updateTemplate(template);
expect(updatedTemplate.getText(AirhornProviderType.SMS, 'en')?.text).toBe('updated');
await provider.templatesCollection.deleteMany({});
Expand Down
6 changes: 3 additions & 3 deletions test/template-service.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {describe, test, expect} from 'vitest';
import {AirhornTemplateService} from '../src/template-service.js';
import { MemoryTemplateProvider } from '../src/template-providers/memory.js';
import { AirhornTemplate, AirhornTemplateText } from '../src/template.js';
import { AirhornProviderType } from '../src/provider-type.js';
import {MemoryTemplateProvider} from '../src/template-providers/memory.js';
import {AirhornTemplate, AirhornTemplateText} from '../src/template.js';
import {AirhornProviderType} from '../src/provider-type.js';

describe('TemplateService', () => {
test('template service can initialize', () => {
Expand Down
8 changes: 4 additions & 4 deletions test/template-sync.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import path from 'node:path';
import process from 'node:process';
import { describe, test, expect} from 'vitest';
import { AirhornTemplateSync } from '../src/template-sync.js';
import { MemoryTemplateProvider } from '../src/template-providers/memory.js';
import { AirhornProviderType } from '../src/provider-type.js';
import {describe, test, expect} from 'vitest';
import {AirhornTemplateSync} from '../src/template-sync.js';
import {MemoryTemplateProvider} from '../src/template-providers/memory.js';
import {AirhornProviderType} from '../src/provider-type.js';

enum AirhornTemplatePaths {
DEFAULT = 'test/templates',
Expand Down
4 changes: 2 additions & 2 deletions test/template.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {describe, test, expect} from 'vitest';
import { AirhornProviderType } from '../src/provider-type.js';
import { AirhornTemplate, AirhornTemplateText } from '../src/template.js';
import {AirhornProviderType} from '../src/provider-type.js';
import {AirhornTemplate, AirhornTemplateText} from '../src/template.js';

describe('AirhornTemplate', () => {
test('AirhornTemplate initialize', () => {
Expand Down
2 changes: 1 addition & 1 deletion test/testing-data.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AirhornTemplate, AirhornTemplateText } from '../src/template.js';
import {AirhornTemplate, AirhornTemplateText} from '../src/template.js';

export class TestingData {
public users = new Array<TestingUser>();
Expand Down
6 changes: 3 additions & 3 deletions test/webhook.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import {
describe, test, expect, vi,
} from 'vitest';
import type * as admin from 'firebase-admin';
import { createAirhorn} from '../src/airhorn.js';
import { AirhornTemplateSync } from '../src/template-sync.js';
import {createAirhorn} from '../src/airhorn.js';
import {AirhornTemplateSync} from '../src/template-sync.js';
import {TestingDataTwo} from './testing-data.js';

// eslint-disable-next-line n/prefer-global/process
Expand All @@ -21,7 +21,7 @@ vi.mock('firebase-admin', async () => {
apps: [],
auth: vi.fn(() => ({
...actual.auth(), // Use actual auth methods
verifyIdToken: vi.fn().mockResolvedValue({ uid: 'mocked-uid' }), // Mock specific methods
verifyIdToken: vi.fn().mockResolvedValue({uid: 'mocked-uid'}), // Mock specific methods
})),
};
});
Expand Down

0 comments on commit 936e51b

Please sign in to comment.