Remove console/debugger's parent statement if it's conditional#3453
Closed
heavyk wants to merge 2 commits intobabel:masterfrom
Closed
Remove console/debugger's parent statement if it's conditional#3453heavyk wants to merge 2 commits intobabel:masterfrom
heavyk wants to merge 2 commits intobabel:masterfrom
Conversation
52a5ef4 to
279d337
Compare
Member
|
I'd recommend a different approach to this more along the lines of what we do here: https://github.com/babel/babel/blob/master/packages/babel-traverse/src/path/lib/removal-hooks.js#L9 Along the lines of: so would become |
Author
|
thanks! that's exactly what I was looking for! I'll update tomorrow and add tests too |
Member
|
Thanks! |
Member
|
Closing in favor of #3583 |
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 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.
the if statements will produce an error that says: statement expected but null found (because an if-statement must have a body). this PR attempts to correct that by checking to see if the path's parent is the statement's parent.
the logic took me a bit to figure out because:
I would really like to know if there is any improvement that can be made to this PR - helper methods I missed or something else?