[go: nahoru, domu]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: fix lint errors #2074

Merged
merged 1 commit into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
chore: fix lint errors
  • Loading branch information
MarkDuckworth committed Jun 24, 2024
commit 942f71a64ff382c1d61b6b537d2e7b03bdd779b0
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
Loading