Skip to content

Commit 66bcc7a

Browse files
committed
grpc-js: Reformat files and fix lint errors
1 parent 220a702 commit 66bcc7a

13 files changed

+86
-53
lines changed

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ class SecureChannelCredentialsImpl extends ChannelCredentials {
191191
) {
192192
super();
193193
this.connectionOptions = {
194-
secureContext
194+
secureContext,
195195
};
196196
// Node asserts that this option is a function, so we cannot pass undefined
197197
if (verifyOptions?.checkServerIdentity) {
@@ -220,8 +220,9 @@ class SecureChannelCredentialsImpl extends ChannelCredentials {
220220
if (other instanceof SecureChannelCredentialsImpl) {
221221
return (
222222
this.secureContext === other.secureContext &&
223-
this.verifyOptions.checkServerIdentity === other.verifyOptions.checkServerIdentity
224-
);
223+
this.verifyOptions.checkServerIdentity ===
224+
other.verifyOptions.checkServerIdentity
225+
);
225226
} else {
226227
return false;
227228
}

packages/grpc-js/src/client.ts

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -342,11 +342,16 @@ export class Client {
342342
if (status.code === Status.OK) {
343343
if (responseMessage === null) {
344344
const callerStack = getErrorStackString(callerStackError!);
345-
callProperties.callback!(callErrorFromStatus({
346-
code: Status.INTERNAL,
347-
details: 'No message received',
348-
metadata: status.metadata
349-
}, callerStack));
345+
callProperties.callback!(
346+
callErrorFromStatus(
347+
{
348+
code: Status.INTERNAL,
349+
details: 'No message received',
350+
metadata: status.metadata,
351+
},
352+
callerStack
353+
)
354+
);
350355
} else {
351356
callProperties.callback!(null, responseMessage);
352357
}
@@ -470,11 +475,16 @@ export class Client {
470475
if (status.code === Status.OK) {
471476
if (responseMessage === null) {
472477
const callerStack = getErrorStackString(callerStackError!);
473-
callProperties.callback!(callErrorFromStatus({
474-
code: Status.INTERNAL,
475-
details: 'No message received',
476-
metadata: status.metadata
477-
}, callerStack));
478+
callProperties.callback!(
479+
callErrorFromStatus(
480+
{
481+
code: Status.INTERNAL,
482+
details: 'No message received',
483+
metadata: status.metadata,
484+
},
485+
callerStack
486+
)
487+
);
478488
} else {
479489
callProperties.callback!(null, responseMessage);
480490
}

packages/grpc-js/src/compression-filter.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,8 +305,9 @@ export class CompressionFilter extends BaseFilter implements Filter {
305305
}
306306

307307
export class CompressionFilterFactory
308-
implements FilterFactory<CompressionFilter> {
309-
private sharedFilterConfig: SharedCompressionFilterConfig = {};
308+
implements FilterFactory<CompressionFilter>
309+
{
310+
private sharedFilterConfig: SharedCompressionFilterConfig = {};
310311
constructor(channel: Channel, private readonly options: ChannelOptions) {}
311312
createFilter(): CompressionFilter {
312313
return new CompressionFilter(this.options, this.sharedFilterConfig);

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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,16 @@ import { GrpcUri, parseUri, uriToString } from './uri-parser';
3939
import { ServerSurfaceCall } from './server-call';
4040

4141
import { ConnectivityState } from './connectivity-state';
42-
import { ChannelInfo, ChannelRef, ChannelzCallTracker, ChannelzChildrenTracker, ChannelzTrace, registerChannelzChannel, SubchannelRef, unregisterChannelzRef } from './channelz';
42+
import {
43+
ChannelInfo,
44+
ChannelRef,
45+
ChannelzCallTracker,
46+
ChannelzChildrenTracker,
47+
ChannelzTrace,
48+
registerChannelzChannel,
49+
SubchannelRef,
50+
unregisterChannelzRef,
51+
} from './channelz';
4352
import { LoadBalancingCall } from './load-balancing-call';
4453
import { CallCredentials } from './call-credentials';
4554
import { Call, CallStreamOptions, StatusObject } from './call-interface';

packages/grpc-js/src/load-balancer-outlier-detection.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,7 @@ import {
3131
validateLoadBalancingConfig,
3232
} from './load-balancer';
3333
import { ChildLoadBalancerHandler } from './load-balancer-child-handler';
34-
import {
35-
PickArgs,
36-
Picker,
37-
PickResult,
38-
PickResultType,
39-
} from './picker';
34+
import { PickArgs, Picker, PickResult, PickResultType } from './picker';
4035
import {
4136
SubchannelAddress,
4237
subchannelAddressToString,
@@ -170,8 +165,13 @@ export class OutlierDetectionLoadBalancingConfig
170165
failurePercentageEjection: Partial<FailurePercentageEjectionConfig> | null,
171166
private readonly childPolicy: LoadBalancingConfig[]
172167
) {
173-
if (childPolicy.length > 0 && childPolicy[0].getLoadBalancerName() === 'pick_first') {
174-
throw new Error('outlier_detection LB policy cannot have a pick_first child policy');
168+
if (
169+
childPolicy.length > 0 &&
170+
childPolicy[0].getLoadBalancerName() === 'pick_first'
171+
) {
172+
throw new Error(
173+
'outlier_detection LB policy cannot have a pick_first child policy'
174+
);
175175
}
176176
this.intervalMs = intervalMs ?? 10_000;
177177
this.baseEjectionTimeMs = baseEjectionTimeMs ?? 30_000;

packages/grpc-js/src/load-balancing-call.ts

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -256,18 +256,30 @@ export class LoadBalancingCall implements Call {
256256
);
257257
break;
258258
case PickResultType.DROP:
259-
const {code, details} = restrictControlPlaneStatusCode(pickResult.status!.code, pickResult.status!.details);
259+
const { code, details } = restrictControlPlaneStatusCode(
260+
pickResult.status!.code,
261+
pickResult.status!.details
262+
);
260263
setImmediate(() => {
261-
this.outputStatus({code, details, metadata: pickResult.status!.metadata}, 'DROP');
264+
this.outputStatus(
265+
{ code, details, metadata: pickResult.status!.metadata },
266+
'DROP'
267+
);
262268
});
263269
break;
264270
case PickResultType.TRANSIENT_FAILURE:
265271
if (this.metadata.getOptions().waitForReady) {
266272
this.channel.queueCallForPick(this);
267273
} else {
268-
const {code, details} = restrictControlPlaneStatusCode(pickResult.status!.code, pickResult.status!.details);
274+
const { code, details } = restrictControlPlaneStatusCode(
275+
pickResult.status!.code,
276+
pickResult.status!.details
277+
);
269278
setImmediate(() => {
270-
this.outputStatus({code, details, metadata: pickResult.status!.metadata}, 'PROCESSED');
279+
this.outputStatus(
280+
{ code, details, metadata: pickResult.status!.metadata },
281+
'PROCESSED'
282+
);
271283
});
272284
}
273285
break;

packages/grpc-js/src/max-message-size-filter.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,7 @@ import { Metadata } from './metadata';
2828
export class MaxMessageSizeFilter extends BaseFilter implements Filter {
2929
private maxSendMessageSize: number = DEFAULT_MAX_SEND_MESSAGE_LENGTH;
3030
private maxReceiveMessageSize: number = DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH;
31-
constructor(
32-
options: ChannelOptions
33-
) {
31+
constructor(options: ChannelOptions) {
3432
super();
3533
if ('grpc.max_send_message_length' in options) {
3634
this.maxSendMessageSize = options['grpc.max_send_message_length']!;

packages/grpc-js/src/resolver-dns.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,9 @@ class DnsResolver implements Resolver {
286286
} catch (err) {
287287
this.latestServiceConfigError = {
288288
code: Status.UNAVAILABLE,
289-
details: `Parsing service config failed with error ${(err as Error).message}`,
289+
details: `Parsing service config failed with error ${
290+
(err as Error).message
291+
}`,
290292
metadata: new Metadata(),
291293
};
292294
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,7 @@ export class ServerDuplexStreamImpl<RequestType, ResponseType>
270270
cancelled: boolean;
271271
/* This field appears to be unsued, but it is actually used in _final, which is assiged from
272272
* ServerWritableStreamImpl.prototype._final below. */
273+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
273274
// @ts-ignore noUnusedLocals
274275
private trailingMetadata: Metadata;
275276

packages/grpc-js/src/server.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1203,7 +1203,7 @@ async function handleUnary<RequestType, ResponseType>(
12031203
}
12041204
);
12051205
} catch (err) {
1206-
call.sendError(err as ServerErrorResponse)
1206+
call.sendError(err as ServerErrorResponse);
12071207
}
12081208
}
12091209

@@ -1260,7 +1260,7 @@ async function handleServerStreaming<RequestType, ResponseType>(
12601260

12611261
handler.func(stream);
12621262
} catch (err) {
1263-
call.sendError(err as ServerErrorResponse)
1263+
call.sendError(err as ServerErrorResponse);
12641264
}
12651265
}
12661266

0 commit comments

Comments
 (0)