Skip to content

Commit 3d07bcc

Browse files
committed
lint
1 parent 240f2e3 commit 3d07bcc

File tree

8 files changed

+44
-31
lines changed

8 files changed

+44
-31
lines changed

testing-apps/demo/src/app/app.component.ts

+22-15
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import { AsyncPipe, JsonPipe } from "@angular/common";
22
import { Component, type OnInit } from "@angular/core";
33
import { StorageMap, type JSONSchema } from "@ngx-pwa/local-storage";
4-
import { Observable, of } from "rxjs";
5-
import { catchError, mergeMap, toArray } from "rxjs/operators";
4+
import { Observable, catchError, mergeMap, of, toArray } from "rxjs";
65
import { DataService } from "./data.service";
76

87
interface Data {
@@ -12,13 +11,16 @@ interface Data {
1211
@Component({
1312
selector: "app-root",
1413
standalone: true,
15-
imports: [AsyncPipe, JsonPipe],
14+
imports: [
15+
AsyncPipe,
16+
JsonPipe,
17+
],
1618
template: `
1719
@if (getItem$ | async; as getItem) {
18-
<p id="get-item">{{getItem.title}}</p>
20+
<p id="get-item">{{ getItem.title }}</p>
1921
}
2022
@if (schemaError$ | async; as schemaError) {
21-
<p id="schema-error">{{schemaError}}</p>
23+
<p id="schema-error">{{ schemaError }}</p>
2224
}
2325
@if (removeItem) {
2426
<p id="remove-item">removeItem</p>
@@ -27,7 +29,7 @@ interface Data {
2729
<p id="clear">clear</p>
2830
}
2931
@if (length$ | async; as length) {
30-
<p id="length">{{length}}</p>
32+
<p id="length">{{ length }}</p>
3133
}
3234
@if (keys$ | async; as keys) {
3335
<p id="keys">{{keys | json}}</p>
@@ -36,24 +38,27 @@ interface Data {
3638
<p id="has">has</p>
3739
}
3840
@if (service$ | async; as service) {
39-
<p id="service">{{service}}</p>
41+
<p id="service">{{ service }}</p>
4042
}
4143
<iframe src="http://localhost:4202"></iframe>
4244
`
4345
})
4446
export class AppComponent implements OnInit {
4547

46-
getItem$!: Observable<Data | undefined>;
47-
schemaError$!: Observable<string | undefined>;
48+
getItem$?: Observable<Data | undefined>;
49+
schemaError$?: Observable<string | undefined>;
4850
removeItem = false;
4951
clear = false;
50-
size$!: Observable<number>;
51-
length$!: Observable<number>;
52-
keys$!: Observable<string[]>;
53-
has$!: Observable<boolean>;
54-
service$!: Observable<string | undefined>;
52+
size$?: Observable<number>;
53+
length$?: Observable<number>;
54+
keys$?: Observable<string[]>;
55+
has$?: Observable<boolean>;
56+
service$?: Observable<string | undefined>;
5557

56-
constructor(private readonly storageMap: StorageMap, private readonly dataService: DataService) {}
58+
constructor(
59+
private readonly storageMap: StorageMap,
60+
private readonly dataService: DataService,
61+
) {}
5762

5863
ngOnInit(): void {
5964

@@ -92,9 +97,11 @@ export class AppComponent implements OnInit {
9297
mergeMap(() => this.storageMap.get("removeItem", { type: "string" })),
9398
// eslint-disable-next-line rxjs/no-nested-subscribe
9499
).subscribe((removeResult) => {
100+
95101
if (removeResult === undefined) {
96102
this.removeItem = true;
97103
}
104+
98105
});
99106

100107
this.length$ = this.storageMap.set("size1", "test").pipe(
+7-6
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
11
import { Injectable } from "@angular/core";
22
import { StorageMap } from "@ngx-pwa/local-storage";
3-
import { Observable } from "rxjs";
4-
import { mergeMap } from "rxjs/operators";
3+
import { Observable, mergeMap } from "rxjs";
54

65
@Injectable({
7-
providedIn: "root"
6+
providedIn: "root",
87
})
98
export class DataService {
109

1110
data$: Observable<string | undefined>;
1211

13-
constructor(private readonly storageMap: StorageMap) {
14-
this.data$ = this.storageMap.set("serviceTest", "service").pipe(
15-
mergeMap(() => this.storageMap.get("serviceTest", { type: "string" })),
12+
constructor(storageMap: StorageMap) {
13+
14+
this.data$ = storageMap.set("serviceTest", "service").pipe(
15+
mergeMap(() => storageMap.get("serviceTest", { type: "string" })),
1616
);
17+
1718
}
1819

1920
}

testing-apps/demo/src/main.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ import { bootstrapApplication } from "@angular/platform-browser";
22
import { AppComponent } from "./app/app.component";
33

44
bootstrapApplication(AppComponent)
5-
.catch(err => {
5+
.catch((err) => {
66
console.error(err);
77
});

testing-apps/iframe/src/app/app.component.ts

+5-3
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,17 @@ interface Data {
1515
AsyncPipe,
1616
],
1717
template: `
18-
<h1>{{(data$ | async)?.title}}</h1>
18+
<h1>{{ (data$ | async)?.title }}</h1>
1919
`
2020
})
2121
export class AppComponent implements OnInit {
2222

2323
title = "LocalStorage";
24-
data$!: Observable<Data | undefined>;
24+
data$?: Observable<Data | undefined>;
2525

26-
constructor(private readonly storageMap: StorageMap) {}
26+
constructor(
27+
private readonly storageMap: StorageMap,
28+
) {}
2729

2830
ngOnInit(): void {
2931

testing-apps/iframe/src/main.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ import { bootstrapApplication } from "@angular/platform-browser";
22
import { AppComponent } from "./app/app.component";
33

44
bootstrapApplication(AppComponent)
5-
.catch(err => {
5+
.catch((err) => {
66
console.log(err);
77
});

testing-apps/localforage/src/app/app.component.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ export class AppComponent implements OnInit {
2020

2121
title?: string;
2222

23-
constructor(private readonly storageMap: StorageMap) {}
23+
constructor(
24+
private readonly storageMap: StorageMap,
25+
) {}
2426

2527
ngOnInit(): void {
2628

testing-apps/localforage/src/app/lazy/page/page.component.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,19 @@ import { StorageMap } from "@ngx-pwa/local-storage";
33

44
@Component({
55
standalone: true,
6-
imports: [],
76
template: `
87
@if (lazy) {
9-
<p id="lazy">{{lazy}}</p>
8+
<p id="lazy">{{ lazy }}</p>
109
}
1110
`,
1211
})
1312
export class PageComponent implements OnInit {
1413

1514
lazy?: string;
1615

17-
constructor(private readonly storageMap: StorageMap) {}
16+
constructor(
17+
private readonly storageMap: StorageMap,
18+
) {}
1819

1920
ngOnInit(): void {
2021

testing-apps/localforage/src/main.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ bootstrapApplication(AppComponent, {
1515
provideIndexedDBStoreName("keyvaluepairs"),
1616
],
1717
})
18-
.catch(err => {
18+
.catch((err) => {
1919
console.error(err);
2020
});

0 commit comments

Comments
 (0)