Skip to content

Files

Latest commit

 

History

History
13 lines (7 loc) · 514 Bytes

prefer-readonly.md

File metadata and controls

13 lines (7 loc) · 514 Bytes

Pattern: Missing use of readonly for private variable

Issue: -

Description

Requires that private variables are marked as readonly if they’re never modified outside of the constructor.

Rationale: Marking never-modified variables as readonly helps enforce the code’s intent of keeping them as never-modified. It can also help prevent accidental changes of members not meant to be changed.

Further Reading