---
title: "format/comments/no-trailing-whitespace"
pagination: false
---

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

<RuleId id="format/comments/no-trailing-whitespace" />

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

## What it does

There must be no trailing whitespace at the end of lines in comments and PHPDocs.

## Configuration

```toml title="pun.toml"
[format.rules]
"comments/no-trailing-whitespace" = true
```

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

## Replaces

- [`no_trailing_whitespace_in_comment`](https://cs.symfony.com/doc/rules/comment/no_trailing_whitespace_in_comment.html) (php-cs-fixer)
- [`no-trailing-space`](https://mago.carthage.software/1.61.0/en/tools/linter/rules/#no-trailing-space) (mago-linter)

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