Skip to content

Commit a5ac33c

Browse files
committed
prettier
1 parent 701696b commit a5ac33c

File tree

12 files changed

+58
-124
lines changed

12 files changed

+58
-124
lines changed

package-lock.json

Lines changed: 4 additions & 70 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/mongodb-ts-autocomplete/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
"extract-types": "ts-node scripts/extract-types.ts"
4848
},
4949
"devDependencies": {
50-
"@mongodb-js/eslint-config-devtools": "0.9.10",
50+
"@mongodb-js/eslint-config-devtools": "0.9.11",
5151
"@mongodb-js/mocha-config-devtools": "^1.0.4",
5252
"@mongodb-js/prettier-config-devtools": "^1.0.1",
5353
"@mongodb-js/tsconfig-devtools": "^1.0.2",
@@ -66,7 +66,7 @@
6666
"mongodb-schema": "^12.5.0",
6767
"node-cache": "^5.1.2",
6868
"nyc": "^15.1.0",
69-
"prettier": "^2.3.2",
69+
"prettier": "^3.5.3",
7070
"sinon": "^9.2.3",
7171
"ts-node": "^10.9.2",
7272
"typescript": "^5.0.4"

packages/mongodb-ts-autocomplete/scripts/extract-types.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ function replaceImports(code: string) {
77
// IDE finds the import.
88
return code.replace(
99
"import type * as bson from 'bson'",
10-
"import type * as bson from '/bson.ts'"
10+
"import type * as bson from '/bson.ts'",
1111
);
1212
}
1313

@@ -29,15 +29,15 @@ async function run() {
2929
'..',
3030
'src',
3131
'fixtures',
32-
'bson-expressions.ts'
32+
'bson-expressions.ts',
3333
),
3434
'/mql.ts': path.join(__dirname, '..', 'src', 'fixtures', 'mql.ts'),
3535
'/shell-api.ts': path.join(
3636
__dirname,
3737
'..',
3838
'src',
3939
'fixtures',
40-
'shell-api.ts'
40+
'shell-api.ts',
4141
),
4242
};
4343
const files = await loadSources(input);
@@ -51,7 +51,7 @@ export default files;
5151
'..',
5252
'src',
5353
'fixtures',
54-
'autocomplete-types.ts'
54+
'autocomplete-types.ts',
5555
);
5656
await fs.writeFile(filepath, code, 'utf-8');
5757
}

packages/mongodb-ts-autocomplete/src/autocompletion-context.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ export interface AutocompletionContext {
1616
databasesForConnection(connectionId: string): Promise<string[]>;
1717
collectionsForDatabase(
1818
connectionId: string,
19-
databaseName: string
19+
databaseName: string,
2020
): Promise<string[]>;
2121
schemaInformationForCollection(
2222
connectionId: string,
2323
databaseName: string,
24-
collectionName: string
24+
collectionName: string,
2525
): Promise<JSONSchema>;
2626
cacheOptions?: Partial<CacheOptions>;
2727
}
@@ -31,7 +31,7 @@ export class CachingAutocompletionContext implements AutocompletionContext {
3131

3232
constructor(
3333
private readonly delegate: AutocompletionContext,
34-
private readonly cache: NodeCache
34+
private readonly cache: NodeCache,
3535
) {
3636
this.cacheOptions = {
3737
databaseCollectionsTTL: 180,
@@ -62,7 +62,7 @@ export class CachingAutocompletionContext implements AutocompletionContext {
6262

6363
async collectionsForDatabase(
6464
connectionId: string,
65-
databaseName: string
65+
databaseName: string,
6666
): Promise<string[]> {
6767
const cacheKey = `collectionsForDatabase::${connectionId}::${databaseName}`;
6868
if (this.cache.has(cacheKey)) {
@@ -71,7 +71,7 @@ export class CachingAutocompletionContext implements AutocompletionContext {
7171

7272
const result = await this.delegate.collectionsForDatabase(
7373
connectionId,
74-
databaseName
74+
databaseName,
7575
);
7676
this.cache.set(cacheKey, result, this.cacheOptions.databaseCollectionsTTL);
7777
return result;
@@ -80,7 +80,7 @@ export class CachingAutocompletionContext implements AutocompletionContext {
8080
async schemaInformationForCollection(
8181
connectionId: string,
8282
databaseName: string,
83-
collectionName: string
83+
collectionName: string,
8484
): Promise<JSONSchema> {
8585
const cacheKey = `schemaInformationForNamespace::${connectionId}::${databaseName}.${collectionName}`;
8686
if (this.cache.has(cacheKey)) {
@@ -91,7 +91,7 @@ export class CachingAutocompletionContext implements AutocompletionContext {
9191
const result = await this.delegate.schemaInformationForCollection(
9292
connectionId,
9393
databaseName,
94-
collectionName
94+
collectionName,
9595
);
9696

9797
this.cache.set(cacheKey, result, this.cacheOptions.collectionSchemaTTL);

packages/mongodb-ts-autocomplete/src/cdt-analyser.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@ export function compileSourceFile(code: string): ts.SourceFile {
55
'_initial_parsing.ts',
66
code,
77
ts.ScriptTarget.Latest,
8-
true
8+
true,
99
);
1010
}
1111

1212
const QUERY_METHODS = ['aggregate', 'find', 'findOne'];
1313

1414
export function inferCollectionNameFromFunctionCall(
15-
sourceFile: ts.SourceFile
15+
sourceFile: ts.SourceFile,
1616
): string | null {
1717
function findAggregateCallExpression(
18-
node: ts.Node
18+
node: ts.Node,
1919
): ts.CallExpression | undefined {
2020
if (
2121
ts.isCallExpression(node) &&

packages/mongodb-ts-autocomplete/src/fixtures/shell-api.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export interface Collection<T> {
1212
updateOne(query: mql.Filter<T>, modifier: Partial<T> | mql.Pipeline<T>): void;
1313
updateMany(
1414
query: mql.Filter<T>,
15-
modifier: Partial<T> | mql.Pipeline<T>
15+
modifier: Partial<T> | mql.Pipeline<T>,
1616
): void;
1717
}
1818

packages/mongodb-ts-autocomplete/src/index.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ describe('MongoDBAutocompleter', function () {
5959
// Note that the types are all blank objects for now because we haven't
6060
// sampled any of these collections' schemas yet
6161
expect(
62-
completions.filter((c) => /property|method/.test(c.kind))
62+
completions.filter((c) => /property|method/.test(c.kind)),
6363
).to.deep.equal([
6464
{
6565
kind: 'property',
@@ -88,7 +88,7 @@ describe('MongoDBAutocompleter', function () {
8888
const completions = await autocompleter.autocomplete('db.foo.find({ fo');
8989

9090
expect(
91-
completions.filter((c) => /^(foo|bar|baz)$/.test(c.name))
91+
completions.filter((c) => /^(foo|bar|baz)$/.test(c.name)),
9292
).to.deep.equal([
9393
{
9494
kind: 'property',

packages/mongodb-ts-autocomplete/src/index.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ class DatabaseSchema {
6262
([collectionName, schema]) => {
6363
const def = schema ? toTypescriptTypeDefinition(schema) : `{}`;
6464
return ` '${collectionName}': ShellAPI.Collection<${def}>;`;
65-
}
65+
},
6666
);
6767

6868
return `{
@@ -97,12 +97,12 @@ class ConnectionSchema {
9797
addCollectionSchema(
9898
databaseName: string,
9999
collectionName: string,
100-
collectionSchema: JSONSchema
100+
collectionSchema: JSONSchema,
101101
) {
102102
this.addDatabase(databaseName);
103103
this.databaseSchemas[databaseName].setCollectionSchema(
104104
collectionName,
105-
collectionSchema
105+
collectionSchema,
106106
);
107107
}
108108

@@ -111,7 +111,7 @@ class ConnectionSchema {
111111
([databaseName, schema]) => {
112112
const def = schema.toTypescriptTypeDefinition();
113113
return ` '${databaseName}': ShellAPI.Database & ${def}`;
114-
}
114+
},
115115
);
116116

117117
return `{
@@ -178,15 +178,15 @@ declare global {
178178
const schema = await this.context.schemaInformationForCollection(
179179
connectionId,
180180
databaseName,
181-
collectionName
181+
collectionName,
182182
);
183183

184184
const connection = this.addConnection(connectionId);
185185
connection.addCollectionSchema(databaseName, collectionName, schema);
186186

187187
const collectionNames = await this.context.collectionsForDatabase(
188188
connectionId,
189-
databaseName
189+
databaseName,
190190
);
191191
connection.setDatabaseCollectionNames(databaseName, collectionNames);
192192

@@ -200,7 +200,7 @@ declare global {
200200
this.autocompleter.updateCode({
201201
'/current-globals.ts': this.getCurrentGlobalsCode(
202202
connectionId,
203-
databaseName
203+
databaseName,
204204
),
205205
});
206206

packages/mongodb-ts-autocomplete/src/type-export.spec.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ describe('toTypescriptTypeDefinition', function () {
6969
timestamp: new Timestamp(new Long('7218556297505931265')), // Timestamp, 17, timestamp
7070
long: new Long('123456789123456789'), // 64-bit integer, 18, long
7171
decimal: new Decimal128(
72-
Buffer.from([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16])
72+
Buffer.from([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]),
7373
), // Decimal128, 19, decimal
7474
minKey: new MinKey(), // Min key, -1, minKey
7575
maxKey: new MaxKey(), // Max key, 127, maxKey
@@ -85,9 +85,9 @@ describe('toTypescriptTypeDefinition', function () {
8585
compressedTimeSeries: new Binary(
8686
Buffer.from(
8787
'CQCKW/8XjAEAAIfx//////////H/////////AQAAAAAAAABfAAAAAAAAAAEAAAAAAAAAAgAAAAAAAAAHAAAAAAAAAA4AAAAAAAAAAA==',
88-
'base64'
88+
'base64',
8989
),
90-
7
90+
7,
9191
), // 7
9292
custom: new Binary(Buffer.from('//8='), 128), // 128
9393
},
@@ -138,7 +138,7 @@ describe('toTypescriptTypeDefinition', function () {
138138
string?: string;
139139
symbol?: bson.BSONSymbol;
140140
timestamp?: bson.Timestamp;
141-
}`
141+
}`,
142142
);
143143
});
144144

@@ -198,7 +198,7 @@ describe('toTypescriptTypeDefinition', function () {
198198
postalCode?: string;
199199
};
200200
hobbies?: string[];
201-
}`
201+
}`,
202202
);
203203
});
204204

@@ -225,7 +225,7 @@ describe('toTypescriptTypeDefinition', function () {
225225
schema,
226226
`{
227227
a?: bson.Double | number | string | boolean | null;
228-
}`
228+
}`,
229229
);
230230
});
231231

@@ -245,7 +245,7 @@ describe('toTypescriptTypeDefinition', function () {
245245
`{
246246
a?: any[];
247247
b?: any[];
248-
}`
248+
}`,
249249
);
250250
});
251251

@@ -275,7 +275,7 @@ describe('toTypescriptTypeDefinition', function () {
275275
};
276276
};
277277
b?: any[];
278-
}`
278+
}`,
279279
);
280280
});
281281
});

0 commit comments

Comments
 (0)