This repository was archived by the owner on Aug 31, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 653
feat(rome_js_analyze): new rule useFlatMap
#3384
Merged
Merged
Conversation
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
✅ Deploy Preview for rometools ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
9aaa3d2
to
7199747
Compare
MichaReiser
reviewed
Oct 10, 2022
MichaReiser
reviewed
Oct 10, 2022
leops
suggested changes
Oct 10, 2022
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.
I think the order of operations is reversed, the rule is searching for .flat().map()
when it should be checking for .map().flat()
be24fff
to
36031ad
Compare
36031ad
to
a19bafa
Compare
leops
reviewed
Oct 11, 2022
a8b9526
to
c2a392c
Compare
MichaReiser
suggested changes
Oct 12, 2022
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.
Looking good to me. I would recommend adding a few more tests and more sophisticated heuristics to avoid false positives.
Can you update the PR description to reflect that the rule is testing for .map(...).flat()
?
MichaReiser
approved these changes
Oct 12, 2022
8d59827
to
46b5458
Compare
002a6ba
to
ab4dfa8
Compare
@leops could you please review again the PR? |
leops
approved these changes
Oct 17, 2022
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Summary
Closes #3367
The rule checks for usages like
arr.map(function).flat(function)
and suggests the replace it witharr.flatMap(function)
instead.Clippy marks the code action as safe, so I suppose we can do that too? Please let me know if you think that the code action should be suggested.
Test Plan
Added some simple case.
The rule should not be triggered if at the function
flat
are passed some argument.