π Prefer childNode.remove() over parentNode.removeChild(childNode).
πΌ This rule is enabled in the following configs: β
recommended, βοΈ unopinionated.
π§π‘ This rule is automatically fixable by the --fix CLI option and manually fixable by editor suggestions.
Enforces the use of, for example, child.remove(); over child.parentNode.removeChild(child);. The DOM function Node#remove() is preferred over the indirect removal of an object with Node#removeChild().
// β
parentNode.removeChild(foo);
// β
foo.remove();// β
parentNode.removeChild(this);
// β
this.remove();