Skip to content

Commit 52a40cb

Browse files
authored
refactor(container-runtime): Enable eslint rules from recommended config and fix violations (#23564)
Adds the `jsdoc`-related rules from the recommended config and fixes violations. Specifically, - `jsdoc/multiline-blocks` - `jsdoc/require-description`, This PR is one piece of a multi-PR process to migrate the `container-runtime` package to our recommended eslint config. [AB#3027](https://dev.azure.com/fluidframework/235294da-091d-4c29-84fc-cdfc3d90890b/_workitems/edit/3027)
1 parent 831c020 commit 52a40cb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+1115
-378
lines changed

common/build/eslint-config-fluid/recommended.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ module.exports = {
4747
"unicorn/empty-brace-spaces": "off",
4848

4949
// Rationale: Destructuring of `Array.entries()` in order to get the index variable results in a
50-
// significant performance regression [node 14 x64].
50+
// significant performance regression [node 14 x64].
5151
"unicorn/no-for-loop": "off",
5252

5353
/**

packages/runtime/container-runtime/.eslintrc.cjs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,13 @@ module.exports = {
1414
rules: {
1515
"@typescript-eslint/strict-boolean-expressions": "off",
1616
"@fluid-internal/fluid/no-unchecked-record-access": "warn",
17+
18+
// #region TODO:AB#3027: remove overrides and upgrade config to `recommended`
19+
20+
"jsdoc/multiline-blocks": ["error", { noSingleLineBlocks: true }],
21+
"jsdoc/require-description": ["error", { checkConstructors: false }],
22+
23+
// #endregion
1724
},
1825
overrides: [
1926
{

packages/runtime/container-runtime/src/channelCollection.ts

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,13 +110,18 @@ import {
110110
* @internal
111111
*/
112112
export enum RuntimeHeaders {
113-
/** True to wait for a data store to be created and loaded before returning it. */
113+
/**
114+
* True to wait for a data store to be created and loaded before returning it.
115+
*/
114116
wait = "wait",
115-
/** True if the request is coming from an IFluidHandle. */
117+
/**
118+
* True if the request is coming from an IFluidHandle.
119+
*/
116120
viaHandle = "viaHandle",
117121
}
118122

119-
/** True if a tombstoned object should be returned without erroring
123+
/**
124+
* True if a tombstoned object should be returned without erroring
120125
* @legacy
121126
* @alpha
122127
*/
@@ -373,7 +378,9 @@ export class ChannelCollection implements IFluidDataStoreChannel, IDisposable {
373378
return pendingAliasPromise ?? "Success";
374379
}
375380

376-
/** For sampling. Only log once per container */
381+
/**
382+
* For sampling. Only log once per container
383+
*/
377384
private shouldSendAttachLog = true;
378385

379386
protected wrapContextForInnerChannel(id: string): IFluidParentContext {
@@ -545,7 +552,9 @@ export class ChannelCollection implements IFluidDataStoreChannel, IDisposable {
545552
return this.aliasMap.get(id) !== undefined || this.contexts.get(id) !== undefined;
546553
}
547554

548-
/** Package up the context's attach summary etc into an IAttachMessage */
555+
/**
556+
* Package up the context's attach summary etc into an IAttachMessage
557+
*/
549558
private generateAttachMessage(localContext: LocalFluidDataStoreContext): IAttachMessage {
550559
// Get the attach summary.
551560
const attachSummary = localContext.getAttachSummary();
@@ -1611,7 +1620,9 @@ export function detectOutboundReferences(
16111620
outboundPaths.forEach((toPath) => addedOutboundReference(fromPath, toPath));
16121621
}
16131622

1614-
/** @internal */
1623+
/**
1624+
* @internal
1625+
*/
16151626
export class ChannelCollectionFactory<T extends ChannelCollection = ChannelCollection>
16161627
implements IFluidDataStoreFactory
16171628
{

packages/runtime/container-runtime/src/connectionTelemetry.ts

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,25 +36,39 @@ export const latencyThreshold = 5000;
3636
// 3. Op received from service back (pushed to inbound queue).
3737
// 4. Op is processed.
3838
interface IOpPerfTelemetryProperties {
39-
/** Measure time between (1) and (2) - Measure time outbound op is sitting in queue due to active batch */
39+
/**
40+
* Measure time between (1) and (2) - Measure time outbound op is sitting in queue due to active batch
41+
*/
4042
durationOutboundBatching: number; // was durationOutboundQueue in previous versions
41-
/** Measure time between (2) and (3) - Track how long it took for op to be acked by service */
43+
/**
44+
* Measure time between (2) and (3) - Track how long it took for op to be acked by service
45+
*/
4246
durationNetwork: number; // was durationInboundQueue
43-
/** Measure time between (3) and (4) - Time between DM's inbound "push" event until DM's "op" event */
47+
/**
48+
* Measure time between (3) and (4) - Time between DM's inbound "push" event until DM's "op" event
49+
*/
4450
durationInboundToProcessing: number;
45-
/** Length of the DeltaManager's inbound queue at the time of the DM's inbound "push" event (3) */
51+
/**
52+
* Length of the DeltaManager's inbound queue at the time of the DM's inbound "push" event (3)
53+
*/
4654
lengthInboundQueue: number;
4755
}
4856

4957
/**
5058
* Timings collected at various moments during the op processing.
5159
*/
5260
interface IOpPerfTimings {
53-
/** Starting time for (1) */
61+
/**
62+
* Starting time for (1)
63+
*/
5464
submitOpEventTime: number;
55-
/** Starting time for (2) */
65+
/**
66+
* Starting time for (2)
67+
*/
5668
outboundPushEventTime: number;
57-
/** Starting time for (3) */
69+
/**
70+
* Starting time for (3)
71+
*/
5872
inboundPushEventTime: number;
5973
}
6074

@@ -81,9 +95,13 @@ class OpPerfTelemetry {
8195
private connectionStartTime = 0;
8296
private gap = 0;
8397

84-
/** Count of no-ops sent by this client. This variable is reset everytime the OpStats sampled event is logged */
98+
/**
99+
* Count of no-ops sent by this client. This variable is reset everytime the OpStats sampled event is logged
100+
*/
85101
private noOpCountForTelemetry = 0;
86-
/** Cumulative size of the ops processed by this client. This variable is reset everytime the OpStats sampled event is logged */
102+
/**
103+
* Cumulative size of the ops processed by this client. This variable is reset everytime the OpStats sampled event is logged
104+
*/
87105
private processedOpSizeForTelemetry = 0;
88106

89107
private readonly logger: ITelemetryLoggerExt;

packages/runtime/container-runtime/src/containerRuntime.ts

Lines changed: 54 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,9 @@ export const DefaultSummaryConfiguration: ISummaryConfiguration = {
422422
* @alpha
423423
*/
424424
export interface ISummaryRuntimeOptions {
425-
/** Override summary configurations set by the server. */
425+
/**
426+
* Override summary configurations set by the server.
427+
*/
426428
summaryConfigOverrides?: ISummaryConfiguration;
427429

428430
/**
@@ -584,7 +586,9 @@ export interface RuntimeHeaderData {
584586
allowTombstone?: boolean;
585587
}
586588

587-
/** Default values for Runtime Headers */
589+
/**
590+
* Default values for Runtime Headers
591+
*/
588592
export const defaultRuntimeHeaderData: Required<RuntimeHeaderData> = {
589593
wait: true,
590594
viaHandle: false,
@@ -663,9 +667,13 @@ const defaultCompressionConfig = {
663667

664668
const defaultChunkSizeInBytes = 204800;
665669

666-
/** The default time to wait for pending ops to be processed during summarization */
670+
/**
671+
* The default time to wait for pending ops to be processed during summarization
672+
*/
667673
export const defaultPendingOpsWaitTimeoutMs = 1000;
668-
/** The default time to delay a summarization retry attempt when there are pending ops */
674+
/**
675+
* The default time to delay a summarization retry attempt when there are pending ops
676+
*/
669677
export const defaultPendingOpsRetryDelayMs = 1000;
670678

671679
/**
@@ -890,7 +898,9 @@ export class ContainerRuntime
890898
runtimeOptions?: IContainerRuntimeOptions; // May also include options from IContainerRuntimeOptionsInternal
891899
containerScope?: FluidObject;
892900
containerRuntimeCtor?: typeof ContainerRuntime;
893-
/** @deprecated Will be removed once Loader LTS version is "2.0.0-internal.7.0.0". Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md */
901+
/**
902+
* @deprecated Will be removed once Loader LTS version is "2.0.0-internal.7.0.0". Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
903+
*/
894904
requestHandler?: (request: IRequest, runtime: IContainerRuntime) => Promise<IResponse>;
895905
provideEntryPoint: (containerRuntime: IContainerRuntime) => Promise<FluidObject>;
896906
}): Promise<ContainerRuntime> {
@@ -1365,7 +1375,9 @@ export class ContainerRuntime
13651375
return this._connected;
13661376
}
13671377

1368-
/** clientId of parent (non-summarizing) container that owns summarizer container */
1378+
/**
1379+
* clientId of parent (non-summarizing) container that owns summarizer container
1380+
*/
13691381
public get summarizerClientId(): string | undefined {
13701382
return this.summarizerClientElection?.electedClientId;
13711383
}
@@ -1410,7 +1422,9 @@ export class ContainerRuntime
14101422
private readonly channelCollection: ChannelCollection;
14111423
private readonly remoteMessageProcessor: RemoteMessageProcessor;
14121424

1413-
/** The last message processed at the time of the last summary. */
1425+
/**
1426+
* The last message processed at the time of the last summary.
1427+
*/
14141428
private messageAtLastSummary: ISummaryMetadataMessage | undefined;
14151429

14161430
private get summarizer(): Summarizer {
@@ -2420,7 +2434,9 @@ export class ContainerRuntime
24202434
return this.channelCollection.internalId(maybeAlias);
24212435
}
24222436

2423-
/** Adds the container's metadata to the given summary tree. */
2437+
/**
2438+
* Adds the container's metadata to the given summary tree.
2439+
*/
24242440
private addMetadataToSummary(summaryTree: ISummaryTreeWithStats) {
24252441
// The last message processed at the time of summary. If there are no new messages, use the message from the
24262442
// last summary.
@@ -3664,17 +3680,29 @@ export class ContainerRuntime
36643680
* Returns a summary of the runtime at the current sequence number.
36653681
*/
36663682
public async summarize(options: {
3667-
/** True to generate the full tree with no handle reuse optimizations; defaults to false */
3683+
/**
3684+
* True to generate the full tree with no handle reuse optimizations; defaults to false
3685+
*/
36683686
fullTree?: boolean;
3669-
/** True to track the state for this summary in the SummarizerNodes; defaults to true */
3687+
/**
3688+
* True to track the state for this summary in the SummarizerNodes; defaults to true
3689+
*/
36703690
trackState?: boolean;
3671-
/** Logger to use for correlated summary events */
3691+
/**
3692+
* Logger to use for correlated summary events
3693+
*/
36723694
summaryLogger?: ITelemetryLoggerExt;
3673-
/** True to run garbage collection before summarizing; defaults to true */
3695+
/**
3696+
* True to run garbage collection before summarizing; defaults to true
3697+
*/
36743698
runGC?: boolean;
3675-
/** True to generate full GC data */
3699+
/**
3700+
* True to generate full GC data
3701+
*/
36763702
fullGC?: boolean;
3677-
/** True to run GC sweep phase after the mark phase */
3703+
/**
3704+
* True to run GC sweep phase after the mark phase
3705+
*/
36783706
runSweep?: boolean;
36793707
}): Promise<ISummaryTreeWithStats> {
36803708
this.verifyNotClosed();
@@ -3853,11 +3881,17 @@ export class ContainerRuntime
38533881
*/
38543882
public async collectGarbage(
38553883
options: {
3856-
/** Logger to use for logging GC events */
3884+
/**
3885+
* Logger to use for logging GC events
3886+
*/
38573887
logger?: ITelemetryLoggerExt;
3858-
/** True to run GC sweep phase after the mark phase */
3888+
/**
3889+
* True to run GC sweep phase after the mark phase
3890+
*/
38593891
runSweep?: boolean;
3860-
/** True to generate full GC data */
3892+
/**
3893+
* True to generate full GC data
3894+
*/
38613895
fullGC?: boolean;
38623896
},
38633897
telemetryContext?: ITelemetryContext,
@@ -4647,7 +4681,9 @@ export class ContainerRuntime
46474681
}
46484682
}
46494683

4650-
/** Implementation of ISummarizerInternalsProvider.refreshLatestSummaryAck */
4684+
/**
4685+
* Implementation of ISummarizerInternalsProvider.refreshLatestSummaryAck
4686+
*/
46514687
public async refreshLatestSummaryAck(options: IRefreshSummaryAckOptions) {
46524688
const { proposalHandle, ackHandle, summaryRefSeq, summaryLogger } = options;
46534689
// proposalHandle is always passed from RunningSummarizer.

packages/runtime/container-runtime/src/dataStore.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,13 @@ import { ContainerMessageType } from "./messageTypes.js";
2626
* alias to a datastore
2727
*/
2828
export interface IDataStoreAliasMessage {
29-
/** The internal id of the datastore */
29+
/**
30+
* The internal id of the datastore
31+
*/
3032
readonly internalId: string;
31-
/** The alias name to be assigned to the datastore */
33+
/**
34+
* The alias name to be assigned to the datastore
35+
*/
3236
readonly alias: string;
3337
}
3438

0 commit comments

Comments
 (0)