Description
During a codebase scan, several minor technical debt items and linting warnings were identified across the frontend and backend. While they do not cause immediate crashes, they create noisy logs, trigger linter warnings, and include technically incorrect logic.
Specifically:
- In
ProductCard.jsx, the checkInWishlist function from WishlistContext.jsx (which is a synchronous array check using .some()) is unnecessarily prefixed with await inside a useEffect.
- On the backend, there are unused
error variables in catch (error) blocks within product.controller.js and authMiddleware.js.
- The global error handler in
errorMiddleware.js triggers an "unused next variable" warning from ESLint. Express requires all four parameters (err, req, res, next) for it to be recognized as an error handler, so it should be renamed to _next to satisfy the linter.
Steps to reproduce
- Run
npx eslint BACKEND/ --ext .js in the terminal to see the unused variable warnings.
- Open
FRONTEND/src/components/ui/ProductCard.jsx and look at the checkInWishlist call in the useEffect.
Expected behaviour
- Remove the
await keyword from the synchronous checkInWishlist call.
- Remove the unused
error variables from catch blocks or prefix them with _ (e.g., catch (_error)).
- Rename
next to _next in errorMiddleware.js.
Affected files
FRONTEND/src/components/ui/ProductCard.jsx
BACKEND/controllers/product.controller.js
BACKEND/middleware/authMiddleware.js
BACKEND/middleware/errorMiddleware.js
Notes
These are quick cleanup tasks to keep the linter happy, maintain code hygiene, and prevent confusion for future contributors.
Description
During a codebase scan, several minor technical debt items and linting warnings were identified across the frontend and backend. While they do not cause immediate crashes, they create noisy logs, trigger linter warnings, and include technically incorrect logic.
Specifically:
ProductCard.jsx, thecheckInWishlistfunction fromWishlistContext.jsx(which is a synchronous array check using.some()) is unnecessarily prefixed withawaitinside auseEffect.errorvariables incatch (error)blocks withinproduct.controller.jsandauthMiddleware.js.errorMiddleware.jstriggers an "unused next variable" warning from ESLint. Express requires all four parameters(err, req, res, next)for it to be recognized as an error handler, so it should be renamed to_nextto satisfy the linter.Steps to reproduce
npx eslint BACKEND/ --ext .jsin the terminal to see the unused variable warnings.FRONTEND/src/components/ui/ProductCard.jsxand look at thecheckInWishlistcall in theuseEffect.Expected behaviour
awaitkeyword from the synchronouscheckInWishlistcall.errorvariables from catch blocks or prefix them with_(e.g.,catch (_error)).nextto_nextinerrorMiddleware.js.Affected files
FRONTEND/src/components/ui/ProductCard.jsxBACKEND/controllers/product.controller.jsBACKEND/middleware/authMiddleware.jsBACKEND/middleware/errorMiddleware.jsNotes
These are quick cleanup tasks to keep the linter happy, maintain code hygiene, and prevent confusion for future contributors.