Skip to content

Commit

Permalink
Merge pull request #1862 from swimlane/chore/prettier
Browse files Browse the repository at this point in the history
Update prettier
  • Loading branch information
Hypercubed authored Apr 14, 2020
2 parents f84f828 + 1e5dc3a commit 2ab3909
Show file tree
Hide file tree
Showing 64 changed files with 116 additions and 119 deletions.
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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
}));
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down Expand Up @@ -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]));
}

/*
Expand Down Expand Up @@ -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 };
});

Expand Down Expand Up @@ -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());
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -66,7 +66,7 @@ describe('OrderableDirective', () => {
};
});

subs.forEach((sub) => {
subs.forEach(sub => {
expect(sub.dragStart.length).toBe(1);
expect(sub.dragEnd.length).toBe(1);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
2 changes: 1 addition & 1 deletion projects/swimlane/ngx-datatable/src/lib/utils/math.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
});

Expand Down
2 changes: 1 addition & 1 deletion projects/swimlane/ngx-datatable/src/lib/utils/sort.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion projects/swimlane/ngx-datatable/src/lib/utils/tree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/app/basic/basic-auto.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export class BasicAutoComponent {
ColumnMode = ColumnMode;

constructor() {
this.fetch((data) => {
this.fetch(data => {
this.rows = data;
setTimeout(() => {
this.loadingIndicator = false;
Expand Down
2 changes: 1 addition & 1 deletion src/app/basic/basic-fixed.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export class BasicFixedComponent {
ColumnMode = ColumnMode;

constructor() {
this.fetch((data) => {
this.fetch(data => {
this.rows = data;
});
}
Expand Down
8 changes: 4 additions & 4 deletions src/app/basic/bootstrap.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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}`;
}
Expand Down
2 changes: 1 addition & 1 deletion src/app/basic/contextmenu.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export class ContextMenuDemoComponent {
ColumnMode = ColumnMode;

constructor() {
this.fetch((data) => {
this.fetch(data => {
this.rows = data;
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/app/basic/css.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export class RowCssComponent {
ColumnMode = ColumnMode;

constructor() {
this.fetch((data) => {
this.fetch(data => {
this.rows = data;
});
}
Expand Down
8 changes: 4 additions & 4 deletions src/app/basic/dark-theme.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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}`;
}
Expand Down
2 changes: 1 addition & 1 deletion src/app/basic/dynamic-height.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export class DynamicHeightComponent {
ColumnMode = ColumnMode;

constructor() {
this.fetch((data) => {
this.fetch(data => {
this.rows = data;
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/app/basic/filter.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export class FilterBarComponent {
ColumnMode = ColumnMode;

constructor() {
this.fetch((data) => {
this.fetch(data => {
// cache our list
this.temp = [...data];

Expand Down
2 changes: 1 addition & 1 deletion src/app/basic/footer.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export class FooterDemoComponent {
ColumnMode = ColumnMode;

constructor() {
this.fetch((data) => {
this.fetch(data => {
this.rows = data.splice(0, 5);
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/app/basic/fullscreen.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export class FullScreenComponent {
ColumnMode = ColumnMode;

constructor() {
this.fetch((data) => {
this.fetch(data => {
this.rows = data;
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/app/basic/inline.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export class InlineEditComponent {
ColumnMode = ColumnMode;

constructor() {
this.fetch((data) => {
this.fetch(data => {
this.rows = data;
});
}
Expand Down
4 changes: 2 additions & 2 deletions src/app/basic/live.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
});
Expand Down
2 changes: 1 addition & 1 deletion src/app/basic/responsive.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ export class ResponsiveComponent {
ColumnMode = ColumnMode;

constructor() {
this.fetch((data) => {
this.fetch(data => {
this.rows = data;
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/app/basic/row-detail.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export class RowDetailsComponent {
ColumnMode = ColumnMode;

constructor() {
this.fetch((data) => {
this.fetch(data => {
this.rows = data;
});
}
Expand Down
Loading

0 comments on commit 2ab3909

Please sign in to comment.