From 5b9207f8ac7c2632a37d619aabaff2f2373c441d Mon Sep 17 00:00:00 2001 From: Jayson Harshbarger Date: Tue, 14 Apr 2020 13:35:28 -0600 Subject: [PATCH 1/2] Update prettier --- package-lock.json | 6 ++--- package.json | 2 +- .../src/lib/components/body/body.component.ts | 2 +- .../components/body/selection.component.ts | 2 +- .../body/summary/summary-row.component.ts | 12 +++++----- .../src/lib/components/datatable.component.ts | 10 ++++---- .../lib/components/header/header.component.ts | 2 +- .../directives/orderable.directive.spec.ts | 4 ++-- .../src/lib/directives/orderable.directive.ts | 2 +- .../ngx-datatable/src/lib/utils/camel-case.ts | 2 +- .../ngx-datatable/src/lib/utils/math.ts | 2 +- .../ngx-datatable/src/lib/utils/sort.ts | 2 +- .../ngx-datatable/src/lib/utils/tree.ts | 2 +- src/app/basic/basic-auto.component.ts | 2 +- src/app/basic/basic-fixed.component.ts | 2 +- src/app/basic/bootstrap.component.ts | 8 +++---- src/app/basic/contextmenu.component.ts | 2 +- src/app/basic/css.component.ts | 2 +- src/app/basic/dark-theme.component.ts | 8 +++---- src/app/basic/dynamic-height.component.ts | 2 +- src/app/basic/filter.component.ts | 2 +- src/app/basic/footer.component.ts | 2 +- src/app/basic/fullscreen.component.ts | 2 +- src/app/basic/inline.component.ts | 2 +- src/app/basic/live.component.ts | 4 ++-- src/app/basic/responsive.component.ts | 2 +- src/app/basic/row-detail.component.ts | 2 +- src/app/basic/row-grouping.component.ts | 23 ++++++++----------- src/app/basic/rx.component.ts | 4 ++-- src/app/basic/scrolling.component.ts | 2 +- src/app/basic/tabs.component.ts | 2 +- src/app/basic/virtual.component.ts | 2 +- src/app/columns/column-flex.component.ts | 2 +- src/app/columns/column-force.component.ts | 2 +- src/app/columns/column-reorder.component.ts | 2 +- src/app/columns/column-standard.component.ts | 2 +- src/app/columns/column-toggle.component.ts | 4 ++-- src/app/columns/pinning.component.ts | 2 +- src/app/paging/mock-server-results-service.ts | 2 +- src/app/paging/paging-client.component.ts | 2 +- ...ng-scrolling-novirtualization.component.ts | 2 +- src/app/paging/paging-server.component.ts | 2 +- src/app/paging/paging-virtual.component.ts | 2 +- src/app/paging/scrolling-server.component.ts | 4 ++-- src/app/selection/selection-cell.component.ts | 2 +- .../selection-chkbox-template.component.ts | 2 +- .../selection/selection-chkbox.component.ts | 2 +- .../selection/selection-disabled.component.ts | 2 +- .../selection-multi-click.component.ts | 2 +- .../selection/selection-multi.component.ts | 2 +- .../selection/selection-single.component.ts | 2 +- src/app/sorting/sorting-client.component.ts | 2 +- .../sorting/sorting-comparator.component.ts | 2 +- src/app/sorting/sorting-default.component.ts | 2 +- src/app/sorting/sorting-server.component.ts | 2 +- .../summary-row-custom-template.component.ts | 14 +++++------ .../summary-row-inline-html.component.ts | 10 ++++---- .../summary-row-server-paging.component.ts | 4 ++-- .../summary/summary-row-simple.component.ts | 12 +++++----- src/app/templates/template-dom.component.ts | 2 +- src/app/templates/template-obj.component.ts | 2 +- src/app/tree/client-tree.component.ts | 2 +- src/app/tree/fullscreen.component.ts | 8 +++---- src/main.ts | 2 +- 64 files changed, 114 insertions(+), 117 deletions(-) diff --git a/package-lock.json b/package-lock.json index d558e69ec..1ecbabd70 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3104,9 +3104,9 @@ "dev": true }, "@swimlane/prettier-config-swimlane": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/@swimlane/prettier-config-swimlane/-/prettier-config-swimlane-3.0.1.tgz", - "integrity": "sha512-ZF/X3h52M4SdBxIKAHLgnyK1RUhzsjaiirnEOkxlycLSJFkQHEdB/yxZJp8obhuR/UZWdH9TGzrndEJpPTpqZw==", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@swimlane/prettier-config-swimlane/-/prettier-config-swimlane-3.0.2.tgz", + "integrity": "sha512-oAdJm+ylbpoT7FnptiS+UMeMo0cFHko38Q7+qBAAsrbTkr1+tkebvHH05FOXVqkWJJXarJWcJdeWVTn6/YqaSw==", "dev": true }, "@szmarczak/http-timer": { diff --git a/package.json b/package.json index 5f1ac95dc..c882abcff 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,7 @@ "@angular/cli": "~9.1.0", "@angular/compiler-cli": "~9.1.0", "@angular/language-service": "~9.1.0", - "@swimlane/prettier-config-swimlane": "^3.0.1", + "@swimlane/prettier-config-swimlane": "^3.0.2", "@types/jasmine": "^3.5.10", "@types/jasminewd2": "~2.0.3", "@types/node": "^12.11.1", diff --git a/projects/swimlane/ngx-datatable/src/lib/components/body/body.component.ts b/projects/swimlane/ngx-datatable/src/lib/components/body/body.component.ts index 7568fdd74..def06e3f3 100644 --- a/projects/swimlane/ngx-datatable/src/lib/components/body/body.component.ts +++ b/projects/swimlane/ngx-datatable/src/lib/components/body/body.component.ts @@ -779,7 +779,7 @@ export class DataTableBodyComponent implements OnInit, OnDestroy { if (!expanded || !expanded.length) return -1; const rowId = this.rowIdentity(row); - return expanded.findIndex((r) => { + return expanded.findIndex(r => { const id = this.rowIdentity(r); return id === rowId; }); diff --git a/projects/swimlane/ngx-datatable/src/lib/components/body/selection.component.ts b/projects/swimlane/ngx-datatable/src/lib/components/body/selection.component.ts index 1764c4adb..1baff8951 100644 --- a/projects/swimlane/ngx-datatable/src/lib/components/body/selection.component.ts +++ b/projects/swimlane/ngx-datatable/src/lib/components/body/selection.component.ts @@ -144,7 +144,7 @@ export class DataTableSelectionComponent { if (!selected || !selected.length) return -1; const rowId = this.rowIdentity(row); - return selected.findIndex((r) => { + return selected.findIndex(r => { const id = this.rowIdentity(r); return id === rowId; }); diff --git a/projects/swimlane/ngx-datatable/src/lib/components/body/summary/summary-row.component.ts b/projects/swimlane/ngx-datatable/src/lib/components/body/summary/summary-row.component.ts index 3e07e2c11..83c1a29d8 100644 --- a/projects/swimlane/ngx-datatable/src/lib/components/body/summary/summary-row.component.ts +++ b/projects/swimlane/ngx-datatable/src/lib/components/body/summary/summary-row.component.ts @@ -9,12 +9,12 @@ export interface ISummaryColumn { } function defaultSumFunc(cells: any[]): any { - const cellsWithValues = cells.filter((cell) => !!cell); + const cellsWithValues = cells.filter(cell => !!cell); if (!cellsWithValues.length) { return null; } - if (cellsWithValues.some((cell) => typeof cell !== 'number')) { + if (cellsWithValues.some(cell => typeof cell !== 'number')) { return null; } @@ -64,7 +64,7 @@ export class DataTableSummaryRowComponent implements OnChanges { } private updateInternalColumns() { - this._internalColumns = this.columns.map((col) => ({ + this._internalColumns = this.columns.map(col => ({ ...col, cellTemplate: col.summaryTemplate })); @@ -74,9 +74,9 @@ export class DataTableSummaryRowComponent implements OnChanges { this.summaryRow = {}; this.columns - .filter((col) => !col.summaryTemplate) - .forEach((col) => { - const cellsFromSingleColumn = this.rows.map((row) => row[col.prop]); + .filter(col => !col.summaryTemplate) + .forEach(col => { + const cellsFromSingleColumn = this.rows.map(row => row[col.prop]); const sumFunc = this.getSummaryFunction(col); this.summaryRow[col.prop] = col.pipe diff --git a/projects/swimlane/ngx-datatable/src/lib/components/datatable.component.ts b/projects/swimlane/ngx-datatable/src/lib/components/datatable.component.ts index 789cb821a..e2bab881a 100644 --- a/projects/swimlane/ngx-datatable/src/lib/components/datatable.component.ts +++ b/projects/swimlane/ngx-datatable/src/lib/components/datatable.component.ts @@ -700,7 +700,7 @@ export class DatatableComponent implements OnInit, DoCheck, AfterViewInit { * content has been fully initialized. */ ngAfterContentInit() { - this.columnTemplates.changes.subscribe((v) => this.translateColumns(v)); + this.columnTemplates.changes.subscribe(v => this.translateColumns(v)); this.listenForColumnInputChanges(); } @@ -762,7 +762,7 @@ export class DatatableComponent implements OnInit, DoCheck, AfterViewInit { }; // convert map back to a simple array of objects - return Array.from(map, (x) => addGroup(x[0], x[1])); + return Array.from(map, x => addGroup(x[0], x[1])); } /* @@ -1015,7 +1015,7 @@ export class DatatableComponent implements OnInit, DoCheck, AfterViewInit { * The header triggered a column re-order event. */ onColumnReorder({ column, newValue, prevValue }: any): void { - const cols = this._internalColumns.map((c) => { + const cols = this._internalColumns.map(c => { return { ...c }; }); @@ -1128,12 +1128,12 @@ export class DatatableComponent implements OnInit, DoCheck, AfterViewInit { onTreeAction(event: any) { const row = event.row; // TODO: For duplicated items this will not work - const rowIndex = this._rows.findIndex((r) => r[this.treeToRelation] === event.row[this.treeToRelation]); + const rowIndex = this._rows.findIndex(r => r[this.treeToRelation] === event.row[this.treeToRelation]); this.treeAction.emit({ row, rowIndex }); } ngOnDestroy() { - this._subscriptions.forEach((subscription) => subscription.unsubscribe()); + this._subscriptions.forEach(subscription => subscription.unsubscribe()); } /** diff --git a/projects/swimlane/ngx-datatable/src/lib/components/header/header.component.ts b/projects/swimlane/ngx-datatable/src/lib/components/header/header.component.ts index 526aa6a87..2d05da9be 100644 --- a/projects/swimlane/ngx-datatable/src/lib/components/header/header.component.ts +++ b/projects/swimlane/ngx-datatable/src/lib/components/header/header.component.ts @@ -179,7 +179,7 @@ export class DataTableHeaderComponent implements OnDestroy { setTimeout(() => { // datatable component creates copies from columns on reorder // set dragging to false on new objects - const column = this._columns.find((c) => c.$$id === model.$$id); + const column = this._columns.find(c => c.$$id === model.$$id); if (column) { column.dragging = false; } diff --git a/projects/swimlane/ngx-datatable/src/lib/directives/orderable.directive.spec.ts b/projects/swimlane/ngx-datatable/src/lib/directives/orderable.directive.spec.ts index eb178fc76..877aaec47 100644 --- a/projects/swimlane/ngx-datatable/src/lib/directives/orderable.directive.spec.ts +++ b/projects/swimlane/ngx-datatable/src/lib/directives/orderable.directive.spec.ts @@ -56,7 +56,7 @@ describe('OrderableDirective', () => { describe('when a draggable is removed', () => { function checkAllSubscriptionsForActiveObservers() { - const subs = directive.draggables.map((d) => { + const subs = directive.draggables.map(d => { expect(d.dragEnd.isStopped).toBe(false); expect(d.dragStart.isStopped).toBe(false); @@ -66,7 +66,7 @@ describe('OrderableDirective', () => { }; }); - subs.forEach((sub) => { + subs.forEach(sub => { expect(sub.dragStart.length).toBe(1); expect(sub.dragEnd.length).toBe(1); }); diff --git a/projects/swimlane/ngx-datatable/src/lib/directives/orderable.directive.ts b/projects/swimlane/ngx-datatable/src/lib/directives/orderable.directive.ts index 313b7d502..c714bddf9 100644 --- a/projects/swimlane/ngx-datatable/src/lib/directives/orderable.directive.ts +++ b/projects/swimlane/ngx-datatable/src/lib/directives/orderable.directive.ts @@ -35,7 +35,7 @@ export class OrderableDirective implements AfterContentInit, OnDestroy { } ngOnDestroy(): void { - this.draggables.forEach((d) => { + this.draggables.forEach(d => { d.dragStart.unsubscribe(); d.dragging.unsubscribe(); d.dragEnd.unsubscribe(); diff --git a/projects/swimlane/ngx-datatable/src/lib/utils/camel-case.ts b/projects/swimlane/ngx-datatable/src/lib/utils/camel-case.ts index b79390f71..6d6141c15 100644 --- a/projects/swimlane/ngx-datatable/src/lib/utils/camel-case.ts +++ b/projects/swimlane/ngx-datatable/src/lib/utils/camel-case.ts @@ -27,5 +27,5 @@ export function camelCase(str: string): string { * http://stackoverflow.com/questions/7225407/convert-camelcasetext-to-camel-case-text */ export function deCamelCase(str: string): string { - return str.replace(/([A-Z])/g, (match) => ` ${match}`).replace(/^./, (match) => match.toUpperCase()); + return str.replace(/([A-Z])/g, match => ` ${match}`).replace(/^./, match => match.toUpperCase()); } diff --git a/projects/swimlane/ngx-datatable/src/lib/utils/math.ts b/projects/swimlane/ngx-datatable/src/lib/utils/math.ts index 8deebd206..97020a406 100644 --- a/projects/swimlane/ngx-datatable/src/lib/utils/math.ts +++ b/projects/swimlane/ngx-datatable/src/lib/utils/math.ts @@ -95,7 +95,7 @@ export function forceFillColumnWidths( allowBleed: boolean, defaultColWidth: number = 300 ) { - const columnsToResize = allColumns.slice(startIdx + 1, allColumns.length).filter((c) => { + const columnsToResize = allColumns.slice(startIdx + 1, allColumns.length).filter(c => { return c.canAutoResize !== false; }); diff --git a/projects/swimlane/ngx-datatable/src/lib/utils/sort.ts b/projects/swimlane/ngx-datatable/src/lib/utils/sort.ts index 52faf583d..52e6f4a49 100644 --- a/projects/swimlane/ngx-datatable/src/lib/utils/sort.ts +++ b/projects/swimlane/ngx-datatable/src/lib/utils/sort.ts @@ -77,7 +77,7 @@ export function sortRows(rows: any[], columns: any[], dirs: SortPropDir[]): any[ // cache valueGetter and compareFn so that they // do not need to be looked-up in the sort function body - const cachedDirs = dirs.map((dir) => { + const cachedDirs = dirs.map(dir => { const prop = dir.prop; return { prop, diff --git a/projects/swimlane/ngx-datatable/src/lib/utils/tree.ts b/projects/swimlane/ngx-datatable/src/lib/utils/tree.ts index d9ccf7dc0..98bfc9879 100644 --- a/projects/swimlane/ngx-datatable/src/lib/utils/tree.ts +++ b/projects/swimlane/ngx-datatable/src/lib/utils/tree.ts @@ -3,7 +3,7 @@ import { TableColumnProp } from '../types/table-column.type'; export type OptionalValueGetter = (row: any) => any | undefined; export function optionalGetterForProp(prop: TableColumnProp): OptionalValueGetter { - return prop && ((row) => getterForProp(prop)(row, prop)); + return prop && (row => getterForProp(prop)(row, prop)); } /** diff --git a/src/app/basic/basic-auto.component.ts b/src/app/basic/basic-auto.component.ts index f976b99b6..d94904c5f 100644 --- a/src/app/basic/basic-auto.component.ts +++ b/src/app/basic/basic-auto.component.ts @@ -41,7 +41,7 @@ export class BasicAutoComponent { ColumnMode = ColumnMode; constructor() { - this.fetch((data) => { + this.fetch(data => { this.rows = data; setTimeout(() => { this.loadingIndicator = false; diff --git a/src/app/basic/basic-fixed.component.ts b/src/app/basic/basic-fixed.component.ts index c1e033b62..43a75e518 100644 --- a/src/app/basic/basic-fixed.component.ts +++ b/src/app/basic/basic-fixed.component.ts @@ -36,7 +36,7 @@ export class BasicFixedComponent { ColumnMode = ColumnMode; constructor() { - this.fetch((data) => { + this.fetch(data => { this.rows = data; }); } diff --git a/src/app/basic/bootstrap.component.ts b/src/app/basic/bootstrap.component.ts index 3ca2aafc8..7ee6ef1d5 100644 --- a/src/app/basic/bootstrap.component.ts +++ b/src/app/basic/bootstrap.component.ts @@ -41,14 +41,14 @@ export class BootstrapThemeComponent { columns = [ { prop: 'name', summaryFunc: () => null }, - { name: 'Gender', summaryFunc: (cells) => this.summaryForGender(cells) }, + { name: 'Gender', summaryFunc: cells => this.summaryForGender(cells) }, { name: 'Company', summaryFunc: () => null } ]; ColumnMode = ColumnMode; constructor() { - this.fetch((data) => { + this.fetch(data => { this.rows = data; setTimeout(() => { this.loadingIndicator = false; @@ -68,8 +68,8 @@ export class BootstrapThemeComponent { } private summaryForGender(cells: string[]) { - const males = cells.filter((cell) => cell === 'male').length; - const females = cells.filter((cell) => cell === 'female').length; + const males = cells.filter(cell => cell === 'male').length; + const females = cells.filter(cell => cell === 'female').length; return `males: ${males}, females: ${females}`; } diff --git a/src/app/basic/contextmenu.component.ts b/src/app/basic/contextmenu.component.ts index 10e437178..36a75a973 100644 --- a/src/app/basic/contextmenu.component.ts +++ b/src/app/basic/contextmenu.component.ts @@ -55,7 +55,7 @@ export class ContextMenuDemoComponent { ColumnMode = ColumnMode; constructor() { - this.fetch((data) => { + this.fetch(data => { this.rows = data; }); } diff --git a/src/app/basic/css.component.ts b/src/app/basic/css.component.ts index 1bce3b1c6..f64892fd9 100644 --- a/src/app/basic/css.component.ts +++ b/src/app/basic/css.component.ts @@ -40,7 +40,7 @@ export class RowCssComponent { ColumnMode = ColumnMode; constructor() { - this.fetch((data) => { + this.fetch(data => { this.rows = data; }); } diff --git a/src/app/basic/dark-theme.component.ts b/src/app/basic/dark-theme.component.ts index 081614e9a..81297e29a 100644 --- a/src/app/basic/dark-theme.component.ts +++ b/src/app/basic/dark-theme.component.ts @@ -40,14 +40,14 @@ export class DarkThemeComponent { columns = [ { prop: 'name', summaryFunc: () => null }, - { name: 'Gender', summaryFunc: (cells) => this.summaryForGender(cells) }, + { name: 'Gender', summaryFunc: cells => this.summaryForGender(cells) }, { name: 'Company', summaryFunc: () => null } ]; ColumnMode = ColumnMode; constructor() { - this.fetch((data) => { + this.fetch(data => { this.rows = data; setTimeout(() => { this.loadingIndicator = false; @@ -67,8 +67,8 @@ export class DarkThemeComponent { } private summaryForGender(cells: string[]) { - const males = cells.filter((cell) => cell === 'male').length; - const females = cells.filter((cell) => cell === 'female').length; + const males = cells.filter(cell => cell === 'male').length; + const females = cells.filter(cell => cell === 'female').length; return `males: ${males}, females: ${females}`; } diff --git a/src/app/basic/dynamic-height.component.ts b/src/app/basic/dynamic-height.component.ts index a43fd63c3..13c399376 100644 --- a/src/app/basic/dynamic-height.component.ts +++ b/src/app/basic/dynamic-height.component.ts @@ -40,7 +40,7 @@ export class DynamicHeightComponent { ColumnMode = ColumnMode; constructor() { - this.fetch((data) => { + this.fetch(data => { this.rows = data; }); } diff --git a/src/app/basic/filter.component.ts b/src/app/basic/filter.component.ts index 6e1f6cdb6..cec8fdc4a 100644 --- a/src/app/basic/filter.component.ts +++ b/src/app/basic/filter.component.ts @@ -49,7 +49,7 @@ export class FilterBarComponent { ColumnMode = ColumnMode; constructor() { - this.fetch((data) => { + this.fetch(data => { // cache our list this.temp = [...data]; diff --git a/src/app/basic/footer.component.ts b/src/app/basic/footer.component.ts index 141d26d49..2e6e66ffa 100644 --- a/src/app/basic/footer.component.ts +++ b/src/app/basic/footer.component.ts @@ -53,7 +53,7 @@ export class FooterDemoComponent { ColumnMode = ColumnMode; constructor() { - this.fetch((data) => { + this.fetch(data => { this.rows = data.splice(0, 5); }); } diff --git a/src/app/basic/fullscreen.component.ts b/src/app/basic/fullscreen.component.ts index 5582d213c..0feaf4d8b 100644 --- a/src/app/basic/fullscreen.component.ts +++ b/src/app/basic/fullscreen.component.ts @@ -43,7 +43,7 @@ export class FullScreenComponent { ColumnMode = ColumnMode; constructor() { - this.fetch((data) => { + this.fetch(data => { this.rows = data; }); } diff --git a/src/app/basic/inline.component.ts b/src/app/basic/inline.component.ts index d65a0971f..30da2342c 100644 --- a/src/app/basic/inline.component.ts +++ b/src/app/basic/inline.component.ts @@ -80,7 +80,7 @@ export class InlineEditComponent { ColumnMode = ColumnMode; constructor() { - this.fetch((data) => { + this.fetch(data => { this.rows = data; }); } diff --git a/src/app/basic/live.component.ts b/src/app/basic/live.component.ts index 0fdf0aabd..abd90c463 100644 --- a/src/app/basic/live.component.ts +++ b/src/app/basic/live.component.ts @@ -52,8 +52,8 @@ export class LiveDataComponent { ColumnMode = ColumnMode; constructor(private cd: ChangeDetectorRef) { - this.fetch((data) => { - this.rows = data.map((d) => { + this.fetch(data => { + this.rows = data.map(d => { d.updated = Date.now().toString(); return d; }); diff --git a/src/app/basic/responsive.component.ts b/src/app/basic/responsive.component.ts index 0b26eaab4..efba330c1 100644 --- a/src/app/basic/responsive.component.ts +++ b/src/app/basic/responsive.component.ts @@ -123,7 +123,7 @@ export class ResponsiveComponent { ColumnMode = ColumnMode; constructor() { - this.fetch((data) => { + this.fetch(data => { this.rows = data; }); } diff --git a/src/app/basic/row-detail.component.ts b/src/app/basic/row-detail.component.ts index a7a55aaa1..9ed090a88 100644 --- a/src/app/basic/row-detail.component.ts +++ b/src/app/basic/row-detail.component.ts @@ -97,7 +97,7 @@ export class RowDetailsComponent { ColumnMode = ColumnMode; constructor() { - this.fetch((data) => { + this.fetch(data => { this.rows = data; }); } diff --git a/src/app/basic/row-grouping.component.ts b/src/app/basic/row-grouping.component.ts index 6a26ed14a..1920c2047 100644 --- a/src/app/basic/row-grouping.component.ts +++ b/src/app/basic/row-grouping.component.ts @@ -132,7 +132,7 @@ export class RowGroupingComponent { ColumnMode = ColumnMode; constructor() { - this.fetch((data) => { + this.fetch(data => { this.rows = data; }); } @@ -219,24 +219,21 @@ export class RowGroupingComponent { // check if there is a pending selected payment or a row that does not have any expected payment selected if ( - group.filter((rowFilter) => rowFilter.exppaypending === 1).length === 0 && - group.filter( - (rowFilter) => rowFilter.exppaypending === 0 && rowFilter.exppayyes === 0 && rowFilter.exppayno === 0 - ).length === 0 + group.filter(rowFilter => rowFilter.exppaypending === 1).length === 0 && + group.filter(rowFilter => rowFilter.exppaypending === 0 && rowFilter.exppayyes === 0 && rowFilter.exppayno === 0) + .length === 0 ) { console.log('expected payment dealt with'); // check if can set the group status - const numberOfExpPayYes = group.filter((rowFilter) => rowFilter.exppayyes === 1).length; - const numberOfSourceFunder = group.filter( - (rowFilter) => rowFilter.exppayyes === 1 && rowFilter.source === 'Funder' - ).length; + const numberOfExpPayYes = group.filter(rowFilter => rowFilter.exppayyes === 1).length; + const numberOfSourceFunder = group.filter(rowFilter => rowFilter.exppayyes === 1 && rowFilter.source === 'Funder') + .length; const numberOfSourceCalculated = group.filter( - (rowFilter) => rowFilter.exppayyes === 1 && rowFilter.source === 'Calculated' - ).length; - const numberOfSourceManual = group.filter( - (rowFilter) => rowFilter.exppayyes === 1 && rowFilter.source === 'Manual' + rowFilter => rowFilter.exppayyes === 1 && rowFilter.source === 'Calculated' ).length; + const numberOfSourceManual = group.filter(rowFilter => rowFilter.exppayyes === 1 && rowFilter.source === 'Manual') + .length; console.log('numberOfExpPayYes', numberOfExpPayYes); console.log('numberOfSourceFunder', numberOfSourceFunder); diff --git a/src/app/basic/rx.component.ts b/src/app/basic/rx.component.ts index 1e12313b8..91e1aa2c9 100644 --- a/src/app/basic/rx.component.ts +++ b/src/app/basic/rx.component.ts @@ -35,8 +35,8 @@ export class RxDemoComponent { ColumnMode = ColumnMode; constructor() { - this.rows = Observable.create((subscriber) => { - this.fetch((data) => { + this.rows = Observable.create(subscriber => { + this.fetch(data => { subscriber.next(data.splice(0, 15)); subscriber.next(data.splice(15, 30)); subscriber.complete(); diff --git a/src/app/basic/scrolling.component.ts b/src/app/basic/scrolling.component.ts index 182e05f99..00b21e12c 100644 --- a/src/app/basic/scrolling.component.ts +++ b/src/app/basic/scrolling.component.ts @@ -38,7 +38,7 @@ export class HorzVertScrolling { rows = []; constructor() { - this.fetch((data) => { + this.fetch(data => { this.rows = data; }); } diff --git a/src/app/basic/tabs.component.ts b/src/app/basic/tabs.component.ts index 4b73506f3..0b9475c5a 100644 --- a/src/app/basic/tabs.component.ts +++ b/src/app/basic/tabs.component.ts @@ -75,7 +75,7 @@ export class TabsDemoComponent { ColumnMode = ColumnMode; constructor() { - this.fetch((data) => { + this.fetch(data => { this.rows = data; }); } diff --git a/src/app/basic/virtual.component.ts b/src/app/basic/virtual.component.ts index 2ac5d86e6..92ff3ba4e 100644 --- a/src/app/basic/virtual.component.ts +++ b/src/app/basic/virtual.component.ts @@ -49,7 +49,7 @@ export class VirtualScrollComponent { ColumnMode = ColumnMode; constructor() { - this.fetch((data) => { + this.fetch(data => { this.rows = data; }); } diff --git a/src/app/columns/column-flex.component.ts b/src/app/columns/column-flex.component.ts index 66362613b..e0f7f883d 100644 --- a/src/app/columns/column-flex.component.ts +++ b/src/app/columns/column-flex.component.ts @@ -49,7 +49,7 @@ export class ColumnFlexComponent { ColumnMode = ColumnMode; constructor() { - this.fetch((data) => { + this.fetch(data => { this.rows = data.splice(0, 5); }); } diff --git a/src/app/columns/column-force.component.ts b/src/app/columns/column-force.component.ts index 1eefa41f6..9dbc97a20 100644 --- a/src/app/columns/column-force.component.ts +++ b/src/app/columns/column-force.component.ts @@ -49,7 +49,7 @@ export class ColumnForceComponent { ColumnMode = ColumnMode; constructor() { - this.fetch((data) => { + this.fetch(data => { this.rows = data.splice(0, 5); }); } diff --git a/src/app/columns/column-reorder.component.ts b/src/app/columns/column-reorder.component.ts index d5e9decd8..d855ce06b 100644 --- a/src/app/columns/column-reorder.component.ts +++ b/src/app/columns/column-reorder.component.ts @@ -66,7 +66,7 @@ export class ColumnReorderComponent { ColumnMode = ColumnMode; constructor() { - this.fetch((data) => { + this.fetch(data => { this.rows = data; setTimeout(() => { this.loadingIndicator = false; diff --git a/src/app/columns/column-standard.component.ts b/src/app/columns/column-standard.component.ts index b83f8bf98..b81bc90a7 100644 --- a/src/app/columns/column-standard.component.ts +++ b/src/app/columns/column-standard.component.ts @@ -49,7 +49,7 @@ export class ColumnStandardComponent { ColumnMode = ColumnMode; constructor() { - this.fetch((data) => { + this.fetch(data => { this.rows = data.splice(0, 5); }); } diff --git a/src/app/columns/column-toggle.component.ts b/src/app/columns/column-toggle.component.ts index 3c1fe5785..3e00fd247 100644 --- a/src/app/columns/column-toggle.component.ts +++ b/src/app/columns/column-toggle.component.ts @@ -64,7 +64,7 @@ export class ColumnToggleComponent { const isChecked = this.isChecked(col); if (isChecked) { - this.columns = this.columns.filter((c) => { + this.columns = this.columns.filter(c => { return c.name !== col.name; }); } else { @@ -74,7 +74,7 @@ export class ColumnToggleComponent { isChecked(col) { return ( - this.columns.find((c) => { + this.columns.find(c => { return c.name === col.name; }) !== undefined ); diff --git a/src/app/columns/pinning.component.ts b/src/app/columns/pinning.component.ts index 3061d4b21..272600a0d 100644 --- a/src/app/columns/pinning.component.ts +++ b/src/app/columns/pinning.component.ts @@ -42,7 +42,7 @@ export class ColumnPinningComponent { ColumnMode = ColumnMode; constructor() { - this.fetch((data) => { + this.fetch(data => { this.rows = data; }); } diff --git a/src/app/paging/mock-server-results-service.ts b/src/app/paging/mock-server-results-service.ts index f0c8b0a79..95b7b9f69 100644 --- a/src/app/paging/mock-server-results-service.ts +++ b/src/app/paging/mock-server-results-service.ts @@ -19,7 +19,7 @@ export class MockServerResultsService { * @returns {any} An observable containing the employee data */ public getResults(page: Page): Observable> { - return of(companyData).pipe(map((d) => this.getPagedData(page))); + return of(companyData).pipe(map(d => this.getPagedData(page))); } /** diff --git a/src/app/paging/paging-client.component.ts b/src/app/paging/paging-client.component.ts index f006d4c10..8c733873e 100644 --- a/src/app/paging/paging-client.component.ts +++ b/src/app/paging/paging-client.component.ts @@ -36,7 +36,7 @@ export class ClientPagingComponent { ColumnMode = ColumnMode; constructor() { - this.fetch((data) => { + this.fetch(data => { this.rows = data; }); } diff --git a/src/app/paging/paging-scrolling-novirtualization.component.ts b/src/app/paging/paging-scrolling-novirtualization.component.ts index f38f230a2..accf4cf2e 100644 --- a/src/app/paging/paging-scrolling-novirtualization.component.ts +++ b/src/app/paging/paging-scrolling-novirtualization.component.ts @@ -61,7 +61,7 @@ export class PagingScrollingNoVirtualizationComponent { */ setPage(pageInfo) { this.page.pageNumber = pageInfo.offset; - this.serverResultsService.getResults(this.page).subscribe((pagedData) => { + this.serverResultsService.getResults(this.page).subscribe(pagedData => { this.page = pagedData.page; this.rows = pagedData.data; }); diff --git a/src/app/paging/paging-server.component.ts b/src/app/paging/paging-server.component.ts index d8b7eb7f9..99f3ac3c0 100644 --- a/src/app/paging/paging-server.component.ts +++ b/src/app/paging/paging-server.component.ts @@ -59,7 +59,7 @@ export class ServerPagingComponent { */ setPage(pageInfo) { this.page.pageNumber = pageInfo.offset; - this.serverResultsService.getResults(this.page).subscribe((pagedData) => { + this.serverResultsService.getResults(this.page).subscribe(pagedData => { this.page = pagedData.page; this.rows = pagedData.data; }); diff --git a/src/app/paging/paging-virtual.component.ts b/src/app/paging/paging-virtual.component.ts index 4af899662..a88c7e10c 100644 --- a/src/app/paging/paging-virtual.component.ts +++ b/src/app/paging/paging-virtual.component.ts @@ -85,7 +85,7 @@ export class VirtualPagingComponent { this.serverResultsService .getResults(page) .pipe(delay(new Date(Date.now() + 1000 * Math.random()))) // simulating variability in returned data - .subscribe((pagedData) => { + .subscribe(pagedData => { // update total count this.totalElements = pagedData.page.totalElements; diff --git a/src/app/paging/scrolling-server.component.ts b/src/app/paging/scrolling-server.component.ts index 99b21ba8c..f6c953bd1 100644 --- a/src/app/paging/scrolling-server.component.ts +++ b/src/app/paging/scrolling-server.component.ts @@ -19,7 +19,7 @@ export class MockServerResultsService { public getResults(offset: number, limit: number): Observable> { return of(companyData.slice(offset, offset + limit)).pipe( delay(new Date(Date.now() + 500)), - map((d) => ({ data: d })) + map(d => ({ data: d })) ); } } @@ -99,7 +99,7 @@ export class ServerScrollingComponent { // 2) it enables display of the loading indicator this.isLoading = true; - this.serverResultsService.getResults(this.rows.length, limit).subscribe((results) => { + this.serverResultsService.getResults(this.rows.length, limit).subscribe(results => { const rows = [...this.rows, ...results.data]; this.rows = rows; this.isLoading = false; diff --git a/src/app/selection/selection-cell.component.ts b/src/app/selection/selection-cell.component.ts index 2a51e5faf..bba2280ce 100644 --- a/src/app/selection/selection-cell.component.ts +++ b/src/app/selection/selection-cell.component.ts @@ -42,7 +42,7 @@ export class CellSelectionComponent { SelectionType = SelectionType; constructor() { - this.fetch((data) => { + this.fetch(data => { this.rows = data; }); } diff --git a/src/app/selection/selection-chkbox-template.component.ts b/src/app/selection/selection-chkbox-template.component.ts index b9c6933b6..0548ac0c8 100644 --- a/src/app/selection/selection-chkbox-template.component.ts +++ b/src/app/selection/selection-chkbox-template.component.ts @@ -88,7 +88,7 @@ export class CustomCheckboxSelectionComponent { SelectionType = SelectionType; constructor() { - this.fetch((data) => { + this.fetch(data => { this.rows = data; }); } diff --git a/src/app/selection/selection-chkbox.component.ts b/src/app/selection/selection-chkbox.component.ts index d889e695a..a7f405a49 100644 --- a/src/app/selection/selection-chkbox.component.ts +++ b/src/app/selection/selection-chkbox.component.ts @@ -76,7 +76,7 @@ export class CheckboxSelectionComponent { SelectionType = SelectionType; constructor() { - this.fetch((data) => { + this.fetch(data => { this.rows = data; }); } diff --git a/src/app/selection/selection-disabled.component.ts b/src/app/selection/selection-disabled.component.ts index 6f071fe61..797ff8591 100644 --- a/src/app/selection/selection-disabled.component.ts +++ b/src/app/selection/selection-disabled.component.ts @@ -58,7 +58,7 @@ export class MultiDisableSelectionComponent { SelectionType = SelectionType; constructor() { - this.fetch((data) => { + this.fetch(data => { this.rows = data; }); } diff --git a/src/app/selection/selection-multi-click.component.ts b/src/app/selection/selection-multi-click.component.ts index 55c6871a1..59898bc26 100644 --- a/src/app/selection/selection-multi-click.component.ts +++ b/src/app/selection/selection-multi-click.component.ts @@ -61,7 +61,7 @@ export class MultiClickSelectionComponent { SelectionType = SelectionType; constructor() { - this.fetch((data) => { + this.fetch(data => { this.rows = data; }); } diff --git a/src/app/selection/selection-multi.component.ts b/src/app/selection/selection-multi.component.ts index d27387c33..4cf17b24d 100644 --- a/src/app/selection/selection-multi.component.ts +++ b/src/app/selection/selection-multi.component.ts @@ -61,7 +61,7 @@ export class MultiSelectionComponent { SelectionType = SelectionType; constructor() { - this.fetch((data) => { + this.fetch(data => { this.rows = data; }); } diff --git a/src/app/selection/selection-single.component.ts b/src/app/selection/selection-single.component.ts index 1bcf3b207..bcfc2bda4 100644 --- a/src/app/selection/selection-single.component.ts +++ b/src/app/selection/selection-single.component.ts @@ -61,7 +61,7 @@ export class SingleSelectionComponent { SelectionType = SelectionType; constructor() { - this.fetch((data) => { + this.fetch(data => { this.selected = [data[2]]; this.rows = data; }); diff --git a/src/app/sorting/sorting-client.component.ts b/src/app/sorting/sorting-client.component.ts index 9f4a0e658..500ca8b97 100644 --- a/src/app/sorting/sorting-client.component.ts +++ b/src/app/sorting/sorting-client.component.ts @@ -40,7 +40,7 @@ export class ClientSortingComponent { SortType = SortType; constructor() { - this.fetch((data) => { + this.fetch(data => { this.rows = data; }); } diff --git a/src/app/sorting/sorting-comparator.component.ts b/src/app/sorting/sorting-comparator.component.ts index ce26bb4d8..38cd34af5 100644 --- a/src/app/sorting/sorting-comparator.component.ts +++ b/src/app/sorting/sorting-comparator.component.ts @@ -41,7 +41,7 @@ export class SortingComparatorComponent { ColumnMode = ColumnMode; constructor() { - this.fetch((data) => { + this.fetch(data => { this.rows = data; }); } diff --git a/src/app/sorting/sorting-default.component.ts b/src/app/sorting/sorting-default.component.ts index 5223ba2e6..ed36e366f 100644 --- a/src/app/sorting/sorting-default.component.ts +++ b/src/app/sorting/sorting-default.component.ts @@ -49,7 +49,7 @@ export class DefaultSortingComponent implements OnInit { ColumnMode = ColumnMode; ngOnInit() { - this.fetch((data) => { + this.fetch(data => { this.rows = data; }); } diff --git a/src/app/sorting/sorting-server.component.ts b/src/app/sorting/sorting-server.component.ts index c1a98a181..ec35619f1 100644 --- a/src/app/sorting/sorting-server.component.ts +++ b/src/app/sorting/sorting-server.component.ts @@ -46,7 +46,7 @@ export class ServerSortingComponent { ColumnMode = ColumnMode; constructor() { - this.fetch((data) => { + this.fetch(data => { this.rows = data; }); } diff --git a/src/app/summary/summary-row-custom-template.component.ts b/src/app/summary/summary-row-custom-template.component.ts index a9d7a55c1..d46ffba13 100644 --- a/src/app/summary/summary-row-custom-template.component.ts +++ b/src/app/summary/summary-row-custom-template.component.ts @@ -48,7 +48,7 @@ export class SummaryRowCustomTemplateComponent implements OnInit { ColumnMode = ColumnMode; constructor() { - this.fetch((data) => { + this.fetch(data => { this.rows = data.splice(0, 5); }); } @@ -60,8 +60,8 @@ export class SummaryRowCustomTemplateComponent implements OnInit { summaryFunc: () => null, summaryTemplate: this.nameSummaryCell }, - { name: 'Gender', summaryFunc: (cells) => this.summaryForGender(cells) }, - { prop: 'age', summaryFunc: (cells) => this.avgAge(cells) } + { name: 'Gender', summaryFunc: cells => this.summaryForGender(cells) }, + { prop: 'age', summaryFunc: cells => this.avgAge(cells) } ]; } @@ -77,18 +77,18 @@ export class SummaryRowCustomTemplateComponent implements OnInit { } getNames(): string[] { - return this.rows.map((row) => row.name).map((fullName) => fullName.split(' ')[1]); + return this.rows.map(row => row.name).map(fullName => fullName.split(' ')[1]); } private summaryForGender(cells: string[]) { - const males = cells.filter((cell) => cell === 'male').length; - const females = cells.filter((cell) => cell === 'female').length; + const males = cells.filter(cell => cell === 'male').length; + const females = cells.filter(cell => cell === 'female').length; return `males: ${males}, females: ${females}`; } private avgAge(cells: number[]): number { - const filteredCells = cells.filter((cell) => !!cell); + const filteredCells = cells.filter(cell => !!cell); return filteredCells.reduce((sum, cell) => (sum += cell), 0) / filteredCells.length; } } diff --git a/src/app/summary/summary-row-inline-html.component.ts b/src/app/summary/summary-row-inline-html.component.ts index 342b22f21..19623a5ec 100644 --- a/src/app/summary/summary-row-inline-html.component.ts +++ b/src/app/summary/summary-row-inline-html.component.ts @@ -48,7 +48,7 @@ export class SummaryRowInlineHtmlComponent { ColumnMode = ColumnMode; constructor() { - this.fetch((data) => { + this.fetch(data => { this.rows = data.splice(0, 5); }); } @@ -65,18 +65,18 @@ export class SummaryRowInlineHtmlComponent { } getNames(): string[] { - return this.rows.map((row) => row.name).map((fullName) => fullName.split(' ')[1]); + return this.rows.map(row => row.name).map(fullName => fullName.split(' ')[1]); } summaryForGender(cells: string[]) { - const males = cells.filter((cell) => cell === 'male').length; - const females = cells.filter((cell) => cell === 'female').length; + const males = cells.filter(cell => cell === 'male').length; + const females = cells.filter(cell => cell === 'female').length; return `males: ${males}, females: ${females}`; } avgAge(cells: number[]): number { - const filteredCells = cells.filter((cell) => !!cell); + const filteredCells = cells.filter(cell => !!cell); return filteredCells.reduce((sum, cell) => (sum += cell), 0) / filteredCells.length; } } diff --git a/src/app/summary/summary-row-server-paging.component.ts b/src/app/summary/summary-row-server-paging.component.ts index 488b69a47..c0a314714 100644 --- a/src/app/summary/summary-row-server-paging.component.ts +++ b/src/app/summary/summary-row-server-paging.component.ts @@ -46,7 +46,7 @@ export class SummaryRowServerPagingComponent { columns = [ // NOTE: cells for current page only ! - { name: 'Name', summaryFunc: (cells) => `${cells.length} total` }, + { name: 'Name', summaryFunc: cells => `${cells.length} total` }, { name: 'Gender', summaryFunc: () => this.getGenderSummary() }, { name: 'Company', summaryFunc: () => null } ]; @@ -68,7 +68,7 @@ export class SummaryRowServerPagingComponent { */ setPage(pageInfo) { this.page.pageNumber = pageInfo.offset; - this.serverResultsService.getResults(this.page).subscribe((pagedData) => { + this.serverResultsService.getResults(this.page).subscribe(pagedData => { this.page = pagedData.page; this.rows = pagedData.data; }); diff --git a/src/app/summary/summary-row-simple.component.ts b/src/app/summary/summary-row-simple.component.ts index 526c37c8a..30075b4da 100644 --- a/src/app/summary/summary-row-simple.component.ts +++ b/src/app/summary/summary-row-simple.component.ts @@ -54,8 +54,8 @@ export class SummaryRowSimpleComponent { columns = [ { prop: 'name', summaryFunc: null }, - { name: 'Gender', summaryFunc: (cells) => this.summaryForGender(cells) }, - { prop: 'age', summaryFunc: (cells) => this.avgAge(cells) } + { name: 'Gender', summaryFunc: cells => this.summaryForGender(cells) }, + { prop: 'age', summaryFunc: cells => this.avgAge(cells) } ]; enableSummary = true; @@ -64,7 +64,7 @@ export class SummaryRowSimpleComponent { ColumnMode = ColumnMode; constructor() { - this.fetch((data) => { + this.fetch(data => { this.rows = data.splice(0, 5); }); } @@ -86,14 +86,14 @@ export class SummaryRowSimpleComponent { } private summaryForGender(cells: string[]) { - const males = cells.filter((cell) => cell === 'male').length; - const females = cells.filter((cell) => cell === 'female').length; + const males = cells.filter(cell => cell === 'male').length; + const females = cells.filter(cell => cell === 'female').length; return `males: ${males}, females: ${females}`; } private avgAge(cells: number[]): number { - const filteredCells = cells.filter((cell) => !!cell); + const filteredCells = cells.filter(cell => !!cell); return filteredCells.reduce((sum, cell) => (sum += cell), 0) / filteredCells.length; } } diff --git a/src/app/templates/template-dom.component.ts b/src/app/templates/template-dom.component.ts index 45a7db417..7b7682c64 100644 --- a/src/app/templates/template-dom.component.ts +++ b/src/app/templates/template-dom.component.ts @@ -57,7 +57,7 @@ export class InlineTemplatesComponent { ColumnMode = ColumnMode; constructor() { - this.fetch((data) => { + this.fetch(data => { this.rows = data.splice(0, 5); }); } diff --git a/src/app/templates/template-obj.component.ts b/src/app/templates/template-obj.component.ts index 03e895d4c..2521993db 100644 --- a/src/app/templates/template-obj.component.ts +++ b/src/app/templates/template-obj.component.ts @@ -46,7 +46,7 @@ export class TemplateRefTemplatesComponent { ColumnMode = ColumnMode; constructor() { - this.fetch((data) => { + this.fetch(data => { this.rows = data.splice(0, 5); }); } diff --git a/src/app/tree/client-tree.component.ts b/src/app/tree/client-tree.component.ts index ae588d3ee..8e108237f 100644 --- a/src/app/tree/client-tree.component.ts +++ b/src/app/tree/client-tree.component.ts @@ -53,7 +53,7 @@ export class ClientTreeComponent { ColumnMode = ColumnMode; constructor() { - this.fetch((data) => { + this.fetch(data => { this.rows = data; }); } diff --git a/src/app/tree/fullscreen.component.ts b/src/app/tree/fullscreen.component.ts index abc9c89e4..cb0da302c 100644 --- a/src/app/tree/fullscreen.component.ts +++ b/src/app/tree/fullscreen.component.ts @@ -65,9 +65,9 @@ export class FullScreenTreeComponent { ColumnMode = ColumnMode; constructor(private cd: ChangeDetectorRef) { - this.fetch((data) => { + this.fetch(data => { data = data.slice(1, this.lastIndex); - this.rows = data.map((d) => { + this.rows = data.map(d => { d.treeStatus = 'collapsed'; d.parentId = null; return d; @@ -93,8 +93,8 @@ export class FullScreenTreeComponent { const row = event.row; if (row.treeStatus === 'collapsed') { row.treeStatus = 'loading'; - this.fetch((data) => { - data = data.slice(this.lastIndex, this.lastIndex + 3).map((d) => { + this.fetch(data => { + data = data.slice(this.lastIndex, this.lastIndex + 3).map(d => { d.treeStatus = 'collapsed'; d.parentId = row.id; return d; diff --git a/src/main.ts b/src/main.ts index d9a2e7e4a..fa4e0aef3 100644 --- a/src/main.ts +++ b/src/main.ts @@ -10,4 +10,4 @@ if (environment.production) { platformBrowserDynamic() .bootstrapModule(AppModule) - .catch((err) => console.error(err)); + .catch(err => console.error(err)); From 1e5dc3ac7ce22026f2d2045b76e10a0284236a7e Mon Sep 17 00:00:00 2001 From: Jayson Harshbarger Date: Tue, 14 Apr 2020 13:43:55 -0600 Subject: [PATCH 2/2] restrict prettier to src files --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index c882abcff..42f63a047 100644 --- a/package.json +++ b/package.json @@ -15,8 +15,8 @@ "ci": "run-s lint prettier:ci test:ci", "lint": "ng lint", "e2e": "ng e2e", - "prettier": "prettier --write \"**/*.{js,ts,html,scss,css,md,json}\"", - "prettier:ci": "prettier --check \"**/*.{js,ts,html,scss,css,md,json}\"", + "prettier": "prettier --write \"{src,projects}/*.{js,ts,html,scss,css,md,json}\"", + "prettier:ci": "prettier --check \"{src,projects}/*.{js,ts,html,scss,css,md,json}\"", "build-docs": "cross-env NODE_ENV=production ng build --prod --base-href=\"/ngx-datatable/\"", "predeploy-docs": "npm run build-docs", "deploy-docs": "angular-cli-ghpages --dir ./dist/ngx-datatable",