Skip to content

Prettier #2795

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

Merged
merged 1 commit into from
Mar 25, 2020
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
8 changes: 6 additions & 2 deletions packages/analytics/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ describe('FirebaseAnalytics instance tests', () => {
resetGlobalVars();
app = getFakeApp(analyticsId);
fidDeferred = new Deferred<void>();
const installations = getFakeInstallations('fid-1234', () => fidDeferred.resolve());
const installations = getFakeInstallations('fid-1234', () =>
fidDeferred.resolve()
);

window['gtag'] = gtagStub;
window['dataLayer'] = [];
Expand Down Expand Up @@ -132,7 +134,9 @@ describe('FirebaseAnalytics instance tests', () => {
resetGlobalVars();
const app = getFakeApp(analyticsId);
fidDeferred = new Deferred<void>();
const installations = getFakeInstallations('fid-1234', () => fidDeferred.resolve());
const installations = getFakeInstallations('fid-1234', () =>
fidDeferred.resolve()
);
window[customGtagName] = gtagStub;
window[customDataLayerName] = [];
analyticsSettings({
Expand Down
7 changes: 6 additions & 1 deletion packages/analytics/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@ import '@firebase/installations';
import { FirebaseAnalytics } from '@firebase/analytics-types';
import { FirebaseAnalyticsInternal } from '@firebase/analytics-interop-types';
import { _FirebaseNamespace } from '@firebase/app-types/private';
import { factory, settings, resetGlobalVars, getGlobalVars } from './src/factory';
import {
factory,
settings,
resetGlobalVars,
getGlobalVars
} from './src/factory';
import { EventName } from './src/constants';
import {
Component,
Expand Down
4 changes: 3 additions & 1 deletion packages/analytics/src/factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,9 @@ export function resetGlobalVars(
/**
* For testing
*/
export function getGlobalVars(): { initializedIdPromisesMap: { [gaId: string]: Promise<void> }} {
export function getGlobalVars(): {
initializedIdPromisesMap: { [gaId: string]: Promise<void> };
} {
return {
initializedIdPromisesMap
};
Expand Down
40 changes: 32 additions & 8 deletions packages/analytics/src/helpers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,10 @@ describe('FirebaseAnalytics methods', () => {
const initPromise1 = new Deferred<void>();
const initPromise2 = new Deferred<void>();
wrapOrCreateGtag(
{ [mockAnalyticsId]: initPromise1.promise, otherId: initPromise2.promise },
{
[mockAnalyticsId]: initPromise1.promise,
otherId: initPromise2.promise
},
'dataLayer',
'gtag'
);
Expand All @@ -110,7 +113,10 @@ describe('FirebaseAnalytics methods', () => {
const initPromise1 = new Deferred<void>();
const initPromise2 = new Deferred<void>();
wrapOrCreateGtag(
{ [mockAnalyticsId]: initPromise1.promise, otherId: initPromise2.promise },
{
[mockAnalyticsId]: initPromise1.promise,
otherId: initPromise2.promise
},
'dataLayer',
'gtag'
);
Expand Down Expand Up @@ -138,7 +144,10 @@ describe('FirebaseAnalytics methods', () => {
const initPromise1 = new Deferred<void>();
const initPromise2 = new Deferred<void>();
wrapOrCreateGtag(
{ [mockAnalyticsId]: initPromise1.promise, otherId: initPromise2.promise },
{
[mockAnalyticsId]: initPromise1.promise,
otherId: initPromise2.promise
},
'dataLayer',
'gtag'
);
Expand All @@ -165,7 +174,10 @@ describe('FirebaseAnalytics methods', () => {
const initPromise1 = new Deferred<void>();
const initPromise2 = new Deferred<void>();
wrapOrCreateGtag(
{ [mockAnalyticsId]: initPromise1.promise, otherId: initPromise2.promise },
{
[mockAnalyticsId]: initPromise1.promise,
otherId: initPromise2.promise
},
'dataLayer',
'gtag'
);
Expand Down Expand Up @@ -249,7 +261,10 @@ describe('FirebaseAnalytics methods', () => {
const initPromise1 = new Deferred<void>();
const initPromise2 = new Deferred<void>();
wrapOrCreateGtag(
{ [mockAnalyticsId]: initPromise1.promise, otherId: initPromise2.promise },
{
[mockAnalyticsId]: initPromise1.promise,
otherId: initPromise2.promise
},
'dataLayer',
'gtag'
);
Expand Down Expand Up @@ -278,7 +293,10 @@ describe('FirebaseAnalytics methods', () => {
const initPromise1 = new Deferred<void>();
const initPromise2 = new Deferred<void>();
wrapOrCreateGtag(
{ [mockAnalyticsId]: initPromise1.promise, otherId: initPromise2.promise },
{
[mockAnalyticsId]: initPromise1.promise,
otherId: initPromise2.promise
},
'dataLayer',
'gtag'
);
Expand Down Expand Up @@ -312,7 +330,10 @@ describe('FirebaseAnalytics methods', () => {
const initPromise1 = new Deferred<void>();
const initPromise2 = new Deferred<void>();
wrapOrCreateGtag(
{ [mockAnalyticsId]: initPromise1.promise, otherId: initPromise2.promise },
{
[mockAnalyticsId]: initPromise1.promise,
otherId: initPromise2.promise
},
'dataLayer',
'gtag'
);
Expand Down Expand Up @@ -342,7 +363,10 @@ describe('FirebaseAnalytics methods', () => {
const initPromise1 = new Deferred<void>();
const initPromise2 = new Deferred<void>();
wrapOrCreateGtag(
{ [mockAnalyticsId]: initPromise1.promise, otherId: initPromise2.promise },
{
[mockAnalyticsId]: initPromise1.promise,
otherId: initPromise2.promise
},
'dataLayer',
'gtag'
);
Expand Down
5 changes: 4 additions & 1 deletion packages/analytics/testing/get-fake-firebase-services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ export function getFakeInstallations(
onFidResolve?: Function
): FirebaseInstallations {
return {
getId: async () => { onFidResolve && onFidResolve(); return fid; },
getId: async () => {
onFidResolve && onFidResolve();
return fid;
},
getToken: async () => 'authToken',
onIdChange: () => () => undefined,
delete: async () => undefined
Expand Down
3 changes: 2 additions & 1 deletion packages/app/src/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ const ERRORS: ErrorMap<AppError> = {
[AppError.INVALID_APP_ARGUMENT]:
'firebase.{$appName}() takes either no argument or a ' +
'Firebase App instance.',
[AppError.INVALID_LOG_ARGUMENT]: 'First argument to `onLog` must be null or a function.'
[AppError.INVALID_LOG_ARGUMENT]:
'First argument to `onLog` must be null or a function.'
};

type ErrorParams = { [key in AppError]: { appName: string } };
Expand Down
7 changes: 2 additions & 5 deletions packages/app/test/clientLogger.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,7 @@ import { spy as Spy } from 'sinon';
import './setup';
import { Logger } from '@firebase/logger';
import { registerCoreComponents } from '../src/registerCoreComponents';
import {
Component,
ComponentType
} from '@firebase/component';
import { Component, ComponentType } from '@firebase/component';

declare module '@firebase/component' {
interface NameServiceMapping {
Expand Down Expand Up @@ -86,7 +83,7 @@ describe('User Log Methods', () => {
'test-shell',
async () => {
const logger = new Logger('@firebase/logger-test');
(firebase as _FirebaseNamespace).onLog((logData) => {
(firebase as _FirebaseNamespace).onLog(logData => {
result = logData;
});
logger.info('hi');
Expand Down
2 changes: 1 addition & 1 deletion packages/firebase/firestore/memory/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/

/**
* This file serves as the public entrypoint for users that import
* This file serves as the public entrypoint for users that import
* `firebase/firestore/memory`.
*/

Expand Down
2 changes: 1 addition & 1 deletion packages/firestore/src/local/memory_persistence.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export class MemoryPersistence implements Persistence {
private _started = false;

readonly referenceDelegate: MemoryReferenceDelegate;

/**
* The constructor accepts a factory for creating a reference delegate. This
* allows both the delegate and this instance to have strong references to
Expand Down
2 changes: 1 addition & 1 deletion packages/installations/src/util/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ interface ErrorParams {
};
[ErrorCode.REQUEST_FAILED]: {
requestName: string;
[index: string] : string | number; // to make Typescript 3.8 happy
[index: string]: string | number; // to make Typescript 3.8 happy
} & ServerErrorData;
}

Expand Down
2 changes: 1 addition & 1 deletion packages/logger/src/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export interface LogCallbackParams {
message: string;
args: unknown[];
type: string;
};
}

/**
* A container for all of the Logger instances
Expand Down
32 changes: 20 additions & 12 deletions packages/logger/test/custom-logger.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ describe(`Custom log handler`, () => {

describe('Callback log level set to INFO (default)', () => {
before(() => {
setUserLogHandler((callbackParams) => {
setUserLogHandler(callbackParams => {
result = callbackParams;
});
});

beforeEach(() => {
result = null;
spies = {
Expand Down Expand Up @@ -71,7 +71,12 @@ describe(`Custom log handler`, () => {
// Default log level is INFO.
client1.info('info message!', ['hello'], 1, { a: 3 });
expect(result.message).to.equal('info message! ["hello"] 1 {"a":3}');
expect(result.args).to.deep.equal(['info message!', ['hello'], 1, { a: 3 }]);
expect(result.args).to.deep.equal([
'info message!',
['hello'],
1,
{ a: 3 }
]);
expect(result.level).to.equal('info');
expect(result.type).to.equal('@firebase/test-logger');
});
Expand All @@ -88,7 +93,7 @@ describe(`Custom log handler`, () => {
expect(result.level).to.equal('error');
expect(spies.errorSpy.called).to.be.true;
});

it('does not call custom callback when log call is not above set log level', () => {
// Default log level is INFO.
client1.log('message you should not see');
Expand All @@ -102,11 +107,14 @@ describe(`Custom log handler`, () => {

describe('Callback log level set to WARN with options', () => {
before(() => {
setUserLogHandler((callbackParams) => {
result = callbackParams;
}, { level: 'warn' });
setUserLogHandler(
callbackParams => {
result = callbackParams;
},
{ level: 'warn' }
);
});

beforeEach(() => {
result = null;
spies = {
Expand Down Expand Up @@ -136,7 +144,7 @@ describe(`Custom log handler`, () => {
expect(result.level).to.equal('error');
expect(spies.errorSpy.called).to.be.true;
});

it('does not call custom callback when log call is not above set log level', () => {
client1.debug('message you should not see');
expect(result).to.be.null;
Expand All @@ -158,11 +166,11 @@ describe(`Custom log handler`, () => {
describe('Global log level set to VERBOSE with setLogLevel()', () => {
before(() => {
setLogLevel('verbose');
setUserLogHandler((callbackParams) => {
setUserLogHandler(callbackParams => {
result = callbackParams;
});
});

beforeEach(() => {
result = null;
spies = {
Expand Down Expand Up @@ -198,7 +206,7 @@ describe(`Custom log handler`, () => {
expect(result.level).to.equal('error');
expect(spies.errorSpy.called).to.be.true;
});

it('does not call custom callback when log call is not above set log level', () => {
client1.debug('message you should not see');
expect(result).to.be.null;
Expand Down
6 changes: 5 additions & 1 deletion scripts/release/utils/npm.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,11 @@ async function publishPackage(pkg, releaseType) {
args = [...args, '--tag', 'next'];
} else if (releaseType === 'Canary') {
// Write proxy registry token for this package to .npmrc.
await exec(`echo "//wombat-dressing-room.appspot.com/:_authToken=${process.env[getEnvTokenKey(pkg)]}" >> ~/.npmrc`);
await exec(
`echo "//wombat-dressing-room.appspot.com/:_authToken=${
process.env[getEnvTokenKey(pkg)]
}" >> ~/.npmrc`
);
args = [
...args,
'--tag',
Expand Down
Loading