---
title: "format/arrays/no-trailing-comma-single-line"
pagination: false
---

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

<RuleId id="format/arrays/no-trailing-comma-single-line" />

In the [`format-laravel`](/docs/rules/presets/format-laravel) preset. Safe fix.

## What it does

If a list of values separated by a comma is contained on a single line, then the last item MUST NOT have a trailing comma.

## Configuration

```toml title="pun.toml"
[format.rules]
"arrays/no-trailing-comma-single-line" = true
```

To skip it in some files, add a [`@pun-ignore-file`](/docs/configuration/ignore-comments) comment.

## Options

| Name | Type | Allowed values | Default | Upstream name |
| --- | --- | --- | --- | --- |
| `elements` | `list` | `arguments`, `array`, `array-destructuring`, `group-import` | `["arguments", "array", "array-destructuring", "group-import"]` | `elements` |

## Replaces

- [`no_trailing_comma_in_singleline`](https://cs.symfony.com/doc/rules/basic/no_trailing_comma_in_singleline.html) (php-cs-fixer)

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