diff --git a/eslint.config.mjs b/eslint.config.mjs index 752c49bbd..716e645e8 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -94,7 +94,7 @@ export default defineConfig([ // *************** Code style and best practices *************** "unused-imports/no-unused-imports": "error", "unused-imports/no-unused-vars": [ - "off", // // https://github.com/eclipse-thingweb/node-wot/issues/1430 + "error", { args: "none", varsIgnorePattern: "Test", diff --git a/packages/binding-http/src/routes/action.ts b/packages/binding-http/src/routes/action.ts index 2ed663e43..4acbf133a 100644 --- a/packages/binding-http/src/routes/action.ts +++ b/packages/binding-http/src/routes/action.ts @@ -48,7 +48,7 @@ export default async function actionRoute( let contentType: string = Array.isArray(contentTypeHeader) ? contentTypeHeader[0] : contentTypeHeader; try { contentType = validOrDefaultRequestContentType(req, res, contentType); - } catch (error) { + } catch { warn( `HttpServer received unsupported Content-Type from ${Helpers.toUriLiteral(req.socket.remoteAddress)}:${ req.socket.remotePort diff --git a/packages/binding-http/src/routes/property.ts b/packages/binding-http/src/routes/property.ts index 916bc6a9b..b0fcadbf5 100644 --- a/packages/binding-http/src/routes/property.ts +++ b/packages/binding-http/src/routes/property.ts @@ -48,7 +48,7 @@ export default async function propertyRoute( let contentType: string = Array.isArray(contentTypeHeader) ? contentTypeHeader[0] : contentTypeHeader; try { contentType = validOrDefaultRequestContentType(req, res, contentType); - } catch (error) { + } catch { warn( `HttpServer received unsupported Content-Type from ${Helpers.toUriLiteral(req.socket.remoteAddress)}:${ req.socket.remotePort diff --git a/packages/binding-http/test/http-client-test.ts b/packages/binding-http/test/http-client-test.ts index d5ec90e28..84ad9b438 100644 --- a/packages/binding-http/test/http-client-test.ts +++ b/packages/binding-http/test/http-client-test.ts @@ -176,7 +176,7 @@ class TestHttpServer implements ProtocolServer { { type: ContentSerdes.DEFAULT, body: Buffer.concat(body) }, this.testVector.schema ?? { type: "string" } ); - } catch (err) { + } catch { throw new Error("Cannot deserialize client payload"); } expect(value).to.equal(this.testVector?.payload); diff --git a/packages/binding-http/test/oauth-token-validation-tests.ts b/packages/binding-http/test/oauth-token-validation-tests.ts index ef1a2b5cd..94f06a66b 100644 --- a/packages/binding-http/test/oauth-token-validation-tests.ts +++ b/packages/binding-http/test/oauth-token-validation-tests.ts @@ -265,7 +265,7 @@ describe("OAuth2.0 Validator tests", () => { try { await this.validator.validate(req as http.IncomingMessage, [], /.*/g); assert(false, "method did not throw"); - } catch (error) { + } catch { assert(true); } } @@ -287,7 +287,7 @@ describe("OAuth2.0 Validator tests", () => { try { await this.validator.validate(req as http.IncomingMessage, [], /.*/g); assert(false, "method did not throw"); - } catch (error) { + } catch { assert(true); } } @@ -309,7 +309,7 @@ describe("OAuth2.0 Validator tests", () => { try { await this.validator.validate(req as http.IncomingMessage, [], /.*/g); assert(false, "method did not throw"); - } catch (error) { + } catch { assert(true); } } @@ -331,7 +331,7 @@ describe("OAuth2.0 Validator tests", () => { try { await this.validator.validate(req as http.IncomingMessage, [], /.*/g); assert(false, "method did not throw"); - } catch (error) { + } catch { assert(true); } } diff --git a/packages/core/src/helpers.ts b/packages/core/src/helpers.ts index a2a9a29b7..e39fb8c48 100644 --- a/packages/core/src/helpers.ts +++ b/packages/core/src/helpers.ts @@ -211,7 +211,7 @@ export default class Helpers implements Resolver { public static async parseInteractionOutput(response: WoT.InteractionOutput): Promise { try { return await response.value(); - } catch (err) { + } catch { // TODO if response.value() fails, try low-level stream read error("parseInteractionOutput low-level stream not implemented"); throw new Error("parseInteractionOutput low-level stream not implemented");