Skip to content

chore(solana): replace in and type the Solana subscription services - #631

Open
ulissesferreira wants to merge 1 commit into
mainfrom
chore/solana-lint-suppressions-subscriptions
Open

ulissesferreira wants to merge 1 commit into
mainfrom
chore/solana-lint-suppressions-subscriptions

Conversation

@ulissesferreira

Copy link
Copy Markdown
Contributor

Description

Clears the Oxlint suppressions for the Solana subscription services. The 9 internal-snaps/no-in-operator violations are replaced by hasProperty() from @metamask/utils, which is a drop-in own-property check with the same narrowing behaviour (importers in parent chains are no longer consulted), so no logic or control flow was restructured. The rest is typing hygiene: the WebSocket payload parsers, the notification-handler registry and the test mocks are now typed instead of any, redundant assertions and leftover return-type gaps are filled in.

This is behaviour-neutral: the only runtime-visible differences are that hasProperty() reads own properties (the point of the rule) and that String() is applied explicitly to the already-never-narrowed event type in the warning log. Two test mock factories now return a real WebSocketMessage (they gained the origin field the type requires); the parser under test never reads origin.

Changes

  • packages/solana-wallet-snap/src/core/services/subscriptions/SubscriptionService.ts — hasProperty() in the confirmation guards and #handleFailure; message: object / obj: unknown instead of any; DispatchableNotificationHandler for the notification dispatch; arrow wrappers for the #isExpired / #isNotExpired filters; explicit return type on sendSubscriptionMessage (no-in-operator, no-explicit-any, no-unsafe-*, unbound-method, explicit-function-return-type)
  • packages/solana-wallet-snap/src/core/services/subscriptions/SubscriptionRepository.ts — hasProperty() in findBy (no-in-operator)
  • packages/solana-wallet-snap/src/core/services/subscriptions/parseWebSocketMessage.ts — owns a let jsonParsed: unknown and hasProperty() on the SIP-20 payload (no-in-operator, no-explicit-any, no-unsafe-assignment, no-unsafe-return)
  • packages/solana-wallet-snap/src/core/services/subscriptions/SignatureMonitor.ts — dropped the redundant transaction.type assertion (no-unnecessary-type-assertion)
  • packages/solana-wallet-snap/src/core/services/subscriptions/KeyringAccountMonitor.ts, WebSocketConnectionRepository.ts — explicit return types (explicit-function-return-type)
  • packages/solana-wallet-snap/src/core/services/subscriptions/WebSocketConnectionService.ts — String(type) in the unknown-event warning (restrict-template-expressions)
  • packages/solana-wallet-snap/src/core/services/subscriptions/SubscriptionService.test.ts, SignatureMonitor.test.ts, KeyringAccountMonitor.test.ts, WebSocketConnectionRepository.test.ts, WebSocketConnectionService.test.ts — typed mocks and helpers, it.each table for the background-event cases (no-explicit-any, no-unsafe-*, explicit-function-return-type, no-conditional-in-test)
  • oxlint-suppressions.json — regenerated with --prune-suppressions

Quality gates

  • yarn lint:oxlint packages/solana-wallet-snap — clean, 12 suppressions entries removed (60 violations)
  • tsc --noEmit — clean
  • vitest run — 88 files, 1124 passed | 4 skipped | 1 todo
  • oxfmt --check — clean

@sonarqubecloud

Copy link
Copy Markdown

This branch was previously deployed

1 inactive deployment
default-branch — a097eca2 Deployed Nov 17, 2026 by ulissesferreira via Determine whether this PR is a release PR #2402
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant