Skip to content

Commit 0e48300

Browse files
committed
style: update to newest version of prettier
The pinned version of prettier we use is no longer supported, so this increases the version and applies the whitspace changes across the codebase in one commit
1 parent b573fe1 commit 0e48300

File tree

68 files changed

+1363
-1010
lines changed

Some content is hidden

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

68 files changed

+1363
-1010
lines changed

lib/core/connection/connect.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,7 @@ function checkSupportedServer(ismaster, options) {
7474
return null;
7575
}
7676

77-
const message = `Server at ${options.host}:${options.port} reports minimum wire version ${
78-
ismaster.minWireVersion
79-
}, but this version of the Node.js Driver requires at most ${MAX_SUPPORTED_WIRE_VERSION} (MongoDB ${MAX_SUPPORTED_SERVER_VERSION})`;
77+
const message = `Server at ${options.host}:${options.port} reports minimum wire version ${ismaster.minWireVersion}, but this version of the Node.js Driver requires at most ${MAX_SUPPORTED_WIRE_VERSION} (MongoDB ${MAX_SUPPORTED_SERVER_VERSION})`;
8078
return new MongoError(message);
8179
}
8280

lib/core/connection/pool.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -334,9 +334,7 @@ function attemptReconnect(pool, callback) {
334334
pool.destroy();
335335

336336
const error = new MongoTimeoutError(
337-
`failed to reconnect after ${pool.options.reconnectTries} attempts with interval ${
338-
pool.options.reconnectInterval
339-
} ms`,
337+
`failed to reconnect after ${pool.options.reconnectTries} attempts with interval ${pool.options.reconnectInterval} ms`,
340338
pool.reconnectError
341339
);
342340

lib/core/sdam/server_selection.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ const SMALLEST_MAX_STALENESS_SECONDS = 90;
1919
*/
2020
function writableServerSelector() {
2121
return function(topologyDescription, servers) {
22-
return latencyWindowReducer(topologyDescription, servers.filter(s => s.isWritable));
22+
return latencyWindowReducer(
23+
topologyDescription,
24+
servers.filter(s => s.isWritable)
25+
);
2326
};
2427
}
2528

@@ -185,9 +188,7 @@ function readPreferenceServerSelector(readPreference) {
185188
readPreference.minWireVersion > commonWireVersion
186189
) {
187190
throw new MongoError(
188-
`Minimum wire version '${
189-
readPreference.minWireVersion
190-
}' required, but found '${commonWireVersion}'`
191+
`Minimum wire version '${readPreference.minWireVersion}' required, but found '${commonWireVersion}'`
191192
);
192193
}
193194

lib/core/sdam/topology_description.js

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -59,16 +59,12 @@ class TopologyDescription {
5959

6060
if (serverDescription.minWireVersion > MAX_SUPPORTED_WIRE_VERSION) {
6161
this.compatible = false;
62-
this.compatibilityError = `Server at ${serverDescription.address} requires wire version ${
63-
serverDescription.minWireVersion
64-
}, but this version of the driver only supports up to ${MAX_SUPPORTED_WIRE_VERSION} (MongoDB ${MAX_SUPPORTED_SERVER_VERSION})`;
62+
this.compatibilityError = `Server at ${serverDescription.address} requires wire version ${serverDescription.minWireVersion}, but this version of the driver only supports up to ${MAX_SUPPORTED_WIRE_VERSION} (MongoDB ${MAX_SUPPORTED_SERVER_VERSION})`;
6563
}
6664

6765
if (serverDescription.maxWireVersion < MIN_SUPPORTED_WIRE_VERSION) {
6866
this.compatible = false;
69-
this.compatibilityError = `Server at ${serverDescription.address} reports wire version ${
70-
serverDescription.maxWireVersion
71-
}, but this version of the driver requires at least ${MIN_SUPPORTED_WIRE_VERSION} (MongoDB ${MIN_SUPPORTED_SERVER_VERSION}).`;
67+
this.compatibilityError = `Server at ${serverDescription.address} reports wire version ${serverDescription.maxWireVersion}, but this version of the driver requires at least ${MIN_SUPPORTED_WIRE_VERSION} (MongoDB ${MIN_SUPPORTED_SERVER_VERSION}).`;
7268
break;
7369
}
7470
}
@@ -342,9 +338,11 @@ function updateRsFromPrimary(
342338
// Remove hosts not in the response.
343339
const currentAddresses = Array.from(serverDescriptions.keys());
344340
const responseAddresses = serverDescription.allHosts;
345-
currentAddresses.filter(addr => responseAddresses.indexOf(addr) === -1).forEach(address => {
346-
serverDescriptions.delete(address);
347-
});
341+
currentAddresses
342+
.filter(addr => responseAddresses.indexOf(addr) === -1)
343+
.forEach(address => {
344+
serverDescriptions.delete(address);
345+
});
348346

349347
return [checkHasPrimary(serverDescriptions), setName, maxSetVersion, maxElectionId];
350348
}

lib/core/sessions.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -222,10 +222,8 @@ class ClientSession extends EventEmitter {
222222
}
223223

224224
return new Promise((resolve, reject) => {
225-
endTransaction(
226-
this,
227-
'commitTransaction',
228-
(err, reply) => (err ? reject(err) : resolve(reply))
225+
endTransaction(this, 'commitTransaction', (err, reply) =>
226+
err ? reject(err) : resolve(reply)
229227
);
230228
});
231229
}
@@ -243,10 +241,8 @@ class ClientSession extends EventEmitter {
243241
}
244242

245243
return new Promise((resolve, reject) => {
246-
endTransaction(
247-
this,
248-
'abortTransaction',
249-
(err, reply) => (err ? reject(err) : resolve(reply))
244+
endTransaction(this, 'abortTransaction', (err, reply) =>
245+
err ? reject(err) : resolve(reply)
250246
);
251247
});
252248
}

lib/core/utils.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,9 +182,7 @@ function makeStateMachine(stateTable) {
182182
const legalStates = stateTable[target.s.state];
183183
if (legalStates && legalStates.indexOf(newState) < 0) {
184184
throw new TypeError(
185-
`illegal state transition from [${
186-
target.s.state
187-
}] => [${newState}], allowed: [${legalStates}]`
185+
`illegal state transition from [${target.s.state}] => [${newState}], allowed: [${legalStates}]`
188186
);
189187
}
190188

lib/gridfs/grid_store.js

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -224,14 +224,21 @@ var open = function(self, options, callback) {
224224
var chunkIndexOptions = shallowClone(writeConcern);
225225
chunkIndexOptions.unique = true;
226226
// Ensure index on chunk collection
227-
chunkCollection.ensureIndex([['files_id', 1], ['n', 1]], chunkIndexOptions, function() {
228-
// Open the connection
229-
_open(self, writeConcern, function(err, r) {
230-
if (err) return callback(err);
231-
self.isOpen = true;
232-
callback(err, r);
233-
});
234-
});
227+
chunkCollection.ensureIndex(
228+
[
229+
['files_id', 1],
230+
['n', 1]
231+
],
232+
chunkIndexOptions,
233+
function() {
234+
// Open the connection
235+
_open(self, writeConcern, function(err, r) {
236+
if (err) return callback(err);
237+
self.isOpen = true;
238+
callback(err, r);
239+
});
240+
}
241+
);
235242
});
236243
} else {
237244
// Open the gridstore

lib/operations/command_v2.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,7 @@ class CommandOperationV2 extends OperationBase {
5252
if (options.collation && serverWireVersion < SUPPORTS_WRITE_CONCERN_AND_COLLATION) {
5353
callback(
5454
new MongoError(
55-
`Server ${
56-
server.name
57-
}, which reports wire version ${serverWireVersion}, does not support collation`
55+
`Server ${server.name}, which reports wire version ${serverWireVersion}, does not support collation`
5856
)
5957
);
6058
return;

lib/operations/common_functions.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,7 @@ function indexInformation(db, name, options, callback) {
183183
}
184184

185185
// Get the list of indexes of the specified collection
186-
db
187-
.collection(name)
186+
db.collection(name)
188187
.listIndexes(options)
189188
.toArray((err, indexes) => {
190189
if (err) return callback(toError(err));

lib/operations/create_collection.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,7 @@ class CreateCollectionOperation extends CommandOperation {
6969
listCollectionOptions = applyWriteConcern(listCollectionOptions, { db }, listCollectionOptions);
7070

7171
// Check if we have the name
72-
db
73-
.listCollections({ name }, listCollectionOptions)
72+
db.listCollections({ name }, listCollectionOptions)
7473
.setReadPreference(ReadPreference.PRIMARY)
7574
.toArray((err, collections) => {
7675
if (err != null) return handleCallback(callback, err, null);

0 commit comments

Comments
 (0)