---
title: "lint/classes/no-redundant-readonly"
pagination: false
---

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

<RuleId id="lint/classes/no-redundant-readonly" />

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

## What it does

Removes redundant readonly from properties in readonly classes.

## Configuration

```toml title="pun.toml"
[lint.rules]
"classes/no-redundant-readonly" = "error"
```

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

## Replaces

- [`no_redundant_readonly_property`](https://cs.symfony.com/doc/rules/class_notation/no_redundant_readonly_property.html) (php-cs-fixer)
- [`RemoveReadonlyPropertyVisibilityOnReadonlyClass`](https://getrector.com/rule-detail/remove-readonly-property-visibility-on-readonly-class-rector) (rector)
- [`no-redundant-readonly`](https://mago.carthage.software/1.61.0/en/tools/linter/rules/#no-redundant-readonly) (mago-linter)

## 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/classes/no-redundant-readonly-property`

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