Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

Commit ed87c26

Browse files
vicbIgorMinar
authored andcommitted
fix: lint errors
1 parent 2cad6b3 commit ed87c26

File tree

16 files changed

+91
-97
lines changed

16 files changed

+91
-97
lines changed

lib/browser/browser.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ for (var i = 0; i < blockingMethods.length; i++) {
2222
var name = blockingMethods[i];
2323
patchMethod(_global, name, (delegate, symbol, name) => {
2424
return function (s:any, args: any[]) {
25-
return Zone.current.run(delegate, _global, args, name)
26-
}
25+
return Zone.current.run(delegate, _global, args, name);
26+
};
2727
});
2828
}
2929

lib/common/utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ export function makeZoneAwareAddListener(addFnName: string, removeFnName: string
209209
return target[addFnSymbol](eventName, eventTask.invoke, useCapturing);
210210
}
211211
}
212-
212+
213213
const zone: Zone = Zone.current;
214214
const source = target.constructor['name'] + '.' + addFnName + ':' + eventName;
215215
const data: ListenerTaskMeta = {
@@ -253,7 +253,7 @@ export function makeZoneAwareListeners(fnName: string) {
253253
return target[EVENT_TASKS]
254254
.filter(task => task.data.eventName === eventName)
255255
.map(task => task.data.handler);
256-
}
256+
};
257257
}
258258

259259
const zoneAwareAddEventListener = makeZoneAwareAddListener(ADD_EVENT_LISTENER, REMOVE_EVENT_LISTENER);

lib/jasmine/jasmine.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,21 +40,21 @@
4040
let originalJasmineFn: Function = jasmineEnv[methodName];
4141
jasmineEnv[methodName] = function(description: string, specDefinitions: Function) {
4242
return originalJasmineFn.call(this, description, wrapDescribeInZone(specDefinitions));
43-
}
43+
};
4444
});
4545
['it', 'xit', 'fit'].forEach((methodName) => {
4646
let originalJasmineFn: Function = jasmineEnv[methodName];
4747
jasmineEnv[methodName] = function(description: string, specDefinitions: Function, timeout: number) {
4848
arguments[1] = wrapTestInZone(specDefinitions);
4949
return originalJasmineFn.apply(this, arguments);
50-
}
50+
};
5151
});
5252
['beforeEach', 'afterEach'].forEach((methodName) => {
5353
let originalJasmineFn: Function = jasmineEnv[methodName];
5454
jasmineEnv[methodName] = function(specDefinitions: Function, timeout: number) {
5555
arguments[0] = wrapTestInZone(specDefinitions);
5656
return originalJasmineFn.apply(this, arguments);
57-
}
57+
};
5858
});
5959

6060
/**
@@ -64,7 +64,7 @@
6464
function wrapDescribeInZone(describeBody: Function): Function {
6565
return function() {
6666
return syncZone.run(describeBody, this, arguments as any as any[]);
67-
}
67+
};
6868
}
6969

7070
/**

lib/node/node.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,5 +71,5 @@ if (httpClient && httpClient.ClientRequest) {
7171
let zone = Zone.current;
7272
return new ClientRequest(options, zone.wrap(callback, 'http.ClientRequest'));
7373
}
74-
}
74+
};
7575
}

lib/zone-spec/fake-async-test.ts

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,35 @@
11
(function(global: any) {
22
interface ScheduledFunction {
33
endTime: number;
4-
id: number,
4+
id: number;
55
func: Function;
66
args: any[];
77
delay: number;
88
}
9-
9+
1010
class Scheduler {
1111
// Next scheduler id.
1212
public nextId: number = 0;
13-
13+
1414
// Scheduler queue with the tuple of end time and callback function - sorted by end time.
1515
private _schedulerQueue: ScheduledFunction[] = [];
1616
// Current simulated time in millis.
1717
private _currentTime: number = 0;
18-
18+
1919
constructor() {}
20-
20+
2121
scheduleFunction(cb: Function, delay: number, args: any[] = [], id: number = -1) : number {
2222
let currentId: number = id < 0 ? this.nextId++ : id;
2323
let endTime = this._currentTime + delay;
24-
24+
2525
// Insert so that scheduler queue remains sorted by end time.
2626
let newEntry: ScheduledFunction = {
2727
endTime: endTime,
2828
id: currentId,
2929
func: cb,
3030
args: args,
3131
delay: delay
32-
}
32+
};
3333
let i = 0;
3434
for (; i < this._schedulerQueue.length; i++) {
3535
let currentEntry = this._schedulerQueue[i];
@@ -40,7 +40,7 @@
4040
this._schedulerQueue.splice(i, 0, newEntry);
4141
return currentId;
4242
}
43-
43+
4444
removeScheduledFunctionWithId(id: number): void {
4545
for (let i = 0; i < this._schedulerQueue.length; i++) {
4646
if (this._schedulerQueue[i].id == id) {
@@ -49,11 +49,11 @@
4949
}
5050
}
5151
}
52-
52+
5353
tick(millis: number = 0): void {
5454
let finalTime = this._currentTime + millis;
5555
while (this._schedulerQueue.length > 0) {
56-
let current = this._schedulerQueue[0];
56+
let current = this._schedulerQueue[0];
5757
if (finalTime < current.endTime) {
5858
// Done processing the queue since it's sorted by endTime.
5959
break;
@@ -71,19 +71,19 @@
7171
this._currentTime = finalTime;
7272
}
7373
}
74-
74+
7575
class FakeAsyncTestZoneSpec implements ZoneSpec {
7676
static assertInZone(): void {
7777
if (Zone.current.get('FakeAsyncTestZoneSpec') == null) {
7878
throw new Error('The code should be running in the fakeAsync zone to call this function');
7979
}
8080
}
81-
81+
8282
private _scheduler: Scheduler = new Scheduler();
8383
private _microtasks: Function[] = [];
8484
private _lastError: Error = null;
8585
private _uncaughtPromiseErrors: {rejection: any}[] = Promise[Zone['__symbol__']('uncaughtPromiseErrors')];
86-
86+
8787
pendingPeriodicTimers: number[] = [];
8888
pendingTimers: number[] = [];
8989

@@ -95,52 +95,52 @@
9595
completers: {onSuccess?: Function, onError?: Function}): Function {
9696
return (...args): boolean => {
9797
fn.apply(global, args);
98-
98+
9999
if (this._lastError === null) { // Success
100100
if (completers.onSuccess != null) {
101101
completers.onSuccess.apply(global);
102102
}
103103
// Flush microtasks only on success.
104104
this.flushMicrotasks();
105105
} else { // Failure
106-
if (completers.onError != null) {
106+
if (completers.onError != null) {
107107
completers.onError.apply(global);
108108
}
109109
}
110-
// Return true if there were no errors, false otherwise.
110+
// Return true if there were no errors, false otherwise.
111111
return this._lastError === null;
112-
}
112+
};
113113
}
114-
114+
115115
private static _removeTimer(timers: number[], id:number): void {
116116
let index = timers.indexOf(id);
117117
if (index > -1) {
118118
timers.splice(index, 1);
119119
}
120120
}
121-
121+
122122
private _dequeueTimer(id: number): Function {
123123
return () => {
124124
FakeAsyncTestZoneSpec._removeTimer(this.pendingTimers, id);
125125
};
126126
}
127-
127+
128128
private _requeuePeriodicTimer(
129129
fn: Function, interval: number, args: any[], id: number): Function {
130130
return () => {
131131
// Requeue the timer callback if it's not been canceled.
132132
if (this.pendingPeriodicTimers.indexOf(id) !== -1) {
133133
this._scheduler.scheduleFunction(fn, interval, args, id);
134134
}
135-
}
135+
};
136136
}
137-
137+
138138
private _dequeuePeriodicTimer(id: number): Function {
139139
return () => {
140140
FakeAsyncTestZoneSpec._removeTimer(this.pendingPeriodicTimers, id);
141141
};
142142
}
143-
143+
144144
private _setTimeout(fn: Function, delay: number, args: any[]): number {
145145
let removeTimerFn = this._dequeueTimer(this._scheduler.nextId);
146146
// Queue the callback and dequeue the timer on success and error.
@@ -149,20 +149,20 @@
149149
this.pendingTimers.push(id);
150150
return id;
151151
}
152-
152+
153153
private _clearTimeout(id: number): void {
154154
FakeAsyncTestZoneSpec._removeTimer(this.pendingTimers, id);
155155
this._scheduler.removeScheduledFunctionWithId(id);
156156
}
157-
157+
158158
private _setInterval(fn: Function, interval: number, ...args): number {
159159
let id = this._scheduler.nextId;
160160
let completers = {onSuccess: null, onError: this._dequeuePeriodicTimer(id)};
161161
let cb = this._fnAndFlush(fn, completers);
162-
163-
// Use the callback created above to requeue on success.
162+
163+
// Use the callback created above to requeue on success.
164164
completers.onSuccess = this._requeuePeriodicTimer(cb, interval, args, id);
165-
165+
166166
// Queue the callback and dequeue the periodic timer only on error.
167167
this._scheduler.scheduleFunction(cb, interval, args);
168168
this.pendingPeriodicTimers.push(id);
@@ -180,7 +180,7 @@
180180
this._lastError = null;
181181
throw error;
182182
}
183-
183+
184184
tick(millis: number = 0): void {
185185
FakeAsyncTestZoneSpec.assertInZone();
186186
this.flushMicrotasks();
@@ -197,7 +197,7 @@
197197
// If there is an error stop processing the microtask queue and rethrow the error.
198198
this._resetLastErrorAndThrow();
199199
}
200-
}
200+
};
201201
while (this._microtasks.length > 0) {
202202
let microtask = this._microtasks.shift();
203203
microtask();
@@ -249,10 +249,10 @@
249249
return delegate.cancelTask(target, task);
250250
}
251251
}
252-
252+
253253
onHandleError(parentZoneDelegate: ZoneDelegate, currentZone: Zone, targetZone: Zone,
254254
error: any): boolean {
255-
this._lastError = error;
255+
this._lastError = error;
256256
return false; // Don't propagate error to parent zone.
257257
}
258258
}

lib/zone.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,7 @@ const Zone: ZoneType = (function(global: any) {
574574
const zone: Zone = this;
575575
return function() {
576576
return zone.runGuarded(_callback, this, <any>arguments, source);
577-
}
577+
};
578578
}
579579

580580
public run(callback: Function, applyThis: any = null, applyArgs: any[] = null,
@@ -755,7 +755,7 @@ const Zone: ZoneType = (function(global: any) {
755755
if (this._scheduleTaskZS) {
756756
return this._scheduleTaskZS.onScheduleTask(this._scheduleTaskDlgt, this.zone, targetZone, task);
757757
} else if (task.scheduleFn) {
758-
task.scheduleFn(task)
758+
task.scheduleFn(task);
759759
} else if (task.type == 'microTask') {
760760
scheduleMicroTask(<MicroTask>task);
761761
} else {
@@ -788,7 +788,7 @@ const Zone: ZoneType = (function(global: any) {
788788
} else if (!task.cancelFn) {
789789
throw new Error('Task does not support cancellation, or is already canceled.');
790790
} else {
791-
value = task.cancelFn(task)
791+
value = task.cancelFn(task);
792792
}
793793
if (targetZone == this.zone) {
794794
// this should not be in the finally block, because exceptions assume not canceled.
@@ -973,7 +973,7 @@ const Zone: ZoneType = (function(global: any) {
973973
return (v) => {
974974
resolvePromise(promise, state, v);
975975
// Do not return value or you will break the Promise spec.
976-
}
976+
};
977977
}
978978

979979
function resolvePromise(promise: ZoneAwarePromise<any>, state: boolean, value: any): ZoneAwarePromise<any> {
@@ -1053,9 +1053,9 @@ const Zone: ZoneType = (function(global: any) {
10531053
static race<R>(values: PromiseLike<any>[]): Promise<R> {
10541054
let resolve: (v: any) => void;
10551055
let reject: (v: any) => void;
1056-
let promise: any = new this((res, rej) => {resolve = res; reject = rej});
1057-
function onResolve(value) { promise && (promise = null || resolve(value)) }
1058-
function onReject(error) { promise && (promise = null || reject(error)) }
1056+
let promise: any = new this((res, rej) => {[resolve, reject] = [res, rej];});
1057+
function onResolve(value) { promise && (promise = null || resolve(value)); }
1058+
function onReject(error) { promise && (promise = null || reject(error)); }
10591059

10601060
for(let value of values) {
10611061
if (!isThenable(value)) {

test/browser/WebSocket.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ if (!window['soucelabs']) {
3333
worker.onmessage = (e:MessageEvent) => {
3434
expect(e.data).toBe('pass');
3535
done();
36-
}
36+
};
3737
});
3838

3939
it('should work with addEventListener', function (done) {

0 commit comments

Comments
 (0)