Skip to content

Commit

Permalink
chore: remove unnecessary explicit public access modifiers
Browse files Browse the repository at this point in the history
The `public` access modifier was inconsistently used. This change makes
the code more concise and consistent.
  • Loading branch information
kevinbuhmann committed Oct 31, 2022
1 parent 2fb53c7 commit 49c7e80
Show file tree
Hide file tree
Showing 145 changed files with 659 additions and 656 deletions.
6 changes: 6 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ module.exports = {
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'prettier'],
plugins: ['license-header', '@typescript-eslint', 'jasmine', 'unused-imports'],
rules: {
'@typescript-eslint/explicit-member-accessibility': [
'error',
{
accessibility: 'no-public',
},
],
'@typescript-eslint/no-explicit-any': 'off', // Would LOVE to turn this on
'@typescript-eslint/no-non-null-assertion': 'error',
'@typescript-eslint/no-unused-vars': 'error',
Expand Down
4 changes: 2 additions & 2 deletions projects/angular/src/button/button-group/button-group.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ export class ClrButtonGroup implements AfterContentInit {
private destroy$: ClrDestroyService
) {}

public popoverPosition: ClrPopoverPosition = ClrPopoverPositions['bottom-left'];
popoverPosition: ClrPopoverPosition = ClrPopoverPositions['bottom-left'];

public get open() {
get open() {
return this.toggleService.open;
}

Expand Down
2 changes: 1 addition & 1 deletion projects/angular/src/button/button-group/button.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ export class ClrButton implements LoadingListener {
}
}

public loading: boolean;
loading: boolean;

loadingStateChange(state: ClrLoadingState): void {
this.loading = state === ClrLoadingState.LOADING;
Expand Down
8 changes: 4 additions & 4 deletions projects/angular/src/button/button-loading/loading-button.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@ const MIN_BUTTON_WIDTH = 42;
host: { '[attr.disabled]': "disabled? '' : null" },
})
export class ClrLoadingButton implements LoadingListener {
public buttonState = ClrLoadingState;
public state: ClrLoadingState = ClrLoadingState.DEFAULT;
buttonState = ClrLoadingState;
state: ClrLoadingState = ClrLoadingState.DEFAULT;

@Input('disabled') public disabled: boolean;
@Input('disabled') disabled: boolean;

@Output('clrLoadingChange')
public clrLoadingChange: EventEmitter<ClrLoadingState> = new EventEmitter<ClrLoadingState>(false);
clrLoadingChange: EventEmitter<ClrLoadingState> = new EventEmitter<ClrLoadingState>(false);

constructor(public el: ElementRef, private renderer: Renderer2) {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export class DatagridPropertyComparator<T = any> implements ClrDatagridComparato
this.nestedProp = new NestedProperty(prop);
}

public compare(a: T, b: T): number {
compare(a: T, b: T): number {
let propA = this.nestedProp.getPropValue(a);
let propB = this.nestedProp.getPropValue(b);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export class DatagridNumericFilterImpl<T = any> implements ClrDatagridFilterInte
*/
private _changes = new Subject<[number, number]>();
// We do not want to expose the Subject itself, but the Observable which is read-only
public get changes(): Observable<[number, number]> {
get changes(): Observable<[number, number]> {
return this._changes.asObservable();
}

Expand All @@ -34,11 +34,11 @@ export class DatagridNumericFilterImpl<T = any> implements ClrDatagridFilterInte
* to the built-in string filter.
*/

public get value(): [number, number] {
get value(): [number, number] {
return [this._low, this._high];
}

public set value(vals: [number, number]) {
set value(vals: [number, number]) {
const low = vals[0];
const high = vals[1];
if (low !== this._low || high !== this._high) {
Expand All @@ -48,20 +48,20 @@ export class DatagridNumericFilterImpl<T = any> implements ClrDatagridFilterInte
}
}

public get low() {
get low() {
return this._low;
}
public set low(low: number) {
set low(low: number) {
if (low !== this._low) {
this._low = low;
this._changes.next([this._low, this._high]);
}
}

public get high() {
get high() {
return this._high;
}
public set high(high: number) {
set high(high: number) {
if (high !== this._high) {
this._high = high;
this._changes.next([this._low, this._high]);
Expand All @@ -71,20 +71,20 @@ export class DatagridNumericFilterImpl<T = any> implements ClrDatagridFilterInte
/**
* Indicates if the filter is currently active, (at least one input is set)
*/
public isActive(): boolean {
isActive(): boolean {
return this._low !== null || this.high !== null;
}

/**
* Tests if an item matches a search text
*/
public accepts(item: T): boolean {
accepts(item: T): boolean {
// We have a filter function in case someone wants to implement a numeric
// filter that always passes nulls or similar
return this.filterFn.accepts(item, this._low, this._high);
}

public get state() {
get state() {
if (this.filterFn instanceof DatagridPropertyNumericFilter) {
return {
property: this.filterFn.prop,
Expand All @@ -95,7 +95,7 @@ export class DatagridNumericFilterImpl<T = any> implements ClrDatagridFilterInte
return this;
}

public equals(other: ClrDatagridFilterInterface<T, any>): boolean {
equals(other: ClrDatagridFilterInterface<T, any>): boolean {
if (other instanceof DatagridNumericFilterImpl) {
if (other.filterFn instanceof DatagridPropertyNumericFilter) {
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,17 +106,17 @@ export class DatagridNumericFilter<T = any>
/**
* Indicates if the filter dropdown is open
*/
public open = false;
open = false;

/**
* We need the actual input element to automatically focus on it
*/
@ViewChild('input_low') public input: ElementRef;
@ViewChild('input_low') input: ElementRef;

/**
* We grab the ClrDatagridFilter we wrap to register this StringFilter to it.
*/
@ViewChild(ClrDatagridFilter) public filterContainer: ClrDatagridFilter<T>;
@ViewChild(ClrDatagridFilter) filterContainer: ClrDatagridFilter<T>;
ngAfterViewInit() {
this.subscriptions.push(
this.popoverToggleService.openChange.subscribe(openChange => {
Expand All @@ -140,12 +140,12 @@ export class DatagridNumericFilter<T = any>
/**
* Common setter for the input values
*/
public get value() {
get value() {
return [this.filter.low, this.filter.high];
}

@Input('clrFilterValue')
public set value(values: [number, number]) {
set value(values: [number, number]) {
if (this.filter && Array.isArray(values)) {
if (values && (values[0] !== this.filter.low || values[1] !== this.filter.high)) {
if (typeof values[0] === 'number') {
Expand All @@ -165,7 +165,7 @@ export class DatagridNumericFilter<T = any>
}
}

public get low() {
get low() {
if (typeof this.filter.low === 'number' && isFinite(this.filter.low)) {
return this.filter.low;
} else {
Expand All @@ -174,7 +174,7 @@ export class DatagridNumericFilter<T = any>
}
}

public set low(low: number | string) {
set low(low: number | string) {
if (typeof low === 'number' && low !== this.filter.low) {
this.filter.low = low;
this.filterValueChange.emit([this.filter.low, this.filter.high]);
Expand All @@ -184,7 +184,7 @@ export class DatagridNumericFilter<T = any>
}
}

public get high() {
get high() {
if (typeof this.filter.high === 'number' && isFinite(this.filter.high)) {
return this.filter.high;
} else {
Expand All @@ -193,7 +193,7 @@ export class DatagridNumericFilter<T = any>
}
}

public set high(high: number | string) {
set high(high: number | string) {
if (typeof high === 'number' && high !== this.filter.high) {
this.filter.high = high;
this.filterValueChange.emit([this.filter.low, this.filter.high]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,29 +18,29 @@ export class DatagridStringFilterImpl<T = any> implements ClrDatagridFilterInter
*/
private _changes = new Subject<string>();
// We do not want to expose the Subject itself, but the Observable which is read-only
public get changes(): Observable<string> {
get changes(): Observable<string> {
return this._changes.asObservable();
}

/**
* Input value converted to lowercase
*/
private _lowerCaseValue = '';
public get lowerCaseValue() {
get lowerCaseValue() {
return this._lowerCaseValue;
}

/**
* Raw input value
*/
private _rawValue = '';
public get value(): string {
get value(): string {
return this._rawValue;
}
/**
* Common setter for the input value
*/
public set value(value: string) {
set value(value: string) {
if (!value) {
value = '';
}
Expand All @@ -54,19 +54,19 @@ export class DatagridStringFilterImpl<T = any> implements ClrDatagridFilterInter
/**
* Indicates if the filter is currently active, meaning the input is not empty
*/
public isActive(): boolean {
isActive(): boolean {
return !!this.value;
}

/**
* Tests if an item matches a search text
*/
public accepts(item: T): boolean {
accepts(item: T): boolean {
// We always test with the lowercase value of the input, to stay case insensitive
return this.filterFn.accepts(item, this.lowerCaseValue);
}

public get state() {
get state() {
if (this.filterFn instanceof DatagridPropertyStringFilter) {
return {
property: this.filterFn.prop,
Expand All @@ -76,7 +76,7 @@ export class DatagridStringFilterImpl<T = any> implements ClrDatagridFilterInter
return this;
}

public equals(other: ClrDatagridFilterInterface<T, any>): boolean {
equals(other: ClrDatagridFilterInterface<T, any>): boolean {
if (other instanceof DatagridStringFilterImpl) {
if (other.filterFn instanceof DatagridPropertyStringFilter) {
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,17 +92,17 @@ export class DatagridStringFilter<T = any>
/**
* Indicates if the filter dropdown is open
*/
public open = false;
open = false;

/**
* We need the actual input element to automatically focus on it
*/
@ViewChild('input') public input: ElementRef;
@ViewChild('input') input: ElementRef;

/**
* We grab the ClrDatagridFilter we wrap to register this StringFilter to it.
*/
@ViewChild(ClrDatagridFilter) public filterContainer: ClrDatagridFilter<T>;
@ViewChild(ClrDatagridFilter) filterContainer: ClrDatagridFilter<T>;

ngAfterViewInit() {
this.subs.push(
Expand Down Expand Up @@ -133,11 +133,11 @@ export class DatagridStringFilter<T = any>
/**
* Common setter for the input value
*/
public get value() {
get value() {
return this.filter.value;
}
@Input('clrFilterValue')
public set value(value: string) {
set value(value: string) {
if (this.filter && typeof value === 'string') {
if (!value) {
value = '';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class NestedProperty<T = any> {

// Safe getter for a deep object property, will not throw an error but return
// undefined if one of the intermediate properties is null or undefined.
public getPropValue(item: T): any {
getPropValue(item: T): any {
if (this.splitProp) {
let value = item;
for (const nestedProp of this.splitProp) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ let clrDgActionId = 0;
})
export class ClrDatagridActionOverflow implements OnDestroy {
private subscriptions: Subscription[] = [];
public smartPosition: ClrPopoverPosition = {
smartPosition: ClrPopoverPosition = {
axis: ClrAxis.HORIZONTAL,
side: ClrSide.AFTER,
anchor: ClrAlignment.CENTER,
Expand Down Expand Up @@ -124,12 +124,12 @@ export class ClrDatagridActionOverflow implements OnDestroy {
}

private _open = false;
public get open() {
get open() {
return this._open;
}

@Input('clrDgActionOverflowOpen')
public set open(open: boolean) {
set open(open: boolean) {
const openState = !!open;
if (!!openState !== this.open) {
// prevents chocolate mess
Expand All @@ -139,5 +139,5 @@ export class ClrDatagridActionOverflow implements OnDestroy {
}
}

@Output('clrDgActionOverflowOpenChange') public openChange = new EventEmitter<boolean>(false);
@Output('clrDgActionOverflowOpenChange') openChange = new EventEmitter<boolean>(false);
}
2 changes: 1 addition & 1 deletion projects/angular/src/data/datagrid/datagrid-cell.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export class ClrDatagridCell implements OnInit {
this.wrappedInjector = new HostWrapper(WrappedCell, this.vcr);
}

public get _view() {
get _view() {
return this.wrappedInjector.get(WrappedCell, this.vcr).cellView;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -92,21 +92,21 @@ export class ClrDatagridColumnSeparator implements AfterViewInit, OnDestroy {
return `${this.columnSeparatorId}-aria-describedby`;
}

public showTracker(): void {
showTracker(): void {
this.columnResizerService.startResize();
const tableHeight = this.tableSizeService.getColumnDragHeight();
this.renderer.setStyle(this.resizeTrackerEl, 'height', tableHeight);
this.renderer.setStyle(this.resizeTrackerEl, 'display', 'block');
}

public moveTracker(movedBy: number): void {
moveTracker(movedBy: number): void {
this.columnResizerService.calculateResize(movedBy);
this.renderer.setStyle(this.resizeTrackerEl, 'transform', `translateX(${this.columnResizerService.resizedBy}px)`);
this.renderer.setStyle(this.document.body, 'cursor', 'col-resize');
this.redFlagTracker();
}

public hideTracker(): void {
hideTracker(): void {
this.columnResizerService.endResize();
this.renderer.setStyle(this.resizeTrackerEl, 'display', 'none');
this.renderer.setStyle(this.resizeTrackerEl, 'transform', `translateX(0px)`);
Expand Down
Loading

0 comments on commit 49c7e80

Please sign in to comment.