Skip to content

Commit 8a02aa1

Browse files
authored
docs(coding standards): when to use getters & observable naming (#18792)
1 parent 0f37367 commit 8a02aa1

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

CODING_STANDARDS.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,8 @@ API docs.
141141

142142

143143
#### Getters and Setters
144+
* Only use getters and setters for `@Input` properties or when otherwise required for API
145+
compatibility.
144146
* Avoid long or complex getters and setters. If the logic of an accessor would take more than
145147
three lines, introduce a new method to contain the logic.
146148
* A getter should immediately precede its corresponding setter.
@@ -205,6 +207,9 @@ specific error being caught and why it cannot be prevented.
205207
`align` because the former much more exactly communicates what the property means.
206208
* Except for `@Input` properties, use `is` and `has` prefixes for boolean properties / methods.
207209

210+
##### Observables
211+
* Don't suffix observables with `$`.
212+
208213
##### Classes
209214
Classes should be named based on what they're responsible for. Names should capture what the code
210215
*does*, not how it is used:

0 commit comments

Comments
 (0)