Skip to content

Commit

Permalink
Let path.remove() remove IfStatement.alternate
Browse files Browse the repository at this point in the history
Special-casing "consequent" makes sense, but there is no need to deviate from the normal `remove()` behavior for "alternate", which is permitted to be null.
  • Loading branch information
djpohly committed Aug 8, 2022
1 parent e498bee commit b0ebc65
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions packages/babel-traverse/src/path/lib/removal-hooks.js
Expand Up @@ -60,8 +60,7 @@ export const hooks = [

function (self, parent) {
if (
(parent.isIfStatement() &&
(self.key === "consequent" || self.key === "alternate")) ||
(parent.isIfStatement() && self.key === "consequent") ||
(self.key === "body" &&
(parent.isLoop() || parent.isArrowFunctionExpression()))
) {
Expand Down

0 comments on commit b0ebc65

Please sign in to comment.