-
-
Notifications
You must be signed in to change notification settings - Fork 262
chore: Notification services eslint cleanup #7482
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 #7482
Conversation
Removes unused ESLint suppressions and refactors notification processing logic. Updates API interaction functions for clarity and type safety. Co-authored-by: prithpal.sooriya <[email protected]>
|
Cursor Agent can help with this pull request. Just |
core
Outdated
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 remove this file
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 update the |
|
I've completed both tasks:
- Improve code quality by fixing ESLint violations ([#7482](https://github.com/MetaMask/core/pull/7482))
- Added explicit return types to functions for improved type safety
- Renamed short variable names to be more descriptive (e.g., `n` → `notification`, `a` → `addr`)
- Refactored to avoid parameter reassignment, promoting immutabilityThe changes are ready to be staged and committed. Would you like me to stage these 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! The changelog changes have been removed. The working tree is now clean with no pending changes. The ESLint cleanup changes in the code files remain intact, but the changelog entry has been reverted since these are internal code quality improvements that don't impact the package's public API or behavior. Learn more about Cursor Agents |
Explanation
The
notification-services-controllerpackage had several ESLint suppressions ineslint-suppressions.jsonfor rules such as@typescript-eslint/explicit-function-return-type,id-length,id-denylist, andno-param-reassign. These suppressions indicated deviations from our established linting standards, affecting code readability, maintainability, and type safety.This PR resolves all identified ESLint violations in
process-notifications.ts,api-notifications.ts, andfeature-announcements.test.ts.@typescript-eslint/explicit-function-return-type: Explicit return types were added to functions for improved type safety and clarity.id-lengthandid-denylist: Short or disallowed variable names were refactored to be more descriptive, enhancing readability.no-param-reassign: Code was refactored to avoid reassigning function parameters, promoting immutability and preventing unexpected side effects.After fixing the code, the corresponding entries were removed from
eslint-suppressions.json.id-length, many single-character variables (e.g.,n,a,r) were expanded to full, descriptive names (e.g.,notification,addr,response).no-param-reassign, new variables were introduced to hold modified data instead of directly altering the original function parameters.explicit-function-return-type, specific types likeneverfor exhaustive checks andPromise<void>for async functions were added where appropriate.References
Checklist
Note
Cleans up notification-services-controller by adding explicit return types, renaming short variables, avoiding parameter reassignment, and removing corresponding ESLint suppressions.
processors/process-notifications.ts):neverfor exhaustive check).n→notification, etc.) and tighten generics (isNotUndefined).processAndFilterNotificationsto typed map/filter without implicit any.services/api-notifications.ts):response,apiResponse).error).services/feature-announcements.test.ts):process-notifications.ts,api-notifications.ts, andfeature-announcements.test.tsineslint-suppressions.json.Written by Cursor Bugbot for commit d5f632d. This will update automatically on new commits. Configure here.