Skip to content

Commit b4d8488

Browse files
committed
Lint fixes
1 parent 5aef347 commit b4d8488

18 files changed

+737
-356
lines changed

packages/grpc-js/src/backoff-timeout.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ const BACKOFF_JITTER = 0.2;
2222

2323
/**
2424
* Get a number uniformly at random in the range [min, max)
25-
* @param min
26-
* @param max
25+
* @param min
26+
* @param max
2727
*/
2828
function uniformRandom(min: number, max: number) {
2929
return Math.random() * (max - min) + min;
@@ -43,7 +43,7 @@ export class BackoffTimeout {
4343
private jitter: number = BACKOFF_JITTER;
4444
private nextDelay: number;
4545
private timerId: NodeJS.Timer;
46-
private running: boolean = false;
46+
private running = false;
4747

4848
constructor(private callback: () => void, options?: BackoffOptions) {
4949
if (options) {
@@ -74,9 +74,13 @@ export class BackoffTimeout {
7474
this.callback();
7575
this.running = false;
7676
}, this.nextDelay);
77-
const nextBackoff = Math.min(this.nextDelay * this.multiplier, this.maxDelay);
77+
const nextBackoff = Math.min(
78+
this.nextDelay * this.multiplier,
79+
this.maxDelay
80+
);
7881
const jitterMagnitude = nextBackoff * this.jitter;
79-
this.nextDelay = nextBackoff + uniformRandom(-jitterMagnitude, jitterMagnitude);
82+
this.nextDelay =
83+
nextBackoff + uniformRandom(-jitterMagnitude, jitterMagnitude);
8084
}
8185

8286
/**
@@ -98,4 +102,4 @@ export class BackoffTimeout {
98102
isRunning() {
99103
return this.running;
100104
}
101-
}
105+
}

packages/grpc-js/src/call-credentials.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,9 @@ class ComposedCallCredentials extends CallCredentials {
9696
return true;
9797
}
9898
if (other instanceof ComposedCallCredentials) {
99-
return this.creds.every((value, index) => value._equals(other.creds[index]));
99+
return this.creds.every((value, index) =>
100+
value._equals(other.creds[index])
101+
);
100102
} else {
101103
return false;
102104
}
@@ -134,7 +136,7 @@ class SingleCallCredentials extends CallCredentials {
134136
return false;
135137
}
136138
}
137-
}
139+
}
138140

139141
class EmptyCallCredentials extends CallCredentials {
140142
generateMetadata(options: CallMetadataOptions): Promise<Metadata> {

packages/grpc-js/src/channel-credentials.ts

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,12 @@ export abstract class ChannelCredentials {
140140
'Certificate chain must be given with accompanying private key'
141141
);
142142
}
143-
return new SecureChannelCredentialsImpl(rootCerts || null, privateKey || null, certChain || null, verifyOptions || {});
143+
return new SecureChannelCredentialsImpl(
144+
rootCerts || null,
145+
privateKey || null,
146+
certChain || null,
147+
verifyOptions || {}
148+
);
144149
}
145150

146151
/**
@@ -224,20 +229,31 @@ class SecureChannelCredentialsImpl extends ChannelCredentials {
224229
if (!bufferOrNullEqual(this.certChain, other.certChain)) {
225230
return false;
226231
}
227-
return this.verifyOptions.checkServerIdentity === other.verifyOptions.checkServerIdentity;
232+
return (
233+
this.verifyOptions.checkServerIdentity ===
234+
other.verifyOptions.checkServerIdentity
235+
);
228236
} else {
229237
return false;
230238
}
231239
}
232240
}
233241

234242
class ComposedChannelCredentialsImpl extends ChannelCredentials {
235-
constructor (private channelCredentials: SecureChannelCredentialsImpl, callCreds: CallCredentials) {
243+
constructor(
244+
private channelCredentials: SecureChannelCredentialsImpl,
245+
callCreds: CallCredentials
246+
) {
236247
super(callCreds);
237248
}
238249
compose(callCredentials: CallCredentials) {
239-
const combinedCallCredentials = this.callCredentials.compose(callCredentials);
240-
return new ComposedChannelCredentialsImpl(this.channelCredentials, combinedCallCredentials);
250+
const combinedCallCredentials = this.callCredentials.compose(
251+
callCredentials
252+
);
253+
return new ComposedChannelCredentialsImpl(
254+
this.channelCredentials,
255+
combinedCallCredentials
256+
);
241257
}
242258

243259
_getConnectionOptions(): ConnectionOptions | null {
@@ -251,7 +267,10 @@ class ComposedChannelCredentialsImpl extends ChannelCredentials {
251267
return true;
252268
}
253269
if (other instanceof ComposedChannelCredentialsImpl) {
254-
return this.channelCredentials._equals(other.channelCredentials) && this.callCredentials._equals(other.callCredentials);
270+
return (
271+
this.channelCredentials._equals(other.channelCredentials) &&
272+
this.callCredentials._equals(other.callCredentials)
273+
);
255274
} else {
256275
return false;
257276
}

packages/grpc-js/src/channel-options.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,16 @@ export const recognizedOptions = {
4141
'grpc.keepalive_timeout_ms': true,
4242
};
4343

44-
export function channelOptionsEqual(options1: ChannelOptions, options2: ChannelOptions) {
44+
export function channelOptionsEqual(
45+
options1: ChannelOptions,
46+
options2: ChannelOptions
47+
) {
4548
const keys1 = Object.keys(options1).sort();
4649
const keys2 = Object.keys(options2).sort();
4750
if (keys1.length !== keys2.length) {
4851
return false;
4952
}
50-
for (let i = 0; i < keys1.length; i+=1) {
53+
for (let i = 0; i < keys1.length; i += 1) {
5154
if (keys1[i] !== keys2[i]) {
5255
return false;
5356
}

0 commit comments

Comments
 (0)