Skip to content

Update prettier. Run prettier #1160

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
Jul 13, 2022
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
728 changes: 364 additions & 364 deletions docgen/api-extractor.base.json

Large diffs are not rendered by default.

21 changes: 4 additions & 17 deletions integration_test/functions/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,7 @@ async function updateRemoteConfig(
function v1Tests(testId: string, accessToken: string): Array<Promise<unknown>> {
return [
// A database write to trigger the Firebase Realtime Database tests.
admin
.database()
.ref(`dbTests/${testId}/start`)
.set({ '.sv': 'timestamp' }),
admin.database().ref(`dbTests/${testId}/start`).set({ '.sv': 'timestamp' }),
// A Pub/Sub publish to trigger the Cloud Pub/Sub tests.
new PubSub()
.topic('pubsubTests')
Expand All @@ -139,11 +136,7 @@ function v1Tests(testId: string, accessToken: string): Array<Promise<unknown>> {
admin.auth().deleteUser(userRecord.uid);
}),
// A firestore write to trigger the Cloud Firestore tests.
admin
.firestore()
.collection('tests')
.doc(testId)
.set({ test: testId }),
admin.firestore().collection('tests').doc(testId).set({ test: testId }),
// Invoke a callable HTTPS trigger.
callHttpsTrigger('v1-callableTests', { foo: 'bar', testId }),
// A Remote Config update to trigger the Remote Config tests.
Expand Down Expand Up @@ -172,14 +165,8 @@ export const integrationTests: any = functions
timeoutSeconds: 540,
})
.https.onRequest(async (req: Request, resp: Response) => {
const testId = admin
.database()
.ref()
.push().key;
admin
.database()
.ref(`testRuns/${testId}/timestamp`)
.set(Date.now());
const testId = admin.database().ref().push().key;
admin.database().ref(`testRuns/${testId}/timestamp`).set(Date.now());
const testIdRef = admin.database().ref(`testRuns/${testId}`);
functions.logger.info('testId is: ', testId);
fs.writeFile('/tmp/' + testId + '.txt', 'test', () => {});
Expand Down
41 changes: 16 additions & 25 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@
"nock": "^10.0.6",
"node-fetch": "^2.6.7",
"portfinder": "^1.0.28",
"prettier": "^1.18.2",
"prettier": "^2.7.1",
"semver": "^7.3.5",
"sinon": "^7.3.2",
"ts-node": "^10.4.0",
Expand All @@ -217,4 +217,4 @@
"engines": {
"node": ">=14.10.0"
}
}
}
24 changes: 12 additions & 12 deletions spec/common/providers/identity.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ describe('identity', () => {

describe('isValidRequest', () => {
it('should error on non-post', () => {
const req = ({
const req = {
method: 'GET',
header: {
'Content-Type': 'application/json',
Expand All @@ -130,13 +130,13 @@ describe('identity', () => {
jwt: '1.2.3',
},
},
} as unknown) as express.Request;
} as unknown as express.Request;

expect(identity.isValidRequest(req)).to.be.false;
});

it('should error on bad Content-Type', () => {
const req = ({
const req = {
method: 'POST',
header(val: string) {
return 'text/css';
Expand All @@ -146,50 +146,50 @@ describe('identity', () => {
jwt: '1.2.3',
},
},
} as unknown) as express.Request;
} as unknown as express.Request;

expect(identity.isValidRequest(req)).to.be.false;
});

it('should error without req body', () => {
const req = ({
const req = {
method: 'POST',
header(val: string) {
return 'application/json';
},
} as unknown) as express.Request;
} as unknown as express.Request;

expect(identity.isValidRequest(req)).to.be.false;
});

it('should error without req body data', () => {
const req = ({
const req = {
method: 'POST',
header(val: string) {
return 'application/json';
},
body: {},
} as unknown) as express.Request;
} as unknown as express.Request;

expect(identity.isValidRequest(req)).to.be.false;
});

it('should error without req body', () => {
const req = ({
const req = {
method: 'POST',
header(val: string) {
return 'application/json';
},
body: {
data: {},
},
} as unknown) as express.Request;
} as unknown as express.Request;

expect(identity.isValidRequest(req)).to.be.false;
});

it('should not error on valid request', () => {
const req = ({
const req = {
method: 'POST',
header(val: string) {
return 'application/json';
Expand All @@ -199,7 +199,7 @@ describe('identity', () => {
jwt: '1.2.3',
},
},
} as unknown) as express.Request;
} as unknown as express.Request;

expect(identity.isValidRequest(req)).to.be.true;
});
Expand Down
8 changes: 4 additions & 4 deletions spec/v1/function-builder.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,15 +147,16 @@ describe('FunctionBuilder', () => {
it('should throw an error if user chooses a failurePolicy which is neither an object nor a boolean', () => {
expect(() =>
functions.runWith({
failurePolicy: (1234 as unknown) as functions.RuntimeOptions['failurePolicy'],
failurePolicy:
1234 as unknown as functions.RuntimeOptions['failurePolicy'],
})
).to.throw(Error, 'failurePolicy must be a boolean or an object');
});

it('should throw an error if user chooses a failurePolicy.retry which is not an object', () => {
expect(() =>
functions.runWith({
failurePolicy: { retry: (1234 as unknown) as object },
failurePolicy: { retry: 1234 as unknown as object },
})
).to.throw(Error, 'failurePolicy.retry');
});
Expand Down Expand Up @@ -366,8 +367,7 @@ describe('FunctionBuilder', () => {
expect(() =>
functions.runWith({
labels: {
key:
'a-very-long-value-that-is-more-than-the-maximum-allowed-length-for-values',
key: 'a-very-long-value-that-is-more-than-the-maximum-allowed-length-for-values',
},
})
).to.throw();
Expand Down
5 changes: 2 additions & 3 deletions spec/v1/providers/auth.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,9 +276,8 @@ describe('Auth Functions', () => {
});

describe('#onDelete', () => {
const cloudFunctionDelete: CloudFunction<UserRecord> = functions.handler.auth.user.onDelete(
(data: UserRecord) => data
);
const cloudFunctionDelete: CloudFunction<UserRecord> =
functions.handler.auth.user.onDelete((data: UserRecord) => data);

it('should return an empty endpoint', () => {
const cloudFunction = functions.handler.auth.user.onDelete(() => null);
Expand Down
7 changes: 1 addition & 6 deletions spec/v1/providers/database.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -620,12 +620,7 @@ describe('Database Functions', () => {
describe('#child(): DataSnapshot', () => {
it('should work with multiple calls', () => {
populate({ a: { b: { c: 'd' } } });
expect(
subject
.child('a')
.child('b/c')
.val()
).to.equal('d');
expect(subject.child('a').child('b/c').val()).to.equal('d');
});
});

Expand Down
3 changes: 1 addition & 2 deletions spec/v1/providers/firestore.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -600,8 +600,7 @@ describe('Firestore Functions', () => {
},
{
resource: {
name:
'projects/pid/databases/(default)/documents/collection/123',
name: 'projects/pid/databases/(default)/documents/collection/123',
},
}
)
Expand Down
5 changes: 2 additions & 3 deletions spec/v2/providers/alerts/alerts.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,8 @@ describe('alerts', () => {

describe('getOptsAndAlertTypeAndApp', () => {
it('should parse a string', () => {
const [opts, alertType, appId] = alerts.getOptsAndAlertTypeAndApp(
ALERT_TYPE
);
const [opts, alertType, appId] =
alerts.getOptsAndAlertTypeAndApp(ALERT_TYPE);

expect(opts).to.deep.equal({});
expect(alertType).to.equal(ALERT_TYPE);
Expand Down
4 changes: 1 addition & 3 deletions src/common/utilities/path.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,5 @@ export function pathParts(path: string): string[] {
* @param child A second path segment, in POSIX format.
*/
export function joinPath(base: string, child: string) {
return pathParts(base)
.concat(pathParts(child))
.join('/');
return pathParts(base).concat(pathParts(child)).join('/');
}
2 changes: 1 addition & 1 deletion src/logger/compat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { CONSOLE_SEVERITY, UNPATCHED_CONSOLE } from './common';

/** @hidden */
function patchedConsole(severity: string): (data: any, ...args: any[]) => void {
return function(data: any, ...args: any[]): void {
return function (data: any, ...args: any[]): void {
let message = format(data, ...args);
if (severity === 'ERROR') {
message = new Error(message).stack || message;
Expand Down
3 changes: 2 additions & 1 deletion src/v1/providers/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,8 @@ export class RefBuilder {
};
}

const resourceRegex = /^projects\/([^/]+)\/instances\/([a-zA-Z0-9-]+)\/refs(\/.+)?/;
const resourceRegex =
/^projects\/([^/]+)\/instances\/([a-zA-Z0-9-]+)\/refs(\/.+)?/;

/**
* Utility function to extract database reference from resource string
Expand Down
6 changes: 3 additions & 3 deletions src/v2/params/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ export class Param<T = unknown> {
valueType: (this.constructor as typeof Param).valueType,
};
if (this.options.default && typeof this.options.default !== 'string') {
out.default = (this.options.default as
| { toString?: () => string }
| undefined)?.toString?.();
out.default = (
this.options.default as { toString?: () => string } | undefined
)?.toString?.();
}

return out as ParamSpec<string>;
Expand Down