Skip to content

Commit 11cf87a

Browse files
chore: Notification controller eslint cleanup (#7479)
## Explanation This PR addresses ESLint suppressions in `packages/notification-services-controller` as part of the ASSETS-2100 cleanup initiative. * **Current state and why it needs to change:** The specified files had existing ESLint suppressions for `@typescript-eslint/explicit-function-return-type`, `id-length`, and `@typescript-eslint/naming-convention`. These suppressions needed to be resolved to improve code quality and consistency. * **Solution your changes offer and how it works:** * In `perp-notifications.ts`, the `createPerpOrderNotification` function now has an explicit `Promise<void>` return type, and the catch block variable `e` was renamed to `error` to satisfy `id-length`. * In `notification-api.ts` and `schema.ts`, file-level `eslint-disable @typescript-eslint/naming-convention` comments were added. * **Changes whose purpose might not be obvious:** The `eslint-disable` comments for `naming-convention` are intentional. `schema.ts` is an auto-generated file from an OpenAPI specification, and `notification-api.ts` defines types directly derived from an external Notification API, both of which dictate their own naming conventions (e.g., snake_case) that cannot be changed without breaking compatibility or manual intervention that would be overwritten. ## References * Fixes [ASSETS-2100](https://consensyssoftware.atlassian.net/browse/ASSETS-2100) ## Checklist - [x] 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-29b62e75-f654-4fb7-819e-bfdcb9872187"><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>&nbsp;<a href="https://cursor.com/agents?id=bc-29b62e75-f654-4fb7-819e-bfdcb9872187"><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> [ASSETS-2100]: https://consensyssoftware.atlassian.net/browse/ASSETS-2100?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Removes ESLint suppressions by adding an explicit return type and standardizing error variable in `perp-notifications.ts`, adding file-level `naming-convention` disables to API-derived type files, and updating `eslint-suppressions.json`. > > - **Notification Services Controller**: > - `services/perp-notifications.ts`: Add explicit `Promise<void>` return type to `createPerpOrderNotification`; rename catch variable to `error`. > - `types/notification-api/notification-api.ts`: Add file-level `eslint-disable @typescript-eslint/naming-convention` with note about external schema. > - `types/notification-api/schema.ts`: Add file-level `eslint-disable @typescript-eslint/naming-convention` and auto-generated file note. > - **ESLint suppressions**: > - Update `eslint-suppressions.json` to remove entries for the above files. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 8ddabd4. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: Cursor Agent <[email protected]>
1 parent 4a396db commit 11cf87a

File tree

4 files changed

+7
-21
lines changed

4 files changed

+7
-21
lines changed

eslint-suppressions.json

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1560,24 +1560,6 @@
15601560
"count": 3
15611561
}
15621562
},
1563-
"packages/notification-services-controller/src/NotificationServicesController/services/perp-notifications.ts": {
1564-
"@typescript-eslint/explicit-function-return-type": {
1565-
"count": 1
1566-
},
1567-
"id-length": {
1568-
"count": 1
1569-
}
1570-
},
1571-
"packages/notification-services-controller/src/NotificationServicesController/types/notification-api/notification-api.ts": {
1572-
"@typescript-eslint/naming-convention": {
1573-
"count": 18
1574-
}
1575-
},
1576-
"packages/notification-services-controller/src/NotificationServicesController/types/notification-api/schema.ts": {
1577-
"@typescript-eslint/naming-convention": {
1578-
"count": 70
1579-
}
1580-
},
15811563
"packages/phishing-controller/src/BulkTokenScan.test.ts": {
15821564
"@typescript-eslint/explicit-function-return-type": {
15831565
"count": 2

packages/notification-services-controller/src/NotificationServicesController/services/perp-notifications.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export const PERPS_API_CREATE_ORDERS = `${PERPS_API}/api/v1/orders`;
1717
export async function createPerpOrderNotification(
1818
bearerToken: string,
1919
orderInput: OrderInput,
20-
) {
20+
): Promise<void> {
2121
try {
2222
await createServicePolicy().execute(async () => {
2323
return successfulFetch(PERPS_API_CREATE_ORDERS, {
@@ -29,7 +29,7 @@ export async function createPerpOrderNotification(
2929
body: JSON.stringify(orderInput),
3030
});
3131
});
32-
} catch (e) {
33-
console.error('Failed to create perp order notification', e);
32+
} catch (error) {
33+
console.error('Failed to create perp order notification', error);
3434
}
3535
}

packages/notification-services-controller/src/NotificationServicesController/types/notification-api/notification-api.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// Types derived from external Notification API schema - naming follows API conventions
2+
/* eslint-disable @typescript-eslint/naming-convention */
13
import type { components } from './schema';
24
import type { TRIGGER_TYPES } from '../../constants/notification-schema';
35
import type { Compute } from '../type-utils';

packages/notification-services-controller/src/NotificationServicesController/types/notification-api/schema.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
/* eslint-disable jsdoc/tag-lines */
2+
// Auto-generated from OpenAPI spec - naming follows API schema conventions
3+
/* eslint-disable @typescript-eslint/naming-convention */
24

35
/**
46
* This file was auto-generated by openapi-typescript.

0 commit comments

Comments
 (0)