diff --git a/eslint-suppressions.json b/eslint-suppressions.json index 236edf2cb1c..b266997c2e8 100644 --- a/eslint-suppressions.json +++ b/eslint-suppressions.json @@ -1560,21 +1560,6 @@ "count": 3 } }, - "packages/notification-services-controller/src/NotificationServicesController/constants/notification-schema.ts": { - "@typescript-eslint/naming-convention": { - "count": 18 - } - }, - "packages/notification-services-controller/src/NotificationServicesController/mocks/mockResponses.ts": { - "@typescript-eslint/explicit-function-return-type": { - "count": 6 - } - }, - "packages/notification-services-controller/src/NotificationServicesController/processors/process-api-notifications.test.ts": { - "id-length": { - "count": 1 - } - }, "packages/notification-services-controller/src/NotificationServicesController/services/perp-notifications.ts": { "@typescript-eslint/explicit-function-return-type": { "count": 1 diff --git a/packages/notification-services-controller/src/NotificationServicesController/constants/notification-schema.ts b/packages/notification-services-controller/src/NotificationServicesController/constants/notification-schema.ts index 6a3a2252779..256ac2dde93 100644 --- a/packages/notification-services-controller/src/NotificationServicesController/constants/notification-schema.ts +++ b/packages/notification-services-controller/src/NotificationServicesController/constants/notification-schema.ts @@ -1,3 +1,5 @@ +// Using SCREAMING_SNAKE_CASE for enum name and members to mirror snake_case API string values for readability +/* eslint-disable @typescript-eslint/naming-convention */ export enum TRIGGER_TYPES { FEATURES_ANNOUNCEMENT = 'features_announcement', METAMASK_SWAP_COMPLETED = 'metamask_swap_completed', @@ -18,6 +20,7 @@ export enum TRIGGER_TYPES { SNAP = 'snap', PLATFORM = 'platform', } +/* eslint-enable @typescript-eslint/naming-convention */ export const NOTIFICATION_API_TRIGGER_TYPES_SET: Set = new Set([ TRIGGER_TYPES.METAMASK_SWAP_COMPLETED, @@ -50,5 +53,7 @@ export const NOTIFICATION_CHAINS_ID = { SEI: '1329', } as const; +// Kept as SCREAMING_SNAKE_CASE for backwards compatibility +// eslint-disable-next-line @typescript-eslint/naming-convention export type NOTIFICATION_CHAINS_IDS = (typeof NOTIFICATION_CHAINS_ID)[keyof typeof NOTIFICATION_CHAINS_ID]; diff --git a/packages/notification-services-controller/src/NotificationServicesController/mocks/mockResponses.ts b/packages/notification-services-controller/src/NotificationServicesController/mocks/mockResponses.ts index b3fd8a81fb5..0f64997e060 100644 --- a/packages/notification-services-controller/src/NotificationServicesController/mocks/mockResponses.ts +++ b/packages/notification-services-controller/src/NotificationServicesController/mocks/mockResponses.ts @@ -17,6 +17,8 @@ type MockResponse = { export const CONTENTFUL_RESPONSE = createMockFeatureAnnouncementAPIResult(); +// Using `satisfies` to preserve narrow return types while ensuring type safety; explicit return types would widen to MockResponse +/* eslint-disable @typescript-eslint/explicit-function-return-type */ export const getMockFeatureAnnouncementResponse = () => { return { url: FEATURE_ANNOUNCEMENT_API, @@ -40,10 +42,13 @@ export const getMockOnChainNotificationsConfig = () => { response: [{ address: '0xTestAddress', enabled: true }], } satisfies MockResponse; }; +/* eslint-enable @typescript-eslint/explicit-function-return-type */ export const MOCK_RAW_ON_CHAIN_NOTIFICATIONS = createMockRawOnChainNotifications(); +// Using `satisfies` to preserve narrow return types while ensuring type safety; explicit return types would widen to MockResponse +/* eslint-disable @typescript-eslint/explicit-function-return-type */ export const getMockListNotificationsResponse = () => { return { url: NOTIFICATION_API_LIST_ENDPOINT(), @@ -67,3 +72,4 @@ export const getMockCreatePerpOrderNotification = () => { response: null, } satisfies MockResponse; }; +/* eslint-enable @typescript-eslint/explicit-function-return-type */ diff --git a/packages/notification-services-controller/src/NotificationServicesController/processors/process-api-notifications.test.ts b/packages/notification-services-controller/src/NotificationServicesController/processors/process-api-notifications.test.ts index 4fe53b68a8d..2960de47dfa 100644 --- a/packages/notification-services-controller/src/NotificationServicesController/processors/process-api-notifications.test.ts +++ b/packages/notification-services-controller/src/NotificationServicesController/processors/process-api-notifications.test.ts @@ -38,7 +38,7 @@ const rawNotifications = [ ]; const rawNotificationTestSuite = rawNotifications.map( - (n) => [n.type, n] as const, + (notification) => [notification.type, notification] as const, ); describe('process-onchain-notifications - processOnChainNotification()', () => {