-
Notifications
You must be signed in to change notification settings - Fork 132
Code Contribution Guideline
jmarkowski edited this page Feb 5, 2020
·
21 revisions
- public:
lowerCamelCase
. Example:firstName
,addProductToShopCart()
- private:
lowerCamelCase
with_
prefix. Example:_firstName
,_addProductToShopCart()
- Properties/Decorators:
variable declaration should starts from newline from decorator
. Example
/** Bad Usage */
@Input() disabled: boolean = false;
/** Good Usage */
@Input()
disabled: boolean = false;
- Comments should be consistent, for methods and variables in
*.ts
files, we should add comments, directly above the commented property.
/** Example of 1 line comment */
public firstName: string = '';
/**
* Example of comment with
* text longer than 1 line
*/
public firstName: string = '';
- Private variables, methods, or Life cycle Hook Methods Should have comment with
@hidden
annotation
/**
* @hidden
* Example of comment for cycle method, that requires some comment
*/
private _removeList(): void {}
/** @hidden */
private _propertyWithoutComment: string;
- All components should have
changeDetectionStrategy.OnPush
. It improves the performance of library.