-
Notifications
You must be signed in to change notification settings - Fork 101
Merge and deduplicate rule notices #141
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
Merge and deduplicate rule notices #141
Conversation
src/rules/convertRules.ts
Outdated
converted.set(changes.ruleName, { | ||
...existingConversion, | ||
ruleArguments: merger( | ||
existingConversion.ruleArguments, | ||
newConversion.ruleArguments, | ||
), | ||
notices: [...existingNotices, ...newNotices], | ||
notices: Array.from( | ||
new Set([...existingConversion.notices, ...newConversion.notices]), |
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.
Let me know if this is better than it was previously (setting a default value for notices earlier on vs in the existingNotices
and newNotices
variables.
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.
@egiurleo unfortunately no, if newNotices
is undefined
, this will throw an error:
Trying out in a Node CLI:
> [...undefined, ...[]]
Thrown:
TypeError: undefined is not iterable (cannot read property Symbol(Symbol.iterator))
...which seems like a missing unit test!
@JoshuaKGoldberg take a look :) |
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.
Source changes LGTM! Just a comment on the one unit test missing.
src/rules/convertRules.ts
Outdated
converted.set(changes.ruleName, { | ||
...existingConversion, | ||
ruleArguments: merger( | ||
existingConversion.ruleArguments, | ||
newConversion.ruleArguments, | ||
), | ||
notices: [...existingNotices, ...newNotices], | ||
notices: Array.from( | ||
new Set([...existingConversion.notices, ...newConversion.notices]), |
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.
@egiurleo unfortunately no, if newNotices
is undefined
, this will throw an error:
Trying out in a Node CLI:
> [...undefined, ...[]]
Thrown:
TypeError: undefined is not iterable (cannot read property Symbol(Symbol.iterator))
...which seems like a missing unit test!
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.
Super, thanks @egiurleo! 💃🕺🎶
Released in 0.2.4! ✨ |
Fixes #119