---
title: "lint/complexity/prefer-empty-array-compare"
pagination: false
---

{/* Generated by scripts/gen-rule-docs.py. Edit mapping.toml, not this file. */}

<RuleId id="lint/complexity/prefer-empty-array-compare" />

In the [`code-quality`](/docs/rules/sets/code-quality) set. Safe fix.

## What it does

Compare with `[]` instead of empty()/is_array() on arrays.

## Configuration

```toml title="pun.toml"
[lint.rules]
"complexity/prefer-empty-array-compare" = "error"
```

To skip it in some files or lines, add an [override](/docs/configuration/pun-toml#lint) or an [ignore comment](/docs/configuration/ignore-comments).

## Options

| Name | Type | Allowed values | Default | Upstream name |
| --- | --- | --- | --- | --- |
| `checks` | `list` | `empty`, `is-array` | `["empty", "is-array"]` | None (Pun's own) |

## Replaces

- [`SimplifyEmptyArrayCheck`](https://getrector.com/rule-detail/simplify-empty-array-check-rector) (rector)
- [`SimplifyEmptyCheckOnEmptyArray`](https://getrector.com/rule-detail/simplify-empty-check-on-empty-array-rector) (rector)

## Merged rules

These old IDs are now this rule. A config that still names one stops with an error. See [merged rules](/docs/migrate/merged-rules).

- `lint/complexity/prefer-empty-array-identical`

[More lint/complexity rules](/docs/rules/lint/complexity) · [Edit this page](https://github.com/shipfastlabs/pun/edit/main/crates/pun-config/rules/mapping.toml)
