Skip to content

Commit 801a7b8

Browse files
committed
Update prettier. Run prettier
1 parent 8241eb6 commit 801a7b8

File tree

14 files changed

+415
-446
lines changed

14 files changed

+415
-446
lines changed

docgen/api-extractor.base.json

Lines changed: 364 additions & 364 deletions
Large diffs are not rendered by default.

integration_test/functions/src/index.ts

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,7 @@ async function updateRemoteConfig(
118118
function v1Tests(testId: string, accessToken: string): Array<Promise<unknown>> {
119119
return [
120120
// A database write to trigger the Firebase Realtime Database tests.
121-
admin
122-
.database()
123-
.ref(`dbTests/${testId}/start`)
124-
.set({ '.sv': 'timestamp' }),
121+
admin.database().ref(`dbTests/${testId}/start`).set({ '.sv': 'timestamp' }),
125122
// A Pub/Sub publish to trigger the Cloud Pub/Sub tests.
126123
new PubSub()
127124
.topic('pubsubTests')
@@ -139,11 +136,7 @@ function v1Tests(testId: string, accessToken: string): Array<Promise<unknown>> {
139136
admin.auth().deleteUser(userRecord.uid);
140137
}),
141138
// A firestore write to trigger the Cloud Firestore tests.
142-
admin
143-
.firestore()
144-
.collection('tests')
145-
.doc(testId)
146-
.set({ test: testId }),
139+
admin.firestore().collection('tests').doc(testId).set({ test: testId }),
147140
// Invoke a callable HTTPS trigger.
148141
callHttpsTrigger('v1-callableTests', { foo: 'bar', testId }),
149142
// A Remote Config update to trigger the Remote Config tests.
@@ -172,14 +165,8 @@ export const integrationTests: any = functions
172165
timeoutSeconds: 540,
173166
})
174167
.https.onRequest(async (req: Request, resp: Response) => {
175-
const testId = admin
176-
.database()
177-
.ref()
178-
.push().key;
179-
admin
180-
.database()
181-
.ref(`testRuns/${testId}/timestamp`)
182-
.set(Date.now());
168+
const testId = admin.database().ref().push().key;
169+
admin.database().ref(`testRuns/${testId}/timestamp`).set(Date.now());
183170
const testIdRef = admin.database().ref(`testRuns/${testId}`);
184171
functions.logger.info('testId is: ', testId);
185172
fs.writeFile('/tmp/' + testId + '.txt', 'test', () => {});

package-lock.json

Lines changed: 16 additions & 25 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@
199199
"nock": "^10.0.6",
200200
"node-fetch": "^2.6.7",
201201
"portfinder": "^1.0.28",
202-
"prettier": "^1.18.2",
202+
"prettier": "^2.7.1",
203203
"semver": "^7.3.5",
204204
"sinon": "^7.3.2",
205205
"ts-node": "^10.4.0",
@@ -217,4 +217,4 @@
217217
"engines": {
218218
"node": ">=14.10.0"
219219
}
220-
}
220+
}

spec/common/providers/identity.spec.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ describe('identity', () => {
120120

121121
describe('isValidRequest', () => {
122122
it('should error on non-post', () => {
123-
const req = ({
123+
const req = {
124124
method: 'GET',
125125
header: {
126126
'Content-Type': 'application/json',
@@ -130,13 +130,13 @@ describe('identity', () => {
130130
jwt: '1.2.3',
131131
},
132132
},
133-
} as unknown) as express.Request;
133+
} as unknown as express.Request;
134134

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

138138
it('should error on bad Content-Type', () => {
139-
const req = ({
139+
const req = {
140140
method: 'POST',
141141
header(val: string) {
142142
return 'text/css';
@@ -146,50 +146,50 @@ describe('identity', () => {
146146
jwt: '1.2.3',
147147
},
148148
},
149-
} as unknown) as express.Request;
149+
} as unknown as express.Request;
150150

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

154154
it('should error without req body', () => {
155-
const req = ({
155+
const req = {
156156
method: 'POST',
157157
header(val: string) {
158158
return 'application/json';
159159
},
160-
} as unknown) as express.Request;
160+
} as unknown as express.Request;
161161

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

165165
it('should error without req body data', () => {
166-
const req = ({
166+
const req = {
167167
method: 'POST',
168168
header(val: string) {
169169
return 'application/json';
170170
},
171171
body: {},
172-
} as unknown) as express.Request;
172+
} as unknown as express.Request;
173173

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

177177
it('should error without req body', () => {
178-
const req = ({
178+
const req = {
179179
method: 'POST',
180180
header(val: string) {
181181
return 'application/json';
182182
},
183183
body: {
184184
data: {},
185185
},
186-
} as unknown) as express.Request;
186+
} as unknown as express.Request;
187187

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

191191
it('should not error on valid request', () => {
192-
const req = ({
192+
const req = {
193193
method: 'POST',
194194
header(val: string) {
195195
return 'application/json';
@@ -199,7 +199,7 @@ describe('identity', () => {
199199
jwt: '1.2.3',
200200
},
201201
},
202-
} as unknown) as express.Request;
202+
} as unknown as express.Request;
203203

204204
expect(identity.isValidRequest(req)).to.be.true;
205205
});

spec/v1/function-builder.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,15 +147,16 @@ describe('FunctionBuilder', () => {
147147
it('should throw an error if user chooses a failurePolicy which is neither an object nor a boolean', () => {
148148
expect(() =>
149149
functions.runWith({
150-
failurePolicy: (1234 as unknown) as functions.RuntimeOptions['failurePolicy'],
150+
failurePolicy:
151+
1234 as unknown as functions.RuntimeOptions['failurePolicy'],
151152
})
152153
).to.throw(Error, 'failurePolicy must be a boolean or an object');
153154
});
154155

155156
it('should throw an error if user chooses a failurePolicy.retry which is not an object', () => {
156157
expect(() =>
157158
functions.runWith({
158-
failurePolicy: { retry: (1234 as unknown) as object },
159+
failurePolicy: { retry: 1234 as unknown as object },
159160
})
160161
).to.throw(Error, 'failurePolicy.retry');
161162
});
@@ -366,8 +367,7 @@ describe('FunctionBuilder', () => {
366367
expect(() =>
367368
functions.runWith({
368369
labels: {
369-
key:
370-
'a-very-long-value-that-is-more-than-the-maximum-allowed-length-for-values',
370+
key: 'a-very-long-value-that-is-more-than-the-maximum-allowed-length-for-values',
371371
},
372372
})
373373
).to.throw();

spec/v1/providers/auth.spec.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -276,9 +276,8 @@ describe('Auth Functions', () => {
276276
});
277277

278278
describe('#onDelete', () => {
279-
const cloudFunctionDelete: CloudFunction<UserRecord> = functions.handler.auth.user.onDelete(
280-
(data: UserRecord) => data
281-
);
279+
const cloudFunctionDelete: CloudFunction<UserRecord> =
280+
functions.handler.auth.user.onDelete((data: UserRecord) => data);
282281

283282
it('should return an empty endpoint', () => {
284283
const cloudFunction = functions.handler.auth.user.onDelete(() => null);

spec/v1/providers/database.spec.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -620,12 +620,7 @@ describe('Database Functions', () => {
620620
describe('#child(): DataSnapshot', () => {
621621
it('should work with multiple calls', () => {
622622
populate({ a: { b: { c: 'd' } } });
623-
expect(
624-
subject
625-
.child('a')
626-
.child('b/c')
627-
.val()
628-
).to.equal('d');
623+
expect(subject.child('a').child('b/c').val()).to.equal('d');
629624
});
630625
});
631626

spec/v1/providers/firestore.spec.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -600,8 +600,7 @@ describe('Firestore Functions', () => {
600600
},
601601
{
602602
resource: {
603-
name:
604-
'projects/pid/databases/(default)/documents/collection/123',
603+
name: 'projects/pid/databases/(default)/documents/collection/123',
605604
},
606605
}
607606
)

spec/v2/providers/alerts/alerts.spec.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,8 @@ describe('alerts', () => {
138138

139139
describe('getOptsAndAlertTypeAndApp', () => {
140140
it('should parse a string', () => {
141-
const [opts, alertType, appId] = alerts.getOptsAndAlertTypeAndApp(
142-
ALERT_TYPE
143-
);
141+
const [opts, alertType, appId] =
142+
alerts.getOptsAndAlertTypeAndApp(ALERT_TYPE);
144143

145144
expect(opts).to.deep.equal({});
146145
expect(alertType).to.equal(ALERT_TYPE);

src/common/utilities/path.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,5 @@ export function pathParts(path: string): string[] {
2929
* @param child A second path segment, in POSIX format.
3030
*/
3131
export function joinPath(base: string, child: string) {
32-
return pathParts(base)
33-
.concat(pathParts(child))
34-
.join('/');
32+
return pathParts(base).concat(pathParts(child)).join('/');
3533
}

src/logger/compat.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import { CONSOLE_SEVERITY, UNPATCHED_CONSOLE } from './common';
2525

2626
/** @hidden */
2727
function patchedConsole(severity: string): (data: any, ...args: any[]) => void {
28-
return function(data: any, ...args: any[]): void {
28+
return function (data: any, ...args: any[]): void {
2929
let message = format(data, ...args);
3030
if (severity === 'ERROR') {
3131
message = new Error(message).stack || message;

src/v1/providers/database.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,8 @@ export class RefBuilder {
294294
};
295295
}
296296

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

299300
/**
300301
* Utility function to extract database reference from resource string

src/v2/params/types.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@ export class Param<T = unknown> {
6464
valueType: (this.constructor as typeof Param).valueType,
6565
};
6666
if (this.options.default && typeof this.options.default !== 'string') {
67-
out.default = (this.options.default as
68-
| { toString?: () => string }
69-
| undefined)?.toString?.();
67+
out.default = (
68+
this.options.default as { toString?: () => string } | undefined
69+
)?.toString?.();
7070
}
7171

7272
return out as ParamSpec<string>;

0 commit comments

Comments
 (0)