Commit 736915b
chore: Notification services eslint cleanup (#7480)
## Explanation
The current state includes ESLint suppressions for the
`@typescript-eslint/explicit-function-return-type` rule across several
files in the `notification-services-controller` package. These
suppressions hinder type safety and code clarity.
This PR addresses these issues by:
1. Adding explicit return types to all functions previously suppressed
for `@typescript-eslint/explicit-function-return-type` in the following
files:
*
`packages/notification-services-controller/src/NotificationServicesPushController/mocks/mockResponse.ts`
*
`packages/notification-services-controller/src/NotificationServicesPushController/services/endpoints.ts`
*
`packages/notification-services-controller/src/NotificationServicesPushController/services/services.test.ts`
2. Removing the corresponding entries from `eslint-suppressions.json`.
For `services.test.ts`, complex return types for test helper functions
(`arrangeMocks`) were defined inline to ensure accuracy and avoid `any`.
Additionally, `import type nock from 'nock'` was added to correctly type
`nock.Scope` instances.
## 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](https://github.com/MetaMask/core/tree/main/docs/contributing.md#updating-changelogs)
- [ ] I've introduced [breaking
changes](https://github.com/MetaMask/core/tree/main/docs/breaking-changes.md)
in this PR and have prepared draft pull requests for clients and
consumer packages to resolve them
---
<a
href="https://cursor.com/background-agent?bcId=bc-616b0f52-ef58-45f1-a2f5-19573c662b74"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://cursor.com/open-in-cursor-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://cursor.com/open-in-cursor-light.svg"><img alt="Open in
Cursor"
src="https://cursor.com/open-in-cursor.svg"></picture></a> <a
href="https://cursor.com/agents?id=bc-616b0f52-ef58-45f1-a2f5-19573c662b74"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://cursor.com/open-in-web-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://cursor.com/open-in-web-light.svg"><img alt="Open in Web"
src="https://cursor.com/open-in-web.svg"></picture></a>
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> Adds explicit function return types in push controller mocks,
endpoints, and tests, and removes corresponding ESLint suppressions.
>
> - **Notification Services Push Controller**:
> - `mocks/mockResponse.ts`: Add explicit `MockResponse` return types to
mock response factories.
> - `services/endpoints.ts`: Add explicit `string` return types to
`PUSH_API` and `REGISTRATION_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.
> - **Tooling**:
> - `eslint-suppressions.json`: Remove entries for
`@typescript-eslint/explicit-function-return-type` related to the above
files.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
43b5233. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
---------
Co-authored-by: Cursor Agent <cursoragent@cursor.com>1 parent 81825c0 commit 736915b
File tree
4 files changed
+11
-22
lines changed- packages/notification-services-controller/src/NotificationServicesPushController
- mocks
- services
4 files changed
+11
-22
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1689 | 1689 | | |
1690 | 1690 | | |
1691 | 1691 | | |
1692 | | - | |
1693 | | - | |
1694 | | - | |
1695 | | - | |
1696 | | - | |
1697 | | - | |
1698 | | - | |
1699 | | - | |
1700 | | - | |
1701 | | - | |
1702 | | - | |
1703 | | - | |
1704 | | - | |
1705 | | - | |
1706 | | - | |
1707 | 1692 | | |
1708 | 1693 | | |
1709 | 1694 | | |
| |||
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | | - | |
| 38 | + | |
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
13 | 13 | | |
Lines changed: 6 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
| 57 | + | |
| 58 | + | |
57 | 59 | | |
58 | 60 | | |
59 | 61 | | |
| |||
124 | 126 | | |
125 | 127 | | |
126 | 128 | | |
| 129 | + | |
| 130 | + | |
127 | 131 | | |
128 | 132 | | |
129 | 133 | | |
| |||
0 commit comments