> For AI agents: the complete documentation index is available at https://rslint.rs/llms.txt, the full documentation bundle is available at https://rslint.rs/llms-full.txt.

# prefer-dom-node-append

[Added in v0.9.3](https://github.com/web-infra-dev/rslint/releases/tag/v0.9.3)
## Configuration

| Preset                              | Configured Value |
| ----------------------------------- | ---------------- |
| ✅ unicornPlugin.configs.recommended | `"error"`        |


```ts title=rslint.config.ts
import { defineConfig, unicornPlugin } from '@rslint/core';

export default defineConfig([
  unicornPlugin.configs.recommended,
  {
    rules: {
      'unicorn/prefer-dom-node-append': 'error',
    },
  },
]);
```

## Rule Details

Prefer `Element#append()` over `Node#appendChild()`.

An automatic fix is offered only for expression statements. Other uses are reported without a fix because `appendChild` returns the appended child, whereas `append` returns undefined. Computed names and optional calls are excluded. Arguments that are statically impossible DOM nodes, including `null`, `void` expressions, and equivalent wrapped or sequence expressions, are ignored; a locally shadowed identifier named `undefined` is not mistaken for the global value.

Examples of **incorrect** code:

```javascript
element.appendChild(child);
```

Examples of **correct** code:

```javascript
element.append(child);
```

## Options

This rule has no options. It is enabled at `error` severity in `unicornPlugin.configs.recommended`.

## Original Documentation

- [eslint-plugin-unicorn: prefer-dom-node-append](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v75.0.0/docs/rules/prefer-dom-node-append.md)
- [Source code](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v75.0.0/rules/prefer-dom-node-append.js)
