-
-
Notifications
You must be signed in to change notification settings - Fork 262
chore: Notification services eslint cleanup #7480
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: Notification services eslint cleanup #7480
Conversation
…ions Co-authored-by: prithpal.sooriya <[email protected]>
|
Cursor Agent can help with this pull request. Just |
|
@cursor update the |
|
I've updated the ### Changed
- Add explicit return types to functions in `NotificationServicesPushController` ([#7480](https://github.com/MetaMask/core/pull/7480))This entry describes the ESLint cleanup work done in this PR, which adds explicit return types to functions in the following files:
Learn more about Cursor Agents |
Co-authored-by: prithpal.sooriya <[email protected]>
| const arrangeMocks = (override?: { | ||
| mockPut?: { status: number }; | ||
| }): { | ||
| params: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cursor I'm not a fan of the return type eslint here (it is pretty loose).
Lets disable for this line and the reason is because this is an internal testing util
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done! I've updated both arrangeMocks functions in services.test.ts to use eslint-disable comments instead of the verbose inline return types:
// Internal testing utility - return type is inferred
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
const arrangeMocks = (override?: { mockPut?: { status: number } }) => {The changes:
- Replaced the verbose inline return types with
eslint-disable-next-linecomments - Added explanation comments: "Internal testing utility - return type is inferred"
- Removed the now-unused
import type nock from 'nock'
All tests pass and ESLint is happy with the changes.
Learn more about Cursor Agents
Co-authored-by: prithpal.sooriya <[email protected]>
|
@cursor please remove the changelog changes, as these eslint changes does not impact the implementation |
|
Done! I've removed the changelog entry for this PR. Since ESLint cleanup changes don't impact the implementation, they don't need to be documented in the changelog. Learn more about Cursor Agents |
Co-authored-by: prithpal.sooriya <[email protected]>
Explanation
The current state includes ESLint suppressions for the
@typescript-eslint/explicit-function-return-typerule across several files in thenotification-services-controllerpackage. These suppressions hinder type safety and code clarity.This PR addresses these issues by:
@typescript-eslint/explicit-function-return-typein the following files:packages/notification-services-controller/src/NotificationServicesPushController/mocks/mockResponse.tspackages/notification-services-controller/src/NotificationServicesPushController/services/endpoints.tspackages/notification-services-controller/src/NotificationServicesPushController/services/services.test.tseslint-suppressions.json.For
services.test.ts, complex return types for test helper functions (arrangeMocks) were defined inline to ensure accuracy and avoidany. Additionally,import type nock from 'nock'was added to correctly typenock.Scopeinstances.References
Checklist
Note
Adds explicit function return types in push controller mocks, endpoints, and tests, and removes corresponding ESLint suppressions.
mocks/mockResponse.ts: Add explicitMockResponsereturn types to mock response factories.services/endpoints.ts: Add explicitstringreturn types toPUSH_APIandREGISTRATION_TOKENS_ENDPOINT.services/services.test.ts: Add explicit return types to test helpers (e.g.,mockErrorLog,act); keep some helpers inferred with targeted ESLint disable comments.eslint-suppressions.json: Remove entries for@typescript-eslint/explicit-function-return-typerelated to the above files.Written by Cursor Bugbot for commit 43b5233. This will update automatically on new commits. Configure here.