Skip to content

Commit

Permalink
chore: fix lint errors (#2074)
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkDuckworth committed Jun 25, 2024
1 parent 6732d4d commit 3e91cf3
Show file tree
Hide file tree
Showing 7 changed files with 111 additions and 110 deletions.
8 changes: 4 additions & 4 deletions dev/conformance/runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -524,13 +524,13 @@ function runTest(spec: ConformanceProto) {
* as strings to a proper protobuf type since protobufJS does not support it at
* the moment.
*/
function normalizeTimestamp(obj: {[key: string]: {}}) {
function normalizeTimestamp(obj: Record<string, unknown>) {
const fieldNames = ['updateTime', 'createTime', 'readTime'];
for (const key of Object.keys(obj)) {
if (fieldNames.includes(key) && typeof obj[key] === 'string') {
obj[key] = convertTimestamp(obj[key] as string);
} else if (typeof obj[key] === 'object') {
normalizeTimestamp(obj[key]);
normalizeTimestamp(obj[key] as Record<string, unknown>);
}
}
}
Expand Down Expand Up @@ -563,7 +563,7 @@ function convertTimestamp(text: string): {[key: string]: number} {
* Value type, but the 'limit' field in 'query' has Int32Value type, resulting
* in the need for an extra layer of specificity.
*/
function normalizeInt32Value(obj: {[key: string]: {}}, parent = '') {
function normalizeInt32Value(obj: Record<string, unknown>, parent = '') {
const fieldNames = ['limit'];
const parentNames = ['query'];
for (const key of Object.keys(obj)) {
Expand All @@ -576,7 +576,7 @@ function normalizeInt32Value(obj: {[key: string]: {}}, parent = '') {
value: obj[key],
};
} else if (typeof obj[key] === 'object') {
normalizeInt32Value(obj[key], key);
normalizeInt32Value(obj[key] as Record<string, object>, key);
}
}
}
Expand Down
9 changes: 4 additions & 5 deletions dev/src/reference/collection-reference.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,11 +183,10 @@ export class CollectionReference<
};

return this.firestore
.request<api.IListDocumentsRequest, api.IDocument[]>(
'listDocuments',
request,
tag
)
.request<
api.IListDocumentsRequest,
api.IDocument[]
>('listDocuments', request, tag)
.then(documents => {
// Note that the backend already orders these documents by name,
// so we do not need to manually sort them.
Expand Down
9 changes: 4 additions & 5 deletions dev/src/reference/document-reference.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,11 +257,10 @@ export class DocumentReference<
pageSize: Math.pow(2, 16) - 1,
};
return this._firestore
.request<api.IListCollectionIdsRequest, string[]>(
'listCollectionIds',
request,
tag
)
.request<
api.IListCollectionIdsRequest,
string[]
>('listCollectionIds', request, tag)
.then(collectionIds => {
const collections: Array<CollectionReference> = [];

Expand Down
48 changes: 24 additions & 24 deletions dev/test/gapic_firestore_admin_v1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3745,9 +3745,9 @@ describe('v1.FirestoreAdminClient', () => {
assert(
(client.descriptors.page.listIndexes.createStream as SinonStub)
.getCall(0)
.args[2].otherArgs.headers['x-goog-request-params'].includes(
expectedHeaderRequestParams
)
.args[2].otherArgs.headers[
'x-goog-request-params'
].includes(expectedHeaderRequestParams)
);
});

Expand Down Expand Up @@ -3796,9 +3796,9 @@ describe('v1.FirestoreAdminClient', () => {
assert(
(client.descriptors.page.listIndexes.createStream as SinonStub)
.getCall(0)
.args[2].otherArgs.headers['x-goog-request-params'].includes(
expectedHeaderRequestParams
)
.args[2].otherArgs.headers[
'x-goog-request-params'
].includes(expectedHeaderRequestParams)
);
});

Expand Down Expand Up @@ -3839,9 +3839,9 @@ describe('v1.FirestoreAdminClient', () => {
assert(
(client.descriptors.page.listIndexes.asyncIterate as SinonStub)
.getCall(0)
.args[2].otherArgs.headers['x-goog-request-params'].includes(
expectedHeaderRequestParams
)
.args[2].otherArgs.headers[
'x-goog-request-params'
].includes(expectedHeaderRequestParams)
);
});

Expand Down Expand Up @@ -3881,9 +3881,9 @@ describe('v1.FirestoreAdminClient', () => {
assert(
(client.descriptors.page.listIndexes.asyncIterate as SinonStub)
.getCall(0)
.args[2].otherArgs.headers['x-goog-request-params'].includes(
expectedHeaderRequestParams
)
.args[2].otherArgs.headers[
'x-goog-request-params'
].includes(expectedHeaderRequestParams)
);
});
});
Expand Down Expand Up @@ -4050,9 +4050,9 @@ describe('v1.FirestoreAdminClient', () => {
assert(
(client.descriptors.page.listFields.createStream as SinonStub)
.getCall(0)
.args[2].otherArgs.headers['x-goog-request-params'].includes(
expectedHeaderRequestParams
)
.args[2].otherArgs.headers[
'x-goog-request-params'
].includes(expectedHeaderRequestParams)
);
});

Expand Down Expand Up @@ -4101,9 +4101,9 @@ describe('v1.FirestoreAdminClient', () => {
assert(
(client.descriptors.page.listFields.createStream as SinonStub)
.getCall(0)
.args[2].otherArgs.headers['x-goog-request-params'].includes(
expectedHeaderRequestParams
)
.args[2].otherArgs.headers[
'x-goog-request-params'
].includes(expectedHeaderRequestParams)
);
});

Expand Down Expand Up @@ -4144,9 +4144,9 @@ describe('v1.FirestoreAdminClient', () => {
assert(
(client.descriptors.page.listFields.asyncIterate as SinonStub)
.getCall(0)
.args[2].otherArgs.headers['x-goog-request-params'].includes(
expectedHeaderRequestParams
)
.args[2].otherArgs.headers[
'x-goog-request-params'
].includes(expectedHeaderRequestParams)
);
});

Expand Down Expand Up @@ -4186,9 +4186,9 @@ describe('v1.FirestoreAdminClient', () => {
assert(
(client.descriptors.page.listFields.asyncIterate as SinonStub)
.getCall(0)
.args[2].otherArgs.headers['x-goog-request-params'].includes(
expectedHeaderRequestParams
)
.args[2].otherArgs.headers[
'x-goog-request-params'
].includes(expectedHeaderRequestParams)
);
});
});
Expand Down
72 changes: 36 additions & 36 deletions dev/test/gapic_firestore_v1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2254,9 +2254,9 @@ describe('v1.FirestoreClient', () => {
assert(
(client.descriptors.page.listDocuments.createStream as SinonStub)
.getCall(0)
.args[2].otherArgs.headers['x-goog-request-params'].includes(
expectedHeaderRequestParams
)
.args[2].otherArgs.headers[
'x-goog-request-params'
].includes(expectedHeaderRequestParams)
);
});

Expand Down Expand Up @@ -2305,9 +2305,9 @@ describe('v1.FirestoreClient', () => {
assert(
(client.descriptors.page.listDocuments.createStream as SinonStub)
.getCall(0)
.args[2].otherArgs.headers['x-goog-request-params'].includes(
expectedHeaderRequestParams
)
.args[2].otherArgs.headers[
'x-goog-request-params'
].includes(expectedHeaderRequestParams)
);
});

Expand Down Expand Up @@ -2353,9 +2353,9 @@ describe('v1.FirestoreClient', () => {
assert(
(client.descriptors.page.listDocuments.asyncIterate as SinonStub)
.getCall(0)
.args[2].otherArgs.headers['x-goog-request-params'].includes(
expectedHeaderRequestParams
)
.args[2].otherArgs.headers[
'x-goog-request-params'
].includes(expectedHeaderRequestParams)
);
});

Expand Down Expand Up @@ -2398,9 +2398,9 @@ describe('v1.FirestoreClient', () => {
assert(
(client.descriptors.page.listDocuments.asyncIterate as SinonStub)
.getCall(0)
.args[2].otherArgs.headers['x-goog-request-params'].includes(
expectedHeaderRequestParams
)
.args[2].otherArgs.headers[
'x-goog-request-params'
].includes(expectedHeaderRequestParams)
);
});
});
Expand Down Expand Up @@ -2564,9 +2564,9 @@ describe('v1.FirestoreClient', () => {
assert(
(client.descriptors.page.partitionQuery.createStream as SinonStub)
.getCall(0)
.args[2].otherArgs.headers['x-goog-request-params'].includes(
expectedHeaderRequestParams
)
.args[2].otherArgs.headers[
'x-goog-request-params'
].includes(expectedHeaderRequestParams)
);
});

Expand Down Expand Up @@ -2610,9 +2610,9 @@ describe('v1.FirestoreClient', () => {
assert(
(client.descriptors.page.partitionQuery.createStream as SinonStub)
.getCall(0)
.args[2].otherArgs.headers['x-goog-request-params'].includes(
expectedHeaderRequestParams
)
.args[2].otherArgs.headers[
'x-goog-request-params'
].includes(expectedHeaderRequestParams)
);
});

Expand Down Expand Up @@ -2653,9 +2653,9 @@ describe('v1.FirestoreClient', () => {
assert(
(client.descriptors.page.partitionQuery.asyncIterate as SinonStub)
.getCall(0)
.args[2].otherArgs.headers['x-goog-request-params'].includes(
expectedHeaderRequestParams
)
.args[2].otherArgs.headers[
'x-goog-request-params'
].includes(expectedHeaderRequestParams)
);
});

Expand Down Expand Up @@ -2693,9 +2693,9 @@ describe('v1.FirestoreClient', () => {
assert(
(client.descriptors.page.partitionQuery.asyncIterate as SinonStub)
.getCall(0)
.args[2].otherArgs.headers['x-goog-request-params'].includes(
expectedHeaderRequestParams
)
.args[2].otherArgs.headers[
'x-goog-request-params'
].includes(expectedHeaderRequestParams)
);
});
});
Expand Down Expand Up @@ -2844,9 +2844,9 @@ describe('v1.FirestoreClient', () => {
assert(
(client.descriptors.page.listCollectionIds.createStream as SinonStub)
.getCall(0)
.args[2].otherArgs.headers['x-goog-request-params'].includes(
expectedHeaderRequestParams
)
.args[2].otherArgs.headers[
'x-goog-request-params'
].includes(expectedHeaderRequestParams)
);
});

Expand Down Expand Up @@ -2890,9 +2890,9 @@ describe('v1.FirestoreClient', () => {
assert(
(client.descriptors.page.listCollectionIds.createStream as SinonStub)
.getCall(0)
.args[2].otherArgs.headers['x-goog-request-params'].includes(
expectedHeaderRequestParams
)
.args[2].otherArgs.headers[
'x-goog-request-params'
].includes(expectedHeaderRequestParams)
);
});

Expand Down Expand Up @@ -2929,9 +2929,9 @@ describe('v1.FirestoreClient', () => {
assert(
(client.descriptors.page.listCollectionIds.asyncIterate as SinonStub)
.getCall(0)
.args[2].otherArgs.headers['x-goog-request-params'].includes(
expectedHeaderRequestParams
)
.args[2].otherArgs.headers[
'x-goog-request-params'
].includes(expectedHeaderRequestParams)
);
});

Expand Down Expand Up @@ -2969,9 +2969,9 @@ describe('v1.FirestoreClient', () => {
assert(
(client.descriptors.page.listCollectionIds.asyncIterate as SinonStub)
.getCall(0)
.args[2].otherArgs.headers['x-goog-request-params'].includes(
expectedHeaderRequestParams
)
.args[2].otherArgs.headers[
'x-goog-request-params'
].includes(expectedHeaderRequestParams)
);
});
});
Expand Down
Loading

0 comments on commit 3e91cf3

Please sign in to comment.