Skip to content

Commit b80daf1

Browse files
Fix ESLint errors with new typescript-eslint (#695)
Signed-off-by: Mark S. Lewis <Mark.S.Lewis@outlook.com>
1 parent 14e5a8a commit b80daf1

File tree

6 files changed

+14
-14
lines changed

6 files changed

+14
-14
lines changed

node/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@
4747
"@types/google-protobuf": "^3.15.12",
4848
"@types/jest": "^29.5.12",
4949
"@types/node": "^18.19.22",
50-
"@typescript-eslint/eslint-plugin": "^7.1.1",
51-
"@typescript-eslint/parser": "^7.1.1",
50+
"@typescript-eslint/eslint-plugin": "~7.3.1",
51+
"@typescript-eslint/parser": "~7.3.1",
5252
"eslint": "^8.57.0",
5353
"eslint-config-prettier": "^9.1.0",
5454
"eslint-plugin-jest": "^27.9.0",
@@ -58,6 +58,6 @@
5858
"prettier": "^3.2.5",
5959
"ts-jest": "^29.1.2",
6060
"typedoc": "^0.25.11",
61-
"typescript": "~5.3.3"
61+
"typescript": "~5.4.2"
6262
}
6363
}

node/src/blockeventsrequest.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,8 +231,8 @@ function mapAsyncIterator<T, R>(iterator: AsyncIterator<T>, map: (element: T) =>
231231

232232
function getBlock<T>(response: peer.DeliverResponse, getter: () => T | null | undefined): T {
233233
if (response.getTypeCase() === peer.DeliverResponse.TypeCase.STATUS) {
234-
throw new Error(`Unexpected status response: ${response.getStatus()}`);
234+
throw new Error(`Unexpected status response: ${String(response.getStatus())}`);
235235
}
236236
const block = getter();
237-
return assertDefined(block, `Unexpected deliver response type: ${response.getTypeCase()}`);
237+
return assertDefined(block, `Unexpected deliver response type: ${String(response.getTypeCase())}`);
238238
}

node/src/commiterror.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export class CommitError extends Error {
3838

3939
export function newCommitError(status: Status): CommitError {
4040
return new CommitError({
41-
message: `Transaction ${status.transactionId} failed to commit with status code ${status.code} (${StatusNames[status.code]})`,
41+
message: `Transaction ${status.transactionId} failed to commit with status code ${String(status.code)} (${StatusNames[status.code]})`,
4242
code: status.code,
4343
transactionId: status.transactionId,
4444
});

node/src/testutils.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -201,31 +201,31 @@ export class MockGatewayGrpcClient implements GatewayGrpcClient {
201201
}
202202

203203
mockCommitStatusError(err: grpc.ServiceError): void {
204-
this.#commitStatusMock.mockImplementation(fakeUnaryCall(err, undefined));
204+
this.#commitStatusMock.mockImplementation(fakeUnaryCall<gateway.CommitStatusResponse>(err, undefined));
205205
}
206206

207207
mockEndorseResponse(response: gateway.EndorseResponse): void {
208208
this.#endorseMock.mockImplementation(fakeUnaryCall(undefined, response));
209209
}
210210

211211
mockEndorseError(err: grpc.ServiceError): void {
212-
this.#endorseMock.mockImplementation(fakeUnaryCall(err, undefined));
212+
this.#endorseMock.mockImplementation(fakeUnaryCall<gateway.EndorseResponse>(err, undefined));
213213
}
214214

215215
mockEvaluateResponse(response: gateway.EvaluateResponse): void {
216216
this.#evaluateMock.mockImplementation(fakeUnaryCall(undefined, response));
217217
}
218218

219219
mockEvaluateError(err: grpc.ServiceError): void {
220-
this.#evaluateMock.mockImplementation(fakeUnaryCall(err, undefined));
220+
this.#evaluateMock.mockImplementation(fakeUnaryCall<gateway.EvaluateResponse>(err, undefined));
221221
}
222222

223223
mockSubmitResponse(response: gateway.SubmitResponse): void {
224224
this.#submitMock.mockImplementation(fakeUnaryCall(undefined, response));
225225
}
226226

227227
mockSubmitError(err: grpc.ServiceError): void {
228-
this.#submitMock.mockImplementation(fakeUnaryCall(err, undefined));
228+
this.#submitMock.mockImplementation(fakeUnaryCall<gateway.SubmitResponse>(err, undefined));
229229
}
230230

231231
mockChaincodeEventsResponse(stream: ServerStreamResponse<gateway.ChaincodeEventsResponse>): void {

scenario/node/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@
2828
"@cucumber/cucumber": "^10.3.1",
2929
"@tsconfig/node18": "^18.2.2",
3030
"@types/node": "^18.19.22",
31-
"@typescript-eslint/eslint-plugin": "^7.1.1",
32-
"@typescript-eslint/parser": "^7.1.1",
31+
"@typescript-eslint/eslint-plugin": "~7.3.1",
32+
"@typescript-eslint/parser": "~7.3.1",
3333
"cucumber-console-formatter": "^1.0.0",
3434
"eslint": "^8.57.0",
3535
"eslint-config-prettier": "^9.1.0",
3636
"expect": "^29.7.0",
3737
"npm-run-all": "^4.1.5",
3838
"prettier": "^3.2.5",
39-
"typescript": "~5.3.3"
39+
"typescript": "~5.4.2"
4040
}
4141
}

scenario/node/src/transactioninvocation.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ export class TransactionInvocation {
9393
this.blockNumber = status.blockNumber;
9494

9595
if (status.code !== StatusCode.VALID) {
96-
throw new Error(`Transaction commit failed with status: ${status.code}`);
96+
throw new Error(`Transaction commit failed with status: ${String(status.code)}`);
9797
}
9898

9999
return submitted.getResult();

0 commit comments

Comments
 (0)