Add block if parent is no block statement for remove-console/debugger
This commit is contained in:
parent
3cc38a0063
commit
e464b9ab87
@ -64,5 +64,18 @@ export let hooks = [
|
||||
}
|
||||
return true;
|
||||
}
|
||||
},
|
||||
|
||||
function (self, parent) {
|
||||
if (
|
||||
(parent.isIfStatement() && (self.key === 'consequent' || self.key === 'alternate')) ||
|
||||
(parent.isLoop() && self.key === 'body')
|
||||
) {
|
||||
self.replaceWith({
|
||||
type: 'BlockStatement',
|
||||
body: []
|
||||
});
|
||||
return true;
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user