Repository navigation
Refuse non-function push listeners and clear Codacy findings - #510
Merged
Merged
Conversation
- registerForNotification and registerForNotificationOpened now refuse a listener that is not a function: they log an error, keep the current listener and return a subscription that does nothing. registerForNotification used to remove the current listener and then throw. - The 32-bit limits are written as 2 ** 31 - 1 and -(2 ** 31), which Codacy's numeric literal rule accepts. - CHANGELOG lines over 300 characters are split. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Lbwg6rsYZ3rHLE7T1JC9Qx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Follow-up to #508 and #509: clears the 8 Codacy findings that #508 introduced, and fixes a listener-input bug found while doing it.
registerForNotification/registerForNotificationOpenedwith a listener that is not a functionremove()does nothing. This is the same placeholder the no-push package already returns.registerForNotificationremoved the current listener and then threw React Native'sEventEmitter.addListener(...): 2nd argument must be a function., so a wrong argument crashed the call and silently dropped the working push listener.registerForNotificationOpenedreturned nothing, so.remove()on the result crashed. This was Codacy's "mixed return" finding.Validators.jsand its test are written as2 ** 31 - 1and-(2 ** 31). Codacy's "inaccurate numeric literal" warning was a false alarm, because JavaScript stores these integers exactly; the expressions also say why the numbers were chosen.registerForNotification.registerForNotificationOpenednow returnsEventSubscription, without the| void.Tests
undefinedis replaced on purpose: the result is now a no-op subscription.Checked
Jest 101/101, ESLint 0 errors, strict type check of
Countly.d.tsOK, andnpm run generate:no-pushstill applies cleanly.After merge
Regenerate the no-push package into a new PR to
staging-np, as in #509.🤖 Generated with Claude Code
https://claude.ai/code/session_01Lbwg6rsYZ3rHLE7T1JC9Qx