prefer-dom-node-append

March 27, 2026 ยท View on GitHub

๐Ÿ“ Prefer Node#append() over Node#appendChild().

๐Ÿ’ผ This rule is enabled in the following configs: โœ… recommended, โ˜‘๏ธ unopinionated.

๐Ÿ”ง This rule is automatically fixable by the --fix CLI option.

Enforces the use of, for example, document.body.append(div); over document.body.appendChild(div); for DOM nodes. There are some advantages of using Node#append(), like the ability to append multiple nodes and to append both DOMString and DOM node objects.

Examples

// โŒ
foo.appendChild(bar);

// โœ…
foo.append(bar);