Skip to content

fix: resolve unused-catch lint errors in shared UI flows#258

Closed
nayan9617 wants to merge 2 commits into
shopstr-eng:mainfrom
nayan9617:fix/lint-unused-catch-and-expressions
Closed

fix: resolve unused-catch lint errors in shared UI flows#258
nayan9617 wants to merge 2 commits into
shopstr-eng:mainfrom
nayan9617:fix/lint-unused-catch-and-expressions

Conversation

@nayan9617

@nayan9617 nayan9617 commented Apr 2, 2026

Copy link
Copy Markdown
Contributor

Summary

-fixes lint errors caused by unused catch parameters in common payment/sign-in/utility flows

  • replaces side-effect ternary/short-circuit expressions with explicit control flow where needed
  • keeps behavior unchanged while improving lint compliance for issue [BUG] Project-wide Linting errors #174

Files touched

  • components/utility-components/auth-challenge-modal.tsx
  • components/utility-components/request-passphrase-modal.tsx
  • components/utility-components/product-card.tsx
  • components/sign-in/SignInModal.tsx
  • components/utility-components/claim-button.tsx
  • components/wallet/pay-button.tsx
  • components/wallet/receive-button.tsx
  • components/wallet/send-button.tsx
  • components/product-invoice-card.tsx

Validation

  • npm run type-check
  • npm run lint on edited files
  • npm run lint (still has existing repo-wide warnings/errors unrelated to this focused fix)

Copilot AI review requested due to automatic review settings April 2, 2026 10:42
@vercel

vercel Bot commented Apr 2, 2026

Copy link
Copy Markdown

@nayan9617 is attempting to deploy a commit to the shopstr-eng Team on Vercel.

A member of the Team first needs to authorize it.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses lint failures from unused catch parameters across shared UI flows and replaces side-effect ternary/short-circuit expressions with explicit control flow to keep behavior stable while improving lint compliance (issue #174).

Changes:

  • Replaced catch (e|err|_) with optional catch binding catch {} in multiple components.
  • Replaced side-effect ternary and && invocation patterns with explicit if/else control flow in modal/card handlers.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
components/wallet/send-button.tsx Uses optional catch binding to avoid unused catch parameter lint errors.
components/wallet/receive-button.tsx Uses optional catch binding to avoid unused catch parameter lint errors.
components/wallet/pay-button.tsx Uses optional catch binding for payment + fee calculation flows.
components/utility-components/request-passphrase-modal.tsx Replaces ternary navigation with explicit if/else routing.
components/utility-components/product-card.tsx Uses optional catch binding and replaces && click handler with explicit if.
components/utility-components/claim-button.tsx Uses optional catch binding to avoid unused catch parameter lint errors.
components/utility-components/auth-challenge-modal.tsx Uses optional catch binding and replaces ternary navigation with explicit if/else.
components/sign-in/SignInModal.tsx Uses optional catch binding for sign-in/decrypt failure paths.
components/product-invoice-card.tsx Uses optional catch binding in invoice/payment error paths.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

deletedEventIds
);
} catch (_) {
} catch {

Copilot AI Apr 2, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional catch binding (catch {}) requires ES2019+ syntax support at runtime/build output. If this project targets older JS (or ships untranspiled bundles), this can cause a syntax error. If you need broader compatibility, consider reverting to catch (err) and making the variable "used" (e.g., void err;) or updating ESLint’s caught-error ignore pattern (e.g., allow _err) so you can keep catch (_err) without changing emitted syntax.

Suggested change
} catch {
} catch (err) {
void err;

Copilot uses AI. Check for mistakes.
window.open(`https://njump.me/${nevent}`, "_blank");
} catch (err) {
} catch {
// console.error("Failed to generate njump link", err);

Copilot AI Apr 2, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The commented-out log still references err, but the catch binding was removed. This comment is now misleading and would be incorrect if uncommented. Update the comment to remove the err reference, or reintroduce a named catch binding if you intend to keep an error object available for logging.

Suggested change
// console.error("Failed to generate njump link", err);
// console.error("Failed to generate njump link");

Copilot uses AI. Check for mistakes.
@GautamBytes GautamBytes self-assigned this Apr 3, 2026
@GautamBytes

Copy link
Copy Markdown
Contributor

Your lint cleanup looks fine overall, but the branch is a bit behind current main right now.
After rebasing, please keep the newer bunker sign-in flow pointing to /marketplace instead of reverting it back to /onboarding/user-profile.

Once that’s updated, it should be in good shape to merge.

@nayan9617

Copy link
Copy Markdown
Contributor Author

Thanks for the review!
I’ll rebase onto the latest main and make sure the bunker sign-in flow continues to point to /marketplace instead of /onboarding/user-profile. I’ll update the branch and push the changes shortly.

@nayan9617 nayan9617 force-pushed the fix/lint-unused-catch-and-expressions branch from ffa255c to ab1943f Compare April 3, 2026 08:21
@nayan9617

Copy link
Copy Markdown
Contributor Author

hi @GautamBytes, I've made the required changes. Kindly have a look!

@nayan9617

Copy link
Copy Markdown
Contributor Author

@GautamBytes kindly let me know if further changes needed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants