Skip to content

Commit 0e9fe55

Browse files
Pfed-progSgtPooki
andauthored
chore: fix all eslint warnings in root (#2378)
* fixed all eslint warnings in root * fixing ci --------- Co-authored-by: Russell Dempsey <1173416+SgtPooki@users.noreply.github.com>
1 parent 6c361c4 commit 0e9fe55

10 files changed

Lines changed: 163 additions & 164 deletions

File tree

@types/ipfs/index.d.ts

Lines changed: 133 additions & 134 deletions
Original file line numberDiff line numberDiff line change
@@ -4,95 +4,91 @@ declare module 'ipfs' {
44
import type { Buffer } from 'buffer'
55
import type { KuboRPCClient } from 'kubo-rpc-client'
66

7-
declare export interface IPFSService extends CoreService {
8-
pin: PinService;
9-
files: FileService;
10-
name: NameService;
11-
object: ObjectService;
12-
config: ConfigService;
13-
dag: KuboRPCClient['dag'];
14-
15-
stop(options?: TimeoutOptions): Promise<void>
16-
}
17-
18-
declare export interface CoreService {
19-
// TODO: cat returns AsyncIterable<Uint8Array>. see https://github.com/ipfs/js-kubo-rpc-client/blob/1ab7941819dd1a48df653ee159e6983608e72132/src/index.ts#L353C50-L353C75
20-
cat(pathOrCID: string | CID, options?: CatOptions): AsyncIterable<Buffer>;
21-
ls(pathOrCID: string | CID, options?: ListOptions): AsyncIterable<ListEntry>;
22-
add(file: FileContent | FileObject, options?: AddOptions): Promise<UnixFSEntry>;
23-
addAll(files: Iterable<FileContent | FileObject> | AsyncIterable<FileContent | FileObject> | ReadableStream<FileContent | FileObject>, options?: AddOptions): AsyncIterable<UnixFSEntry>;
24-
}
25-
26-
declare export interface PinService {
27-
add(cid: CID, options?: PinAddOptions): Promise<Pin[]>;
28-
ls(options?: PinListOptions): AsyncIterable<PinEntry>;
29-
rm(cid: CID, options?: PinRemoveOptions): Promise<Pin[]>;
30-
remote: RemotePinService;
7+
declare export type UnixFSTime = {
8+
secs: number,
9+
nsecs: number
3110
}
3211

33-
declare export interface RemotePinServicesOptions {
34-
cid: CID[];
35-
service: string;
36-
}
37-
declare export interface RemotePinService {
38-
rm(options: RemotePinServicesOptions): Promise<boolean>;
12+
declare export type UnixFSEntry = {
13+
path: string,
14+
cid: CID,
15+
mode: number,
16+
mtime: UnixFSTime,
17+
size: number
3918
}
4019

41-
declare export interface FileService {
42-
stat(path: string, options?: FSStatOptions): Promise<FileStat>;
43-
cp(from: string, to: string, options?: FSCopyOptions): Promise<void>;
44-
mv(from: string, to: string, options?: FSMoveOptions): Promise<void>;
45-
rm(path: string, options: FSRemoveOptions): Promise<void>;
46-
mkdir(path: string, options: FSMakDirectoryOptions): Promise<void>;
47-
}
20+
declare type FileContent =
21+
| Uint8Array
22+
| Blob
23+
| String
24+
| AsyncIterable<Uint8Array>
25+
| ReadableStream<Uint8Array>
4826

49-
declare export interface ConfigService {
50-
get(key: string, options?: TimeoutOptions): Promise<Object>;
51-
getAll(options?: TimeoutOptions): Promise<Object>;
52-
set(key: string, value: string | number | null | boolean | Object, options?: TimeoutOptions): Promise<void>;
53-
replace(config: Object, options?: TimeoutOptions): Promise<void>;
27+
declare export type FileType =
28+
| 'file'
29+
| 'directory'
5430

55-
profiles: ConfigProfiles;
31+
declare type FileObject = {
32+
path?: string,
33+
content?: FileContent,
34+
mode?: number | string,
35+
mtime?: Date | UnixFSTime | [number, number]
5636
}
5737

58-
declare export interface ConfigProfiles {
59-
list(options?: TimeoutOptions): Promise<Array<{ name: string, description: string }>>;
60-
apply(name: string, options?: { dryRun?: boolean } & TimeoutOptions): Promise<{ original: Object, updated: Object }>;
38+
declare export type TimeoutOptions = {
39+
timeout?: number,
40+
signal?: AbortSignal
6141
}
6242

63-
declare export interface NameService {
64-
resolve(value: string, options?: NameResloveOptions): AsyncIterable<string>
65-
}
43+
declare export type ListOptions = TimeoutOptions & {}
6644

67-
declare export interface SwarmService {
68-
connect(addr: Multiaddr, options?: TimeoutOptions): Promise<void>
45+
declare export type CatOptions = TimeoutOptions & {
46+
offset?: number;
47+
length?: number;
6948
}
7049

71-
declare export interface ObjectService {
72-
new: (options?: ObjectNewOptions) => Promise<CID>;
73-
patch: ObjectPatchService
50+
declare type LoadProgress = {
51+
total: number,
52+
loaded: number,
53+
lengthComputable: boolean
7454
}
7555

76-
declare export interface ObjectPatchService {
77-
addLink(cid: CID, link: DAGLink, options?: TimeoutOptions): Promise<CID>
56+
declare export type AddOptions = TimeoutOptions & {
57+
chunker?: string,
58+
cidVersion?: number,
59+
hashAlg?: number,
60+
onlyHash?: boolean,
61+
pin?: boolean,
62+
progress?: (bytes: number, name:string) => void,
63+
rawLeaves?: boolean,
64+
trickle?: boolean,
65+
wrapWithDirectory?: boolean,
66+
onUploadProgress?: (progress: LoadProgress) => void,
67+
onDownloadProgress?: (progress: LoadProgress) => void
7868
}
7969

80-
declare export type DAGLink = {
70+
declare export type ListEntry = {
71+
depth: number,
8172
name: string,
73+
path: string,
8274
size: number,
83-
cid: CID
75+
cid: CID,
76+
// IPFS is pretty inconsistent with type field see
77+
// https://github.com/ipfs/js-ipfs/issues/3229
78+
type: FileType | 'dir',
79+
mode: number,
80+
mtime: { secs: number, nsecs?: number }
8481
}
8582

86-
declare export type Pin = { cid: CID }
87-
88-
declare export type TimeoutOptions = {
89-
timeout?: number,
90-
signal?: AbortSignal
83+
declare export interface CoreService {
84+
// TODO: cat returns AsyncIterable<Uint8Array>. see https://github.com/ipfs/js-kubo-rpc-client/blob/1ab7941819dd1a48df653ee159e6983608e72132/src/index.ts#L353C50-L353C75
85+
cat(pathOrCID: string | CID, options?: CatOptions): AsyncIterable<Buffer>;
86+
ls(pathOrCID: string | CID, options?: ListOptions): AsyncIterable<ListEntry>;
87+
add(file: FileContent | FileObject, options?: AddOptions): Promise<UnixFSEntry>;
88+
addAll(files: Iterable<FileContent | FileObject> | AsyncIterable<FileContent | FileObject> | ReadableStream<FileContent | FileObject>, options?: AddOptions): AsyncIterable<UnixFSEntry>;
9189
}
9290

93-
declare export type PinAddOptions = TimeoutOptions & {
94-
recursive?: boolean,
95-
}
91+
declare export type Pin = { cid: CID }
9692

9793
declare export type PinType =
9894
| 'recursive'
@@ -113,12 +109,43 @@ declare module 'ipfs' {
113109
recursive?: boolean
114110
}
115111

112+
declare export type PinAddOptions = TimeoutOptions & {
113+
recursive?: boolean,
114+
}
115+
116+
declare export interface RemotePinServicesOptions {
117+
cid: CID[];
118+
service: string;
119+
}
120+
121+
declare export interface RemotePinService {
122+
rm(options: RemotePinServicesOptions): Promise<boolean>;
123+
}
124+
125+
declare export interface PinService {
126+
add(cid: CID, options?: PinAddOptions): Promise<Pin[]>;
127+
ls(options?: PinListOptions): AsyncIterable<PinEntry>;
128+
rm(cid: CID, options?: PinRemoveOptions): Promise<Pin[]>;
129+
remote: RemotePinService;
130+
}
131+
116132
declare export type FSStatOptions = TimeoutOptions & {
117133
hash?: boolean,
118134
size?: boolean,
119135
withLocal?: boolean
120136
}
121137

138+
declare export interface FileStat {
139+
cid: CID;
140+
size: number;
141+
cumulativeSize: number;
142+
type: FileType;
143+
blocks: number;
144+
withLocality: boolean;
145+
local: boolean;
146+
sizeLocal: number;
147+
}
148+
122149
declare export type FSCopyOptions = TimeoutOptions & {
123150
parents?: boolean,
124151
flush?: boolean,
@@ -149,100 +176,72 @@ declare module 'ipfs' {
149176
cidVersion?: number
150177
}
151178

152-
declare export type FileType =
153-
| 'file'
154-
| 'directory'
155-
156-
declare export interface FileStat {
157-
cid: CID;
158-
size: number;
159-
cumulativeSize: number;
160-
type: FileType;
161-
blocks: number;
162-
withLocality: boolean;
163-
local: boolean;
164-
sizeLocal: number;
179+
declare export interface FileService {
180+
stat(path: string, options?: FSStatOptions): Promise<FileStat>;
181+
cp(from: string, to: string, options?: FSCopyOptions): Promise<void>;
182+
mv(from: string, to: string, options?: FSMoveOptions): Promise<void>;
183+
rm(path: string, options: FSRemoveOptions): Promise<void>;
184+
mkdir(path: string, options: FSMakDirectoryOptions): Promise<void>;
165185
}
166186

167187
declare export type NameResloveOptions = TimeoutOptions & {
168188
recursive?: boolean,
169189
nocache?: boolean
170190
}
171191

192+
declare export interface NameService {
193+
resolve(value: string, options?: NameResloveOptions): AsyncIterable<string>
194+
}
195+
172196
declare export type ObjectNewOptions = TimeoutOptions & {
173197
template?: string,
174198
recursive?: boolean,
175199
nocache?: boolean
176200
}
177201

178-
declare export type CatOptions = TimeoutOptions & {
179-
offset?: number;
180-
length?: number;
181-
}
182-
183-
declare export type ListOptions = TimeoutOptions & {
184-
185-
}
186-
187-
declare export type ListEntry = {
188-
depth: number,
202+
declare export type DAGLink = {
189203
name: string,
190-
path: string,
191204
size: number,
192-
cid: CID,
193-
// IPFS is pretty inconsistent with type field see
194-
// https://github.com/ipfs/js-ipfs/issues/3229
195-
type: FileType | 'dir',
196-
mode: number,
197-
mtime: { secs: number, nsecs?: number }
205+
cid: CID
198206
}
199207

200-
declare type FileContent =
201-
| Uint8Array
202-
| Blob
203-
| String
204-
| AsyncIterable<Uint8Array>
205-
| ReadableStream<Uint8Array>
208+
declare export interface ObjectPatchService {
209+
addLink(cid: CID, link: DAGLink, options?: TimeoutOptions): Promise<CID>
210+
}
206211

207-
declare type FileObject = {
208-
path?: string,
209-
content?: FileContent,
210-
mode?: number | string,
211-
mtime?: Date | UnixFSTime | [number, number]
212+
declare export interface ObjectService {
213+
new: (options?: ObjectNewOptions) => Promise<CID>;
214+
patch: ObjectPatchService
212215
}
213216

214-
declare export type AddOptions = TimeoutOptions & {
215-
chunker?: string,
216-
cidVersion?: number,
217-
hashAlg?: number,
218-
onlyHash?: boolean,
219-
pin?: boolean,
220-
progress?: (bytes: number, name:string) => void,
221-
rawLeaves?: boolean,
222-
trickle?: boolean,
223-
wrapWithDirectory?: boolean,
224-
onUploadProgress?: (progress: LoadProgress) => void,
225-
onDownloadProgress?: (progress: LoadProgress) => void
217+
declare export interface ConfigProfiles {
218+
list(options?: TimeoutOptions): Promise<Array<{ name: string, description: string }>>;
219+
apply(name: string, options?: { dryRun?: boolean } & TimeoutOptions): Promise<{ original: Object, updated: Object }>;
226220
}
227221

228-
declare type LoadProgress = {
229-
total: number,
230-
loaded: number,
231-
lengthComputable: boolean
222+
declare export interface ConfigService {
223+
get(key: string, options?: TimeoutOptions): Promise<Object>;
224+
getAll(options?: TimeoutOptions): Promise<Object>;
225+
set(key: string, value: string | number | null | boolean | Object, options?: TimeoutOptions): Promise<void>;
226+
replace(config: Object, options?: TimeoutOptions): Promise<void>;
227+
228+
profiles: ConfigProfiles;
232229
}
233230

234-
declare export type UnixFSEntry = {
235-
path: string,
236-
cid: CID,
237-
mode: number,
238-
mtime: UnixFSTime,
239-
size: number
231+
declare export interface IPFSService extends CoreService {
232+
pin: PinService;
233+
files: FileService;
234+
name: NameService;
235+
object: ObjectService;
236+
config: ConfigService;
237+
dag: KuboRPCClient['dag'];
238+
239+
stop(options?: TimeoutOptions): Promise<void>
240240
}
241241

242-
declare export type UnixFSTime = {
243-
secs: number,
244-
nsecs: number
242+
declare export interface SwarmService {
243+
connect(addr: Multiaddr, options?: TimeoutOptions): Promise<void>
245244
}
246245

247-
declare export var IPFS: IPFSService
246+
declare export let IPFS: IPFSService
248247
}

@types/it-all/index.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
declare module "it-all" {
1+
declare module 'it-all' {
22
function all<T>(source: AsyncIterable<T>): Promise<T[]>
33

44
export default all
5-
}
5+
}

@types/it-first/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
declare module "it-first" {
1+
declare module 'it-first' {
22
function first<T>(input: AsyncIterable<T>): Promise<T>
33

44
export default first

@types/it-last/index.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
declare module "it-last" {
1+
declare module 'it-last' {
22
function last<T>(input: AsyncIterable<T>): Promise<T>
33

44
export default last
5-
}
5+
}

@types/it-map/index.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
declare module "it-map" {
1+
declare module 'it-map' {
22
function map<I, O>(input: AsyncIterable<I>, f: (input: I) => O): AsyncIterable<O>
33
export default map
4-
}
4+
}

0 commit comments

Comments
 (0)