Skip to content

Commit

Permalink
chore(common): setting properties with set and get to private (#315)
Browse files Browse the repository at this point in the history
* chore(common): setting properties with set and get to private

Setting most of properties with set and get to private. Some, like in packages/cdk/tree/padding.ts are keeped as they were to avoid breaking changes.

* chore(tags): setting _tabIndex to public
  • Loading branch information
Margar1ta authored and pimenovoleg committed Oct 25, 2019
1 parent 0b5dc4d commit e3aa571
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 28 deletions.
3 changes: 1 addition & 2 deletions packages/cdk/datetime/date-adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ export abstract class DateAdapter<D> {
return this._localeChanges;
}

// tslint:disable-next-line:naming-convention
protected _localeChanges = new Subject<void>();
private _localeChanges = new Subject<void>();

/**
* Gets the year component of the given date.
Expand Down
12 changes: 4 additions & 8 deletions packages/mosaic/input/input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -325,8 +325,7 @@ export class McInput extends McInputMixinBase implements McFormFieldControl<any>
}
}

// tslint:disable-next-line: naming-convention
protected _disabled = false;
private _disabled = false;

/**
* Implemented as part of McFormFieldControl.
Expand All @@ -341,8 +340,7 @@ export class McInput extends McInputMixinBase implements McFormFieldControl<any>
this._id = value || this.uid;
}

// tslint:disable-next-line: naming-convention
protected _id: string;
private _id: string;

/**
* Implemented as part of McFormFieldControl.
Expand All @@ -357,8 +355,7 @@ export class McInput extends McInputMixinBase implements McFormFieldControl<any>
this._required = coerceBooleanProperty(value);
}

// tslint:disable-next-line: naming-convention
protected _required = false;
private _required = false;

// tslint:disable no-reserved-keywords
/** Input type of the element. */
Expand All @@ -380,8 +377,7 @@ export class McInput extends McInputMixinBase implements McFormFieldControl<any>
}
// tslint:enable no-reserved-keywords

// tslint:disable-next-line: naming-convention
protected _type = 'text';
private _type = 'text';

/**
* Implemented as part of McFormFieldControl.
Expand Down
18 changes: 6 additions & 12 deletions packages/mosaic/modal/modal.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,7 @@ export class McModalComponent<T = any, R = any> extends McModalRef<T, R>
get mcVisible() { return this._mcVisible; }
set mcVisible(value) { this._mcVisible = value; }

// tslint:disable-next-line:orthodox-getter-and-setter , naming-convention could be private?
_mcVisible = false;
private _mcVisible = false;

@Output() mcVisibleChange = new EventEmitter<boolean>();

Expand All @@ -81,20 +80,17 @@ export class McModalComponent<T = any, R = any> extends McModalRef<T, R>
@Input()
get mcClosable() { return this._mcClosable; }
set mcClosable(value) { this._mcClosable = value; }
// tslint:disable-next-line:orthodox-getter-and-setter , naming-convention could be private?
_mcClosable = true;
private _mcClosable = true;

@Input()
get mcMask() { return this._mcMask; }
set mcMask(value) { this._mcMask = value; }
// tslint:disable-next-line:orthodox-getter-and-setter , naming-convention could be private?
_mcMask = true;
private _mcMask = true;

@Input()
get mcMaskClosable() { return this._mcMaskClosable; }
set mcMaskClosable(value) { this._mcMaskClosable = value; }
// tslint:disable-next-line:orthodox-getter-and-setter , naming-convention could be private?
_mcMaskClosable = false;
private _mcMaskClosable = false;

@Input() mcMaskStyle: object;
@Input() mcBodyStyle: object;
Expand All @@ -111,17 +107,15 @@ export class McModalComponent<T = any, R = any> extends McModalRef<T, R>
@Input()
get mcOkLoading() { return this._mcOkLoading; }
set mcOkLoading(value) { this._mcOkLoading = value; }
// tslint:disable-next-line:orthodox-getter-and-setter , naming-convention could be private?
_mcOkLoading = false;
private _mcOkLoading = false;

@Input() @Output() mcOnOk: EventEmitter<T> | OnClickCallback<T> = new EventEmitter<T>();
@Input() mcCancelText: string;

@Input()
get mcCancelLoading() { return this._mcCancelLoading; }
set mcCancelLoading(value) { this._mcCancelLoading = value; }
// tslint:disable-next-line:orthodox-getter-and-setter , naming-convention could be private?
_mcCancelLoading = false;
private _mcCancelLoading = false;

@Input() @Output() mcOnCancel: EventEmitter<T> | OnClickCallback<T> = new EventEmitter<T>();

Expand Down
1 change: 0 additions & 1 deletion packages/mosaic/tags/tag-list.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,6 @@ export class McTagList extends McTagListMixinBase implements McFormFieldControl<
descendants: true
}) tags: QueryList<McTag>;

// public property with setter - should be private?
// tslint:disable-next-line: naming-convention orthodox-getter-and-setter
_tabIndex = 0;

Expand Down
8 changes: 3 additions & 5 deletions packages/mosaic/textarea/textarea.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,9 @@ export class McTextarea extends McTextareaMixinBase implements McFormFieldContro

protected uid = `mc-textsrea-${nextUniqueId++}`;
protected previousNativeValue: any;
// tslint:disable:naming-convention
protected _disabled = false;
protected _id: string;
protected _required = false;
// tslint:enable:naming-convention
private _disabled = false;
private _id: string;
private _required = false;

private valueAccessor: { value: any };
private growSubscription: Subscription;
Expand Down

0 comments on commit e3aa571

Please sign in to comment.