Skip to content

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

Merged
merged 3 commits into from
Aug 13, 2019
Merged

Merge and deduplicate rule notices #141

merged 3 commits into from
Aug 13, 2019

Conversation

egiurleo
Copy link
Contributor

@egiurleo egiurleo commented Aug 12, 2019

Fixes #119

converted.set(changes.ruleName, {
...existingConversion,
ruleArguments: merger(
existingConversion.ruleArguments,
newConversion.ruleArguments,
),
notices: [...existingNotices, ...newNotices],
notices: Array.from(
new Set([...existingConversion.notices, ...newConversion.notices]),
Copy link
Contributor Author

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.

Copy link
Member

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!

@egiurleo
Copy link
Contributor Author

@JoshuaKGoldberg take a look :)

@JoshuaKGoldberg JoshuaKGoldberg added the status: waiting for reviewer Waiting for a maintainer to review label Aug 12, 2019
Copy link
Member

@JoshuaKGoldberg JoshuaKGoldberg left a 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.

converted.set(changes.ruleName, {
...existingConversion,
ruleArguments: merger(
existingConversion.ruleArguments,
newConversion.ruleArguments,
),
notices: [...existingNotices, ...newNotices],
notices: Array.from(
new Set([...existingConversion.notices, ...newConversion.notices]),
Copy link
Member

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 JoshuaKGoldberg added status: waiting for author The PR author should address requested changes and removed status: waiting for reviewer Waiting for a maintainer to review labels Aug 12, 2019
Copy link
Member

@JoshuaKGoldberg JoshuaKGoldberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Super, thanks @egiurleo! 💃🕺🎶

@JoshuaKGoldberg JoshuaKGoldberg merged commit e0ccb51 into typescript-eslint:master Aug 13, 2019
@JoshuaKGoldberg
Copy link
Member

JoshuaKGoldberg commented Aug 14, 2019

Released in 0.2.4! ✨

@JoshuaKGoldberg JoshuaKGoldberg removed the status: waiting for author The PR author should address requested changes label Oct 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Investigate merging notices
2 participants