Skip to content

Commit 5328be6

Browse files
dgp1130alxhub
authored andcommitted
refactor(zone.js): formatting recently changed files (#53443)
For some reason CI started complaining about lack of formatting here. PR Close #53443
1 parent cc1b0f4 commit 5328be6

5 files changed

Lines changed: 664 additions & 661 deletions

File tree

packages/zone.js/lib/common/fetch.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export function patchFetch(Zone: ZoneType): void {
3434

3535
const createFetchTask =
3636
(source: string, data: TaskData|undefined, originalImpl: any, self: any, args: any[],
37-
ac?: AbortController) => new Promise((resolve, reject) => {
37+
ac?: AbortController) => new Promise((resolve, reject) => {
3838
const task = Zone.current.scheduleMacroTask(
3939
source, placeholder, data,
4040
() => {

packages/zone.js/lib/common/promise.ts

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@
55
* Use of this source code is governed by an MIT-style license that can be
66
* found in the LICENSE file at https://angular.io/license
77
*/
8-
import {patchMethod} from './utils';
98
import {ZoneType} from '../zone-impl';
109

10+
import {patchMethod} from './utils';
11+
1112
export function patchPromise(Zone: ZoneType): void {
1213
Zone.__load_patch('ZoneAwarePromise', (global: any, Zone: ZoneType, api: _ZonePrivate) => {
1314
const ObjectGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
@@ -61,7 +62,8 @@ export function patchPromise(Zone: ZoneType): void {
6162
}
6263
};
6364

64-
const UNHANDLED_PROMISE_REJECTION_HANDLER_SYMBOL = __symbol__('unhandledPromiseRejectionHandler');
65+
const UNHANDLED_PROMISE_REJECTION_HANDLER_SYMBOL =
66+
__symbol__('unhandledPromiseRejectionHandler');
6567

6668
function handleUnhandledRejection(this: unknown, e: any) {
6769
api.onUnhandledError(e);
@@ -257,7 +259,7 @@ export function patchPromise(Zone: ZoneType): void {
257259
const delegate = promiseState ?
258260
(typeof onFulfilled === 'function') ? onFulfilled : forwardResolution :
259261
(typeof onRejected === 'function') ? onRejected :
260-
forwardRejection;
262+
forwardRejection;
261263
zone.scheduleMicroTask(source, () => {
262264
try {
263265
const parentPromiseValue = (promise as any)[symbolValue];
@@ -454,8 +456,8 @@ export function patchPromise(Zone: ZoneType): void {
454456
}
455457

456458
constructor(
457-
executor:
458-
(resolve: (value?: R|PromiseLike<R>) => void, reject: (error?: any) => void) => void) {
459+
executor: (resolve: (value?: R|PromiseLike<R>) => void, reject: (error?: any) => void) =>
460+
void) {
459461
const promise: ZoneAwarePromise<R> = this;
460462
if (!(promise instanceof ZoneAwarePromise)) {
461463
throw new Error('Must be an instanceof Promise.');
@@ -490,9 +492,9 @@ export function patchPromise(Zone: ZoneType): void {
490492
// `this.constructor` will be undefined. One of the use cases is SystemJS creating
491493
// prototype-less objects (modules) via `Object.create(null)`. The SystemJS creates an empty
492494
// object and copies promise properties into that object (within the `getOrCreateLoad`
493-
// function). The zone.js then checks if the resolved value has the `then` method and invokes
494-
// it with the `value` context. Otherwise, this will throw an error: `TypeError: Cannot read
495-
// properties of undefined (reading 'Symbol(Symbol.species)')`.
495+
// function). The zone.js then checks if the resolved value has the `then` method and
496+
// invokes it with the `value` context. Otherwise, this will throw an error: `TypeError:
497+
// Cannot read properties of undefined (reading 'Symbol(Symbol.species)')`.
496498
let C = (this.constructor as any)?.[Symbol.species];
497499
if (!C || typeof C !== 'function') {
498500
C = this.constructor || ZoneAwarePromise;
@@ -507,8 +509,8 @@ export function patchPromise(Zone: ZoneType): void {
507509
return chainPromise;
508510
}
509511

510-
catch<TResult = never>(onRejected?: ((reason: any) => TResult | PromiseLike<TResult>)|undefined|
511-
null): Promise<R|TResult> {
512+
catch<TResult = never>(onRejected?: ((reason: any) => TResult | PromiseLike<TResult>)|
513+
undefined|null): Promise<R|TResult> {
512514
return this.then(null, onRejected);
513515
}
514516

packages/zone.js/lib/node/fs.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,11 @@ export function patchFs(Zone: ZoneType): void {
4747
if (realpathOriginalDelegate?.native) {
4848
fs.realpath.native = realpathOriginalDelegate.native;
4949
patchMacroTask(fs.realpath, 'native', (self, args) => ({
50-
args,
51-
target: self,
52-
cbIdx: args.length > 0 ? args.length - 1 : -1,
53-
name: 'fs.realpath.native',
54-
}));
50+
args,
51+
target: self,
52+
cbIdx: args.length > 0 ? args.length - 1 : -1,
53+
name: 'fs.realpath.native',
54+
}));
5555
}
5656
});
5757
}

packages/zone.js/lib/node/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import {patchNode} from './node';
1616
export function rollupMain(): ZoneType {
1717
const Zone = loadZone();
1818

19-
patchNode(Zone); // Node needs to come first.
19+
patchNode(Zone); // Node needs to come first.
2020
patchPromise(Zone);
2121
patchToString(Zone);
2222

0 commit comments

Comments
 (0)