Skip to content

Conversation

@Prithpal-Sooriya
Copy link
Contributor

@Prithpal-Sooriya Prithpal-Sooriya commented Dec 15, 2025

Explanation

The notification-services-controller package contained numerous ESLint suppressions for @typescript-eslint/explicit-function-return-type, id-length, id-denylist, and @typescript-eslint/no-misused-promises. These suppressions indicated areas where the code did not adhere to established linting rules, impacting readability, maintainability, and type safety.

This PR addresses these violations by:

  • Adding explicit return types to functions across NotificationServicesController.ts, NotificationServicesController.test.ts, and mockServices.ts to improve type clarity.
  • Renaming short identifiers (e.g., e, s, a, n, x) to more descriptive names to satisfy id-length and enhance readability.
  • Renaming err to error in catch blocks to comply with id-denylist.
  • Adding an eslint-disable comment with an explanation for a specific subscribe callback in NotificationServicesController.ts. This addresses @typescript-eslint/no-misused-promises where the promise result is intentionally not awaited due to the nature of the messaging system's callback.
    All corresponding entries have been removed from eslint-suppressions.json.

References

  • Fixes ASSETS-2100

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

Open in Cursor Open in Web


Note

Adds explicit function return types and stricter typings across the notification services controller, tests, and mocks, and removes related ESLint suppressions.

  • Notification Services Controller (NotificationServicesController.ts):
    • Add explicit return types to public/private methods and internal callbacks.
    • Refine typings for auth, push notifications, and accounts helpers; rename catch params to error.
    • Minor callback refactors (typed subscriptions, parameter names) without altering logic.
  • Tests (NotificationServicesController.test.ts):
    • Add explicit return types to helpers; strengthen mock types and function signatures.
    • Update arrange/act utilities to return typed objects (e.g., nock.Scope), adjust filters/callback param names.
    • Improve typedMockAction typing and rename auth failure scenario keys.
  • Fixtures (__fixtures__/mockServices.ts):
    • Ensure mocks return nock.Scope; type MockReply; add explicit return types.
  • Lint:
    • Remove entries from eslint-suppressions.json for these files related to @typescript-eslint/explicit-function-return-type, id-length, id-denylist, and @typescript-eslint/no-misused-promises.

Written by Cursor Bugbot for commit 889d9a8. This will update automatically on new commits. Configure here.

@cursor
Copy link

cursor bot commented Dec 15, 2025

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@Prithpal-Sooriya
Copy link
Contributor Author

@cursor update the packages/notification-services-controller/CHANGELOG.md changelog to reflect changes made.

@cursor
Copy link

cursor bot commented Dec 15, 2025

I've updated the packages/notification-services-controller/CHANGELOG.md with the following entry under the [Unreleased] section:

- Improve code quality by adding explicit return types, renaming short identifiers, and resolving ESLint violations ([#7487](https://github.com/MetaMask/core/pull/7487))

This entry succinctly describes the lint cleanup work that was done:

  • Adding explicit return types to functions
  • Renaming short identifiers (e.g., e, s, a, n, x) to more descriptive names
  • Resolving various ESLint violations (id-denylist, id-length, @typescript-eslint/no-misused-promises)

Open in Cursor Open in Web

Learn more about Cursor Agents

@Prithpal-Sooriya Prithpal-Sooriya marked this pull request as ready for review December 15, 2025 11:20
@Prithpal-Sooriya Prithpal-Sooriya requested review from a team as code owners December 15, 2025 11:20
@Prithpal-Sooriya Prithpal-Sooriya changed the title Notification services controller lint cleanup chore: Notification services controller lint cleanup Dec 15, 2025
@Prithpal-Sooriya
Copy link
Contributor Author

@cursor please remove the changelog changes, as these eslint changes does not impact the implementation

@cursor
Copy link

cursor bot commented Dec 15, 2025

Done! I've removed the changelog entry for the ESLint cleanup changes. Since these are internal code quality improvements that don't affect the implementation or public API, they don't need to be documented in the changelog.


Open in Cursor Open in Web

Learn more about Cursor Agents

@Prithpal-Sooriya Prithpal-Sooriya added this pull request to the merge queue Dec 15, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Dec 15, 2025
@Prithpal-Sooriya Prithpal-Sooriya added this pull request to the merge queue Dec 15, 2025
Merged via the queue into main with commit 32dd105 Dec 15, 2025
285 checks passed
@Prithpal-Sooriya Prithpal-Sooriya deleted the cursor/notification-services-controller-lint-cleanup-3028 branch December 15, 2025 13:12
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.

4 participants