Skip to content

Commit fbe264e

Browse files
committed
refactor: optimize imports
1 parent 5de7e05 commit fbe264e

File tree

19 files changed

+63
-43
lines changed

19 files changed

+63
-43
lines changed

eslint.config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ export default defineConfig(
6666
customGroups: { type: {}, value: {} },
6767
environment: 'node'
6868
}
69-
]
69+
],
70+
'@typescript-eslint/consistent-type-imports': ['warn', { prefer: 'type-imports' }]
7071
}
7172
}
7273
);

packages/mocks/network.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
/* eslint-disable no-unused-vars */
2-
import { MockInstance, vi } from 'vitest';
2+
import type { MockInstance } from 'vitest';
3+
4+
import { vi } from 'vitest';
35

46
export enum NetworkStatus {
57
Online = 'online',

packages/operators/src/blob.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
import type { Observable } from 'rxjs';
2+
13
import { minimatch } from 'minimatch';
2-
import { concatMap, from, map, Observable, of } from 'rxjs';
4+
import { concatMap, from, map, of } from 'rxjs';
35

46
export function blobToJSON() {
57
return (source: Observable<Blob>) =>

packages/operators/src/cache.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
import { Observable, ReplaySubject, share, timer } from 'rxjs';
1+
import type { Observable } from 'rxjs';
2+
3+
import { ReplaySubject, share, timer } from 'rxjs';
24

35
export interface CacheOptions {
46
ttl: number;

packages/operators/src/request.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
import { concatMap, from, Observable, throwError } from 'rxjs';
1+
import type { Observable } from 'rxjs';
2+
3+
import { concatMap, from, throwError } from 'rxjs';
24

35
import type { CacheOptions } from './cache';
46
import type { RetryWhenRequestErrorOptions } from './retry';

packages/operators/src/request/autoPagination.ts

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
import { concatMap, expand, filter, from, map, Observable, tap } from 'rxjs';
1+
import type { Observable } from 'rxjs';
2+
3+
import { concatMap, expand, filter, from, map } from 'rxjs';
24

35
import { request } from '../request';
46

@@ -10,15 +12,7 @@ export type ResolveRoute = (
1012
export function autoPagination({ resolveRoute }: { resolveRoute: ResolveRoute }) {
1113
return (source: Observable<Request | Response>) =>
1214
source.pipe(
13-
concatMap(req =>
14-
from(resolveRoute(req)).pipe(
15-
tap(t => {
16-
console.log(t);
17-
}),
18-
request(),
19-
getNext(resolveRoute, req)
20-
)
21-
),
15+
concatMap(req => from(resolveRoute(req)).pipe(request(), getNext(resolveRoute, req))),
2216
map(resp => resp.clone())
2317
);
2418
}

packages/operators/src/request/concurrentRequest.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
import { mergeMap, of, Observable } from 'rxjs';
1+
import type { Observable } from 'rxjs';
2+
3+
import { mergeMap, of } from 'rxjs';
24

35
import { request } from '../request';
46

packages/operators/src/request/lazyPagination.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
/* eslint-disable @typescript-eslint/no-explicit-any */
2-
import { concatMap, map, Observable } from 'rxjs';
2+
import type { Observable } from 'rxjs';
3+
4+
import { concatMap, map } from 'rxjs';
35

46
import { concurrentRequest } from './concurrentRequest';
57

packages/operators/src/request/polling.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
import { delay, expand, Observable, of } from 'rxjs';
1+
import type { Observable } from 'rxjs';
2+
3+
import { delay, expand, of } from 'rxjs';
24

35
import { request } from '../request';
46
import { distinctUntilResponseChanged } from '../response';

packages/operators/src/response.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
import type { Observable } from 'rxjs';
2+
13
import { shallowEqual } from 'fast-equals';
2-
import { combineLatest, concatMap, distinctUntilChanged, from, map, Observable, of } from 'rxjs';
4+
import { combineLatest, concatMap, distinctUntilChanged, from, map, of } from 'rxjs';
35

46
// eslint-disable-next-line @typescript-eslint/no-explicit-any
57
export function resolve<R = any>(type: 'json' | 'text' | 'blob') {

0 commit comments

Comments
 (0)