Skip to content

Commit 6c6d248

Browse files
fix eslint
1 parent f113a2b commit 6c6d248

File tree

7 files changed

+35
-26
lines changed

7 files changed

+35
-26
lines changed

src/change_stream.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ import {
1414
MongoRuntimeError
1515
} from './error';
1616
import { MongoClient } from './mongo_client';
17-
import { AsyncDisposable } from './resource_management';
1817
import { type InferIdType, TypedEventEmitter } from './mongo_types';
1918
import type { AggregateOptions } from './operations/aggregate';
2019
import type { CollationOptions, OperationParent } from './operations/command';
2120
import type { ReadPreference } from './read_preference';
21+
import { type AsyncDisposable } from './resource_management';
2222
import type { ServerSessionId } from './sessions';
2323
import { filterOptions, getTopology, type MongoDBNamespace, squashError } from './utils';
2424

@@ -994,6 +994,7 @@ export class ChangeStream<
994994
}
995995
}
996996

997-
Symbol.asyncDispose && (ChangeStream.prototype[Symbol.asyncDispose] = async function() {
998-
await this.close();
999-
})
997+
Symbol.asyncDispose &&
998+
(ChangeStream.prototype[Symbol.asyncDispose] = async function () {
999+
await this.close();
1000+
});

src/cursor/abstract_cursor.ts

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ import { GetMoreOperation } from '../operations/get_more';
1717
import { KillCursorsOperation } from '../operations/kill_cursors';
1818
import { ReadConcern, type ReadConcernLike } from '../read_concern';
1919
import { ReadPreference, type ReadPreferenceLike } from '../read_preference';
20+
import { type AsyncDisposable } from '../resource_management';
2021
import type { Server } from '../sdam/server';
2122
import { ClientSession, maybeClearPinnedConnection } from '../sessions';
2223
import { type MongoDBNamespace, squashError } from '../utils';
23-
import { AsyncDisposable } from '../resource_management';
2424

2525
/**
2626
* @internal
@@ -125,9 +125,12 @@ export type AbstractCursorEvents = {
125125

126126
/** @public */
127127
export abstract class AbstractCursor<
128-
TSchema = any,
129-
CursorEvents extends AbstractCursorEvents = AbstractCursorEvents
130-
> extends TypedEventEmitter<CursorEvents> implements AsyncDisposable {
128+
TSchema = any,
129+
CursorEvents extends AbstractCursorEvents = AbstractCursorEvents
130+
>
131+
extends TypedEventEmitter<CursorEvents>
132+
implements AsyncDisposable
133+
{
131134
/** @internal */
132135
private cursorId: Long | null;
133136
/** @internal */
@@ -921,6 +924,7 @@ class ReadableCursorStream extends Readable {
921924
}
922925
}
923926

924-
Symbol.asyncDispose && (AbstractCursor.prototype[Symbol.asyncDispose] = async function() {
925-
await this.close();
926-
})
927+
Symbol.asyncDispose &&
928+
(AbstractCursor.prototype[Symbol.asyncDispose] = async function () {
929+
await this.close();
930+
});

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,11 @@ export { CURSOR_FLAGS } from './cursor/abstract_cursor';
107107
export { MongoErrorLabel } from './error';
108108
export { ExplainVerbosity } from './explain';
109109
export { ServerApiVersion } from './mongo_client';
110-
export { AsyncDisposable } from './resource_management';
111110
export { ReturnDocument } from './operations/find_and_modify';
112111
export { ProfilingLevel } from './operations/set_profiling_level';
113112
export { ReadConcernLevel } from './read_concern';
114113
export { ReadPreferenceMode } from './read_preference';
114+
export { AsyncDisposable } from './resource_management';
115115
export { ServerType, TopologyType } from './sdam/common';
116116

117117
// Helper classes

src/mongo_client.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import { executeOperation } from './operations/execute_operation';
3434
import { RunAdminCommandOperation } from './operations/run_command';
3535
import type { ReadConcern, ReadConcernLevel, ReadConcernLike } from './read_concern';
3636
import { ReadPreference, type ReadPreferenceMode } from './read_preference';
37+
import { type AsyncDisposable } from './resource_management';
3738
import type { ServerMonitoringMode } from './sdam/monitor';
3839
import type { TagSet } from './sdam/server_description';
3940
import { readPreferenceServerSelector } from './sdam/server_selection';
@@ -54,7 +55,6 @@ import {
5455
squashError
5556
} from './utils';
5657
import type { W, WriteConcern, WriteConcernSettings } from './write_concern';
57-
import { AsyncDisposable } from './resource_management';
5858

5959
/** @public */
6060
export const ServerApiVersion = Object.freeze({
@@ -762,9 +762,10 @@ export class MongoClient extends TypedEventEmitter<MongoClientEvents> implements
762762
}
763763
}
764764

765-
Symbol.asyncDispose && (MongoClient.prototype[Symbol.asyncDispose] = async function() {
766-
await this.close();
767-
})
765+
Symbol.asyncDispose &&
766+
(MongoClient.prototype[Symbol.asyncDispose] = async function () {
767+
await this.close();
768+
});
768769

769770
/**
770771
* Parsed Mongo Client Options.

src/resource_management.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
* @experimental
44
*/
55
export interface AsyncDisposable {
6-
/** @beta */
7-
[Symbol.asyncDispose]: () => Promise<void>;
6+
/** @beta */
7+
[Symbol.asyncDispose]: () => Promise<void>;
88
}

src/sessions.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import { executeOperation } from './operations/execute_operation';
2727
import { RunAdminCommandOperation } from './operations/run_command';
2828
import { ReadConcernLevel } from './read_concern';
2929
import { ReadPreference } from './read_preference';
30-
import { AsyncDisposable } from './resource_management';
30+
import { type AsyncDisposable } from './resource_management';
3131
import { _advanceClusterTime, type ClusterTime, TopologyType } from './sdam/common';
3232
import {
3333
isTransactionCommand,
@@ -106,7 +106,10 @@ export interface EndSessionOptions {
106106
* NOTE: not meant to be instantiated directly.
107107
* @public
108108
*/
109-
export class ClientSession extends TypedEventEmitter<ClientSessionEvents> implements AsyncDisposable {
109+
export class ClientSession
110+
extends TypedEventEmitter<ClientSessionEvents>
111+
implements AsyncDisposable
112+
{
110113
/** @internal */
111114
client: MongoClient;
112115
/** @internal */
@@ -287,7 +290,7 @@ export class ClientSession extends TypedEventEmitter<ClientSessionEvents> implem
287290
maybeClearPinnedConnection(this, { force: true, ...options });
288291
}
289292
}
290-
/** @beta */
293+
/** @beta */
291294
declare [Symbol.asyncDispose]: () => Promise<void>;
292295

293296
/**
@@ -487,9 +490,10 @@ export class ClientSession extends TypedEventEmitter<ClientSessionEvents> implem
487490
}
488491
}
489492

490-
Symbol.asyncDispose && (ClientSession.prototype[Symbol.asyncDispose] = async function() {
491-
await this.endSession({ force: true });
492-
})
493+
Symbol.asyncDispose &&
494+
(ClientSession.prototype[Symbol.asyncDispose] = async function () {
495+
await this.endSession({ force: true });
496+
});
493497

494498
const MAX_WITH_TRANSACTION_TIMEOUT = 120000;
495499
const NON_DETERMINISTIC_WRITE_CONCERN_ERRORS = new Set([

tsconfig.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111
"lib": [
1212
"es2021",
1313
"ES2022.Error",
14-
"ES2022.Object",
15-
"ESNext.Disposable"
14+
"ES2022.Object"
1615
],
1716
// We don't make use of tslib helpers, all syntax used is supported by target engine
1817
"importHelpers": false,

0 commit comments

Comments
 (0)