refactor: apply new eslint rules

This commit is contained in:
Rainer Killinger
2021-08-03 17:34:38 +02:00
parent bb8a9f6ba5
commit 7afa66e01a
15 changed files with 229 additions and 113 deletions

View File

@@ -66,7 +66,6 @@ export class AppComponent {
* TODO * TODO
*/ */
async initializeApp() { async initializeApp() {
// tslint:disable-next-line: no-floating-promises
this.platform.ready().then(async () => { this.platform.ready().then(async () => {
// Okay, so the platform is ready and our plugins are available. // Okay, so the platform is ready and our plugins are available.
// Here you can do any higher level native things you might need. // Here you can do any higher level native things you might need.

View File

@@ -12,7 +12,12 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import {CommonModule, LocationStrategy, PathLocationStrategy, registerLocaleData} from '@angular/common'; import {
CommonModule,
LocationStrategy,
PathLocationStrategy,
registerLocaleData,
} from '@angular/common';
import {HttpClient} from '@angular/common/http'; import {HttpClient} from '@angular/common/http';
import localeDe from '@angular/common/locales/de'; import localeDe from '@angular/common/locales/de';
import {APP_INITIALIZER, NgModule, Provider} from '@angular/core'; import {APP_INITIALIZER, NgModule, Provider} from '@angular/core';

View File

@@ -1,19 +1,64 @@
<div [ngSwitch]="item.type"> <div [ngSwitch]="item.type">
<stapps-article-detail-content [item]="item" *ngSwitchCase="'article'"></stapps-article-detail-content> <stapps-article-detail-content
<stapps-catalog-detail-content [item]="item" *ngSwitchCase="'catalog'"></stapps-catalog-detail-content> [item]="item"
<stapps-date-series-detail-content [item]="item" *ngSwitchCase="'date series'"></stapps-date-series-detail-content> *ngSwitchCase="'article'"
<stapps-dish-detail-content [item]="item" *ngSwitchCase="'dish'"></stapps-dish-detail-content> ></stapps-article-detail-content>
<stapps-event-detail-content [item]="item" *ngSwitchCase="'academic event'"></stapps-event-detail-content> <stapps-catalog-detail-content
<stapps-event-detail-content [item]="item" *ngSwitchCase="'sport course'"></stapps-event-detail-content> [item]="item"
<stapps-favorite-detail-content [item]="item" *ngSwitchCase="'favorite'"></stapps-favorite-detail-content> *ngSwitchCase="'catalog'"
<stapps-message-detail-content [item]="item" *ngSwitchCase="'message'"></stapps-message-detail-content> ></stapps-catalog-detail-content>
<stapps-person-detail-content [item]="item" *ngSwitchCase="'person'"></stapps-person-detail-content> <stapps-date-series-detail-content
<stapps-place-detail-content [item]="item" *ngSwitchCase="'building'"></stapps-place-detail-content> [item]="item"
<stapps-place-detail-content [item]="item" *ngSwitchCase="'floor'"></stapps-place-detail-content> *ngSwitchCase="'date series'"
<stapps-place-detail-content [item]="item" *ngSwitchCase="'point of interest'"></stapps-place-detail-content> ></stapps-date-series-detail-content>
<stapps-place-detail-content [item]="item" *ngSwitchCase="'room'"></stapps-place-detail-content> <stapps-dish-detail-content
<stapps-semester-detail-content [item]="item" *ngSwitchCase="'semester'"></stapps-semester-detail-content> [item]="item"
<stapps-video-detail-content [item]="item" *ngSwitchCase="'video'"></stapps-video-detail-content> *ngSwitchCase="'dish'"
></stapps-dish-detail-content>
<stapps-event-detail-content
[item]="item"
*ngSwitchCase="'academic event'"
></stapps-event-detail-content>
<stapps-event-detail-content
[item]="item"
*ngSwitchCase="'sport course'"
></stapps-event-detail-content>
<stapps-favorite-detail-content
[item]="item"
*ngSwitchCase="'favorite'"
></stapps-favorite-detail-content>
<stapps-message-detail-content
[item]="item"
*ngSwitchCase="'message'"
></stapps-message-detail-content>
<stapps-person-detail-content
[item]="item"
*ngSwitchCase="'person'"
></stapps-person-detail-content>
<stapps-place-detail-content
[item]="item"
*ngSwitchCase="'building'"
></stapps-place-detail-content>
<stapps-place-detail-content
[item]="item"
*ngSwitchCase="'floor'"
></stapps-place-detail-content>
<stapps-place-detail-content
[item]="item"
*ngSwitchCase="'point of interest'"
></stapps-place-detail-content>
<stapps-place-detail-content
[item]="item"
*ngSwitchCase="'room'"
></stapps-place-detail-content>
<stapps-semester-detail-content
[item]="item"
*ngSwitchCase="'semester'"
></stapps-semester-detail-content>
<stapps-video-detail-content
[item]="item"
*ngSwitchCase="'video'"
></stapps-video-detail-content>
<ng-container *ngSwitchDefault> <ng-container *ngSwitchDefault>
<ion-item class="ion-text-wrap" lines="inset"> <ion-item class="ion-text-wrap" lines="inset">
<ion-thumbnail slot="start" class="ion-margin-end"> <ion-thumbnail slot="start" class="ion-margin-end">
@@ -23,14 +68,18 @@
<ion-row> <ion-row>
<ion-col> <ion-col>
<div class="ion-text-wrap"> <div class="ion-text-wrap">
<h2 class="name">{{item.name}}</h2> <h2 class="name">{{ item.name }}</h2>
<ion-note>{{item.type}}</ion-note> <ion-note>{{ item.type }}</ion-note>
</div> </div>
</ion-col> </ion-col>
</ion-row> </ion-row>
</ion-grid> </ion-grid>
</ion-item> </ion-item>
<stapps-simple-card *ngIf="item.description" [title]="'description' | propertyNameTranslate: item | titlecase" [content]="'description' | thingTranslate: item"></stapps-simple-card> <stapps-simple-card
*ngIf="item.description"
[title]="'description' | propertyNameTranslate: item | titlecase"
[content]="'description' | thingTranslate: item"
></stapps-simple-card>
</ng-container> </ng-container>
</div> </div>
<stapps-origin-detail [origin]="item.origin" ></stapps-origin-detail> <stapps-origin-detail [origin]="item.origin"></stapps-origin-detail>

View File

@@ -1,7 +1,7 @@
<div *ngIf="origin.type === 'user'"> <div *ngIf="origin.type === 'user'">
<p>{{origin.created | dateFormat}}</p> <p>{{ origin.created | dateFormat }}</p>
</div> </div>
<div *ngIf="origin.type === 'remote'"> <div *ngIf="origin.type === 'remote'">
<p>{{origin.indexed | dateFormat}}</p> <p>{{ origin.indexed | dateFormat }}</p>
</div> </div>

View File

@@ -42,9 +42,7 @@ export class PlaceDetailContentComponent {
* *
* @param item TODO * @param item TODO
*/ */
// tslint:disable-next-line:completed-docs prefer-function-over-method
hasCategories(item: SCThings): item is SCThings & {categories: string[]} { hasCategories(item: SCThings): item is SCThings & {categories: string[]} {
// tslint:disable-next-line:completed-docs
return typeof (item as {categories: string[]}).categories !== 'undefined'; return typeof (item as {categories: string[]}).categories !== 'undefined';
} }

View File

@@ -2,26 +2,28 @@
<ion-row> <ion-row>
<ion-col> <ion-col>
<div class="ion-text-wrap"> <div class="ion-text-wrap">
<ion-label>{{'name' | thingTranslate: item}}</ion-label> <ion-label>{{ 'name' | thingTranslate: item }}</ion-label>
<ng-container *ngIf="item.type !== 'floor'"> <ng-container *ngIf="item.type !== 'floor'">
<p> <p>
<ion-note *ngIf="item.openingHours"> <ion-note *ngIf="item.openingHours">
{{item.openingHours | openingHours}} {{ item.openingHours | openingHours }}
</ion-note> </ion-note>
</p> </p>
<p> <p>
<ion-note *ngIf="item.categories && item.type !== 'building'; else onlyType"> <ion-note
{{'categories' | thingTranslate: item | join:', ' | titlecase }} *ngIf="item.categories && item.type !== 'building'; else onlyType"
>
{{ 'categories' | thingTranslate: item | join: ', ' | titlecase }}
</ion-note> </ion-note>
</p> </p>
<ng-template #onlyType> <ng-template #onlyType>
<ion-note> <ion-note>
{{'type' | thingTranslate: item}} {{ 'type' | thingTranslate: item }}
</ion-note> </ion-note>
</ng-template> </ng-template>
</ng-container> </ng-container>
<p *ngIf="item.description"> <p *ngIf="item.description">
{{'description' | thingTranslate: item}} {{ 'description' | thingTranslate: item }}
</p> </p>
<ion-note> <ion-note>
<ul> <ul>
@@ -36,7 +38,8 @@
</ion-col> </ion-col>
<div *ngIf="item.type !== 'building'"> <div *ngIf="item.type !== 'building'">
<ion-col width-20 text-right *ngIf="item.inPlace"> <ion-col width-20 text-right *ngIf="item.inPlace">
<ion-icon name="location"></ion-icon>{{'name' | thingTranslate: item.inPlace}} <ion-icon name="location"></ion-icon
>{{ 'name' | thingTranslate: item.inPlace }}
</ion-col> </ion-col>
</div> </div>
</ion-row> </ion-row>

View File

@@ -57,8 +57,7 @@ export class PlaceMensaDetailComponent implements AfterViewInit {
startingDay: Moment; startingDay: Moment;
constructor(private readonly mensaService: PlaceMensaService) { constructor(private readonly mensaService: PlaceMensaService) {
this.startingDay = moment() this.startingDay = moment().startOf('day');
.startOf('day');
} }
/** /**
@@ -66,7 +65,7 @@ export class PlaceMensaDetailComponent implements AfterViewInit {
*/ */
ngAfterViewInit() { ngAfterViewInit() {
this.dishes = this.mensaService.getAllDishes(this.item, this.displayRange); this.dishes = this.mensaService.getAllDishes(this.item, this.displayRange);
this.dishes.then((result) => { this.dishes.then(result => {
for (const [key, value] of Object.entries(result)) { for (const [key, value] of Object.entries(result)) {
if (value.length === 0) { if (value.length === 0) {
delete result[key]; delete result[key];

View File

@@ -1,9 +1,16 @@
<ng-container> <ng-container>
<div *ngIf="dishes | async as dishes; else loading"> <div *ngIf="dishes | async as dishes; else loading">
<ion-segment [(ngModel)]="selectedDay" mode="md"> <ion-segment [(ngModel)]="selectedDay" mode="md">
<ion-segment-button *ngFor="let day of dishes | keyvalue" [value]="day.key"> <ion-segment-button
<ion-label class="ion-hide-sm-down">{{day.key | dateFormat:'weekday:long,month:numeric,day:numeric'}}</ion-label> *ngFor="let day of dishes | keyvalue"
<ion-label class="ion-hide-sm-up">{{day.key | dateFormat:'weekday:short,month:numeric,day:numeric' }}</ion-label> [value]="day.key"
>
<ion-label class="ion-hide-sm-down">{{
day.key | dateFormat: 'weekday:long,month:numeric,day:numeric'
}}</ion-label>
<ion-label class="ion-hide-sm-up">{{
day.key | dateFormat: 'weekday:short,month:numeric,day:numeric'
}}</ion-label>
</ion-segment-button> </ion-segment-button>
</ion-segment> </ion-segment>
<div [ngSwitch]="selectedDay"> <div [ngSwitch]="selectedDay">

View File

@@ -5,7 +5,10 @@
<h2 class="name">{{ 'name' | thingTranslate: item }}</h2> <h2 class="name">{{ 'name' | thingTranslate: item }}</h2>
<p> <p>
<ion-icon name="calendar"></ion-icon> <ion-icon name="calendar"></ion-icon>
<span>{{item.startDate | dateFormat}} - {{item.endDate | dateFormat}}</span> <span
>{{ item.startDate | dateFormat }} -
{{ item.endDate | dateFormat }}</span
>
</p> </p>
<ion-note>{{ 'type' | thingTranslate: item }}</ion-note> <ion-note>{{ 'type' | thingTranslate: item }}</ion-note>
</div> </div>

View File

@@ -46,9 +46,7 @@ export class MapProvider {
static getPointMarker(point: Point) { static getPointMarker(point: Point) {
return marker(geoJSON(point).getBounds().getCenter(), { return marker(geoJSON(point).getBounds().getCenter(), {
icon: icon({ icon: icon({
// tslint:disable-next-line:no-magic-numbers
iconAnchor: [13, 41], iconAnchor: [13, 41],
// tslint:disable-next-line:no-magic-numbers
iconSize: [25, 41], iconSize: [25, 41],
iconUrl: '../assets/marker-icon.png', iconUrl: '../assets/marker-icon.png',
shadowUrl: '../assets/marker-shadow.png', shadowUrl: '../assets/marker-shadow.png',

View File

@@ -1,25 +1,41 @@
<ion-card> <ion-card>
<span *ngIf="item.url; else imageNoUrl"> <span *ngIf="item.url; else imageNoUrl">
<a href="{{item.url}}"> <a href="{{ item.url }}">
<ion-thumbnail><ion-img src="{{item.image}}" (ionError)="$event.target.nextSibling.style.display='block'" alt=""></ion-img> <ion-thumbnail
<ion-icon name="newspaper-outline"></ion-icon> ><ion-img
</ion-thumbnail> src="{{ item.image }}"
</a> (ionError)="$event.target.nextSibling.style.display = 'block'"
</span> alt=""
></ion-img>
<ion-icon name="newspaper-outline"></ion-icon>
</ion-thumbnail>
</a>
</span>
<ng-template #imageNoUrl> <ng-template #imageNoUrl>
<ion-thumbnail> <ion-thumbnail>
<ion-img src="{{item.image}}" (ionError)="$event.target.nextSibling.style.display='block'" alt=""></ion-img> <ion-img
src="{{ item.image }}"
(ionError)="$event.target.nextSibling.style.display = 'block'"
alt=""
></ion-img>
<ion-icon name="newspaper-outline"></ion-icon> <ion-icon name="newspaper-outline"></ion-icon>
</ion-thumbnail> </ion-thumbnail>
</ng-template> </ng-template>
<ion-card-header> <ion-card-header>
<ion-card-subtitle *ngIf="item.datePublished">{{item.datePublished | amCalendar | sentencecase}}</ion-card-subtitle> <ion-card-subtitle *ngIf="item.datePublished">{{
item.datePublished | amCalendar | sentencecase
}}</ion-card-subtitle>
<ion-card-title> <ion-card-title>
<span *ngIf="item.url; else titleNoUrl"><a href="{{item.url}}"><span class="text">{{item.name}}</span><span class="icon"><ion-icon name="open-outline"></ion-icon></span></a></span> <span *ngIf="item.url; else titleNoUrl"
<ng-template #titleNoUrl>{{item.name}}</ng-template> ><a href="{{ item.url }}"
><span class="text">{{ item.name }}</span
><span class="icon"
><ion-icon name="open-outline"></ion-icon></span></a
></span>
<ng-template #titleNoUrl>{{ item.name }}</ng-template>
</ion-card-title> </ion-card-title>
</ion-card-header> </ion-card-header>
<ion-card-content> <ion-card-content>
{{item.messageBody}} {{ item.messageBody }}
</ion-card-content> </ion-card-content>
</ion-card> </ion-card>

View File

@@ -19,11 +19,9 @@ import moment from 'moment';
import {Subscription} from 'rxjs'; import {Subscription} from 'rxjs';
import {logger} from '../_helpers/ts-logger'; import {logger} from '../_helpers/ts-logger';
// tslint:disable-next-line: no-var-requires // eslint-disable-next-line @typescript-eslint/no-var-requires, unicorn/prefer-module
const openingHoursFn = require('opening_hours'); const openingHoursFn = require('opening_hours');
// tslint:disable: completed-docs
@Injectable() @Injectable()
@Pipe({ @Pipe({
name: 'join', name: 'join',
@@ -58,13 +56,13 @@ export class SentenceCasePipe implements PipeTransform {
value = ''; value = '';
transform(aString: string | unknown): string { transform(aString: string | unknown): string {
if (typeof aString !== 'string') {
if (typeof aString !== 'string'){ throw new SyntaxError(
throw new SyntaxError(`Wrong parameter in StringSplitPipe. Expected a valid String, received: ${aString}`); `Wrong parameter in StringSplitPipe. Expected a valid String, received: ${aString}`,
);
} }
this.value = aString.substr(0,1) this.value = aString.slice(0, 1).toUpperCase() + aString.slice(1);
.toUpperCase() + aString.substr(1);
return this.value; return this.value;
} }
@@ -102,7 +100,9 @@ export class StringSplitPipe implements PipeTransform {
}) })
export class OpeningHoursPipe implements PipeTransform { export class OpeningHoursPipe implements PipeTransform {
locale: string; locale: string;
onLangChange?: Subscription; onLangChange?: Subscription;
value = ''; value = '';
constructor(private readonly translate: TranslateService) { constructor(private readonly translate: TranslateService) {
@@ -115,29 +115,30 @@ export class OpeningHoursPipe implements PipeTransform {
} }
} }
transform(aString: string | unknown): string { transform(aString: string | unknown): string {
this.updateValue(aString); this.updateValue(aString);
this._dispose(); this._dispose();
if (this.onLangChange?.closed === true) { if (this.onLangChange?.closed === true) {
this.onLangChange = this.translate.onLangChange.subscribe((event: LangChangeEvent) => { this.onLangChange = this.translate.onLangChange.subscribe(
this.locale = event.lang; (event: LangChangeEvent) => {
this.updateValue(aString); this.locale = event.lang;
}); this.updateValue(aString);
},
);
} }
return this.value; return this.value;
} }
updateValue(aString: string | unknown) { updateValue(aString: string | unknown) {
if (typeof aString !== 'string'){ if (typeof aString !== 'string') {
logger.warn(`openingHours pipe unable to parse input: ${aString}`); logger.warn(`openingHours pipe unable to parse input: ${aString}`);
return; return;
} }
const openingHours = new openingHoursFn(aString); const openingHours = new openingHoursFn(aString);
if ((openingHours.getWarnings() as string[]).length > 0){ if ((openingHours.getWarnings() as string[]).length > 0) {
logger.warn((openingHours.getWarnings() as string[]).join('. ')); logger.warn((openingHours.getWarnings() as string[]).join('. '));
return; return;
@@ -146,27 +147,24 @@ export class OpeningHoursPipe implements PipeTransform {
const isOpen: boolean = openingHours.getState(); const isOpen: boolean = openingHours.getState();
const nextChange: Date = openingHours.getNextChange(); const nextChange: Date = openingHours.getNextChange();
let prefixKey = isOpen ? let prefixKey = isOpen
'common.openingHours.open_until' : ? 'common.openingHours.open_until'
'common.openingHours.closed_until'; : 'common.openingHours.closed_until';
let formattedCalender = moment(nextChange) let formattedCalender = moment(nextChange).calendar();
.calendar();
if (moment(nextChange) if (moment(nextChange).isBefore(moment().add(1, 'hours'))) {
.isBefore(moment() prefixKey = isOpen
.add(1, 'hours'))) { ? 'common.openingHours.closing_soon'
prefixKey= isOpen ? : 'common.openingHours.opening_soon';
'common.openingHours.closing_soon' : formattedCalender =
'common.openingHours.opening_soon'; formattedCalender.slice(0, 1).toUpperCase() +
formattedCalender = formattedCalender.substr(0,1) formattedCalender.slice(1);
.toUpperCase() + formattedCalender.substr(1);
} }
this.value = `${this.translate.instant(prefixKey)} ${formattedCalender}`; this.value = `${this.translate.instant(prefixKey)} ${formattedCalender}`;
} }
} }
@Injectable() @Injectable()
@Pipe({ @Pipe({
name: 'numberLocalized', name: 'numberLocalized',
@@ -174,7 +172,9 @@ export class OpeningHoursPipe implements PipeTransform {
}) })
export class NumberLocalizedPipe implements PipeTransform, OnDestroy { export class NumberLocalizedPipe implements PipeTransform, OnDestroy {
locale: string; locale: string;
onLangChange?: Subscription; onLangChange?: Subscription;
value: string; value: string;
constructor(private readonly translate: TranslateService) { constructor(private readonly translate: TranslateService) {
@@ -200,10 +200,12 @@ export class NumberLocalizedPipe implements PipeTransform, OnDestroy {
this.updateValue(value, formatOptions); this.updateValue(value, formatOptions);
this._dispose(); this._dispose();
if (this.onLangChange?.closed === true) { if (this.onLangChange?.closed === true) {
this.onLangChange = this.translate.onLangChange.subscribe((event: LangChangeEvent) => { this.onLangChange = this.translate.onLangChange.subscribe(
this.locale = event.lang; (event: LangChangeEvent) => {
this.updateValue(value, formatOptions); this.locale = event.lang;
}); this.updateValue(value, formatOptions);
},
);
} }
return this.value; return this.value;
@@ -215,10 +217,19 @@ export class NumberLocalizedPipe implements PipeTransform, OnDestroy {
return; return;
} }
const options = formatOptions?.split(',') const options = formatOptions
.map((element) => element.split(':')) ?.split(',')
.reduce((acc, [key, val]) => ({...acc, [key.trim()]: val.trim()}),{}) as Intl.NumberFormatOptions; .map(element => element.split(':'))
const float = typeof value === 'string' ? Number.parseFloat(value) : value as number; // eslint-disable-next-line unicorn/no-array-reduce
.reduce(
(accumulator, [key, value_]) => ({
...accumulator,
[key.trim()]: value_.trim(),
}),
{},
) as Intl.NumberFormatOptions;
const float =
typeof value === 'string' ? Number.parseFloat(value) : (value as number);
this.value = new Intl.NumberFormat(this.locale, options).format(float); this.value = new Intl.NumberFormat(this.locale, options).format(float);
} }
} }
@@ -230,7 +241,9 @@ export class NumberLocalizedPipe implements PipeTransform, OnDestroy {
}) })
export class DateLocalizedFormatPipe implements PipeTransform, OnDestroy { export class DateLocalizedFormatPipe implements PipeTransform, OnDestroy {
locale: string; locale: string;
onLangChange?: Subscription; onLangChange?: Subscription;
value: string; value: string;
constructor(private readonly translate: TranslateService) { constructor(private readonly translate: TranslateService) {
@@ -257,32 +270,48 @@ export class DateLocalizedFormatPipe implements PipeTransform, OnDestroy {
this.updateValue(value, formatOptions); this.updateValue(value, formatOptions);
this._dispose(); this._dispose();
if (this.onLangChange?.closed === true) { if (this.onLangChange?.closed === true) {
this.onLangChange = this.translate.onLangChange.subscribe((event: LangChangeEvent) => { this.onLangChange = this.translate.onLangChange.subscribe(
this.locale = event.lang; (event: LangChangeEvent) => {
this.updateValue(value, formatOptions); this.locale = event.lang;
}); this.updateValue(value, formatOptions);
},
);
} }
return this.value; return this.value;
} }
updateValue(value: string | Date | unknown, formatOptions?: string): void { updateValue(value: string | Date | unknown, formatOptions?: string): void {
if (typeof value !== 'string' && Object.prototype.toString.call(value) !== '[object Date]') { if (
typeof value !== 'string' &&
Object.prototype.toString.call(value) !== '[object Date]'
) {
logger.warn(`dateFormat pipe unable to parse input: ${value}`); logger.warn(`dateFormat pipe unable to parse input: ${value}`);
return; return;
} }
const options = formatOptions?.split(',') const options = formatOptions
.map((element) => element.split(':')) ?.split(',')
.reduce((acc, [key, val]) => ({...acc, [key.trim()]: val.trim()}),{}) as Intl.DateTimeFormatOptions; .map(element => element.split(':'))
const date = typeof value === 'string' ? Date.parse(value) : value as Date; // eslint-disable-next-line unicorn/no-array-reduce
this.value = new Intl.DateTimeFormat(this.locale, options ?? { .reduce(
day: 'numeric', (accumulator, [key, value_]) => ({
month: 'numeric', ...accumulator,
year: 'numeric', [key.trim()]: value_.trim(),
hour: 'numeric', }),
minute: 'numeric', {},
}) ) as Intl.DateTimeFormatOptions;
.format(date); const date =
typeof value === 'string' ? Date.parse(value) : (value as Date);
this.value = new Intl.DateTimeFormat(
this.locale,
options ?? {
day: 'numeric',
month: 'numeric',
year: 'numeric',
hour: 'numeric',
minute: 'numeric',
},
).format(date);
} }
} }

View File

@@ -14,9 +14,22 @@
*/ */
import {ModuleWithProviders, NgModule, Provider} from '@angular/core'; import {ModuleWithProviders, NgModule, Provider} from '@angular/core';
import {ArrayJoinPipe, DateLocalizedFormatPipe, NumberLocalizedPipe, SentenceCasePipe, StringSplitPipe, OpeningHoursPipe} from './common-string-pipes'; import {
import {ThingTranslateDefaultParser, ThingTranslateParser} from './thing-translate.parser'; ArrayJoinPipe,
import {ThingPropertyNameTranslatePipe, ThingTranslatePipe} from './thing-translate.pipe'; DateLocalizedFormatPipe,
NumberLocalizedPipe,
SentenceCasePipe,
StringSplitPipe,
OpeningHoursPipe,
} from './common-string-pipes';
import {
ThingTranslateDefaultParser,
ThingTranslateParser,
} from './thing-translate.parser';
import {
ThingPropertyNameTranslatePipe,
ThingTranslatePipe,
} from './thing-translate.pipe';
import {ThingTranslateService} from './thing-translate.service'; import {ThingTranslateService} from './thing-translate.service';
export interface ThingTranslateModuleConfig { export interface ThingTranslateModuleConfig {

View File

@@ -19,8 +19,6 @@ import {isThing, SCThings, SCThingType} from '@openstapps/core';
import {Subscription} from 'rxjs'; import {Subscription} from 'rxjs';
import {ThingTranslateService} from './thing-translate.service'; import {ThingTranslateService} from './thing-translate.service';
// tslint:disable: member-ordering prefer-function-over-method completed-docs
@Injectable() @Injectable()
@Pipe({ @Pipe({
name: 'thingTranslate', name: 'thingTranslate',

View File

@@ -23,5 +23,4 @@ if (environment.production) {
platformBrowserDynamic() platformBrowserDynamic()
.bootstrapModule(AppModule) .bootstrapModule(AppModule)
// tslint:disable-next-line:no-console
.catch(async error => console.error(error)); .catch(async error => console.error(error));