eslint-plugin-unicorn-x
Version:
More than 100 powerful ESLint rules
20 lines (15 loc) • 336 B
JavaScript
export default function isEmptyNode(node, additionalEmpty) {
const {type} = node;
if (type === 'BlockStatement') {
return node.body.every((currentNode) =>
isEmptyNode(currentNode, additionalEmpty),
);
}
if (type === 'EmptyStatement') {
return true;
}
if (additionalEmpty?.(node)) {
return true;
}
return false;
}