From b1101701ac3ecf5b83bef221f1330d66ffc5300a Mon Sep 17 00:00:00 2001 From: Jayden Seric Date: Mon, 7 Oct 2024 12:35:50 +1100 Subject: [PATCH] Enable the TypeScript compiler options `noUnusedLocals` and `noUnusedParameters`. --- changelog.md | 1 + graphqlUploadExpress.test.mjs | 12 ++++++------ jsconfig.json | 2 ++ 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/changelog.md b/changelog.md index 24d1dec..42e1241 100644 --- a/changelog.md +++ b/changelog.md @@ -42,6 +42,7 @@ - Omit unused catch bindings in the function `processRequest`. - Corrected the JSDoc type `FileUploadCreateReadStreamOptions` in the module `processRequest.mjs`. - Added a new dev dependency [`async-listen`](https://npm.im/async-listen) to replace the test utility function `listen`. +- Enabled the TypeScript compiler options `noUnusedLocals` and `noUnusedParameters` and used the prefix `_` for purposefully unused function parameters in tests. ## 16.0.2 diff --git a/graphqlUploadExpress.test.mjs b/graphqlUploadExpress.test.mjs index 45abc79..8873708 100644 --- a/graphqlUploadExpress.test.mjs +++ b/graphqlUploadExpress.test.mjs @@ -60,7 +60,7 @@ describe( const server = createServer( express() .use(graphqlUploadExpress()) - .use((request, response, next) => { + .use((request, _response, next) => { requestBody = request.body; next(); }), @@ -109,7 +109,7 @@ describe( }, }), ) - .use((request, response, next) => { + .use((request, _response, next) => { requestBody = request.body; next(); }), @@ -169,11 +169,11 @@ describe( .use( /** * @param {Error} error - * @param {Request} request + * @param {Request} _request * @param {Response} response * @param {NextFunction} next */ - (error, request, response, next) => { + (error, _request, response, next) => { expressError = error; responseStatusCode = response.statusCode; @@ -237,11 +237,11 @@ describe( .use( /** * @param {Error} error - * @param {Request} request + * @param {Request} _request * @param {Response} response * @param {NextFunction} next */ - (error, request, response, next) => { + (error, _request, response, next) => { expressError = error; // Sending a response here prevents the default Express error diff --git a/jsconfig.json b/jsconfig.json index 7935e73..62de3de 100644 --- a/jsconfig.json +++ b/jsconfig.json @@ -3,6 +3,8 @@ "maxNodeModuleJsDepth": 10, "module": "nodenext", "noEmit": true, + "noUnusedLocals": true, + "noUnusedParameters": true, "strict": true }, "typeAcquisition": {