-
-
Notifications
You must be signed in to change notification settings - Fork 262
chore: Notification services eslint cleanup #7485
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 #7485
Conversation
|
Cursor Agent can help with this pull request. Just |
|
@cursor update the |
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.
Done! I've completed both tasks:
-
Removed the
corefile - This was an accidentally committed core dump file (36MB) that was removed from the repository. -
Updated the changelog - Added an entry under the
[Unreleased]section inpackages/notification-services-controller/CHANGELOG.mddocumenting the ESLint cleanup changes:- Added explicit return types to functions
- Applied nullish coalescing operator (
??) where appropriate - Renamed short variable names for better readability
- Renamed private field
#TTLto#ttlto follow camelCase convention
The amended commit has been force-pushed to the branch.
Learn more about Cursor Agents
310f729 to
01c4f6d
Compare
| env.spaceId, | ||
| ) | ||
| .replace(DEFAULT_ACCESS_TOKEN, previewToken || env.accessToken) | ||
| .replace(DEFAULT_ACCESS_TOKEN, previewToken ?? env.accessToken) |
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.
Bug: Inconsistent empty string handling between domain and token
The change from || to ?? on line 58 creates an inconsistency with the truthiness check on line 53. If previewToken is an empty string, line 53's previewToken ? PREVIEW_DOMAIN : DEFAULT_DOMAIN evaluates to DEFAULT_DOMAIN (treating empty string as falsy), but line 58's previewToken ?? env.accessToken returns the empty string instead of falling back to env.accessToken. This could result in API calls to the production domain with an empty access token, causing authentication failures.
Additional Locations (1)
|
@cursor please remove the changelog changes, as these eslint changes does not impact the implementation |
|
Done! I've removed the changelog entry for the ESLint cleanup changes. The changelog now no longer includes the entry about refactoring internal code, since these changes don't impact the implementation or external API. Learn more about Cursor Agents |
01c4f6d to
b3089e3
Compare
|
@cursor fix merge conflicts & cleanup eslint-suppressions.json |
|
Done! I've fixed the merge conflicts and cleaned up
Learn more about Cursor Agents |
b3089e3 to
2084216
Compare
2084216 to
cef2d1e
Compare
- Add explicit return types to functions in feature-announcements.ts and perp-notifications.test.ts - Apply nullish coalescing operator (??) where appropriate - Rename short variable names for better readability (r -> response, i -> entry/asset, n -> item/rawNotification) - Rename private field #TTL to #ttl in OnChainNotificationsCache class - Add eslint-disable comments with explanations for Contentful API property names - Remove corresponding suppressions from eslint-suppressions.json - Update CHANGELOG.md
cef2d1e to
e6f1d91
Compare
Explanation
This PR addresses and resolves several ESLint rule violations across three files within
packages/notification-services-controller, allowing for the removal of their corresponding suppressions fromeslint-suppressions.json.Current state and why change?
ESLint suppressions were present in
eslint-suppressions.jsonfor rules such as@typescript-eslint/explicit-function-return-type,@typescript-eslint/naming-convention,@typescript-eslint/prefer-nullish-coalescing, andid-length. These suppressions indicated areas where the code did not conform to established linting standards. The goal is to improve code quality and maintainability by fixing these violations and removing the suppressions.What is the solution your changes offer and how does it work?
feature-announcements.ts:getFeatureAnnouncementUrlandfindIncludedItem.prefer-nullish-coalescingwas applied by replacing||with??.id-lengthviolations were resolved by renaming short, non-descriptive variables (r,i,n) to more explicit names (response,entry/asset,item/rawNotification).@typescript-eslint/naming-conventionsuppressions were added with explanations forEntryandAssetproperties within theContentfulResulttype, as their casing is dictated by the external Contentful API response structure.notification-config-cache.ts:#TTLwas renamed to#ttlto conform to camelCase naming conventions for private class members.perp-notifications.test.ts:arrangeMockstest helper function.eslint-suppressions.json.Are there any changes whose purpose might not be obvious?
The
eslint-disable-next-line @typescript-eslint/naming-conventioncomments infeature-announcements.tsforEntryandAssetproperties are intentional. These properties directly reflect the structure of responses from the Contentful API, and renaming them would break compatibility or require complex mapping.References
Checklist
Note
Fixes ESLint violations in feature announcements, notification config cache, and perps test, and removes their suppressions.
services/feature-announcements.ts:getFeatureAnnouncementUrlandfindIncludedItem.||with??and improve variable names (response,entry/asset,item,rawNotification).@typescript-eslint/naming-conventiondisables forincludes.Entryandincludes.Assetto match Contentful schema.createdAtsource.services/notification-config-cache.ts:#TTLto#ttland update references.services/perp-notifications.test.ts:arrangeMockshelper.feature-announcements.ts,notification-config-cache.ts, andperp-notifications.test.tsfromeslint-suppressions.json.Written by Cursor Bugbot for commit e6f1d91. This will update automatically on new commits. Configure here.