File tree Expand file tree Collapse file tree 1 file changed +26
-2
lines changed Expand file tree Collapse file tree 1 file changed +26
-2
lines changed Original file line number Diff line number Diff line change @@ -72,7 +72,31 @@ prefer sticking to a _single_ API for accomplishing something.
7272
7373### 100 column limit
7474All code and docs in the repo should be 100 columns or fewer. This applies to TypeScript, SCSS,
75- HTML, bash scripts, and markdown files.
75+ HTML, bash scripts, and markdown files.
76+
77+ ### API Design
78+
79+ #### Boolean arguments
80+ Avoid adding boolean arguments to a method in cases where that argument means "do something extra".
81+ In these cases, prefer breaking the behavior up into different functions.
82+
83+ ``` ts
84+ // AVOID
85+ function getTargetElement(createIfNotFound = false ) {
86+ // ...
87+ }
88+ ```
89+
90+ ``` ts
91+ // PREFER
92+ function getExistingTargetElement() {
93+ // ...
94+ }
95+
96+ function createTargetElement() {
97+ // ...
98+ }
99+ ```
76100
77101### TypeScript
78102
@@ -121,7 +145,7 @@ Properties should have a concise description of what the property means:
121145``` ts
122146 /** The label position relative to the checkbox. Defaults to 'after' */
123147 @Input () labelPosition : ' before' | ' after' = ' after' ;
124- ```
148+ ```
125149
126150Methods blocks should describe what the function does and provide a description for each parameter
127151and the return value:
You can’t perform that action at this time.
0 commit comments