@uploadista/react-native-core 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,396 @@
1
+
2
+ > @uploadista/react-native@0.1.0 check /Users/denislaboureyras/Documents/uploadista/dev/uploadista/packages/uploadista/clients/react-native
3
+ > biome check --write ./src
4
+
5
+ src/components/UploadList.tsx:110:10 lint/style/useTemplate FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
6
+
7
+ i Template literals are preferred over string concatenation.
8
+
9
+ 108 │ const sizes = ["B", "KB", "MB", "GB"];
10
+ 109 │ const i = Math.floor(Math.log(bytes) / Math.log(k));
11
+ > 110 │ return Math.round((bytes / k ** i) * 10) / 10 + " " + sizes[i];
12
+ │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
13
+ 111 │ }
14
+ 112 │
15
+
16
+ i Unsafe fix: Use a template literal.
17
+
18
+ 108 108 │ const sizes = ["B", "KB", "MB", "GB"];
19
+ 109 109 │ const i = Math.floor(Math.log(bytes) / Math.log(k));
20
+ 110 │ - ··return·Math.round((bytes·/·k·**·i)·*·10)·/·10·+·"·"·+·sizes[i];
21
+ 110 │ + ··return·`${Math.round((bytes·/·k·**·i)·*·10)·/·10}·${sizes[i]}`;
22
+ 111 111 │ }
23
+ 112 112 │
24
+
25
+
26
+ src/components/UploadProgress.tsx:18:12 lint/style/useTemplate FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━
27
+
28
+ i Template literals are preferred over string concatenation.
29
+
30
+ 16 │ const formatSpeed = (bytesPerSecond?: number): string => {
31
+ 17 │ if (!bytesPerSecond) return "--";
32
+ > 18 │ return formatFileSize(bytesPerSecond) + "/s";
33
+ │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
34
+ 19 │ };
35
+ 20 │
36
+
37
+ i Unsafe fix: Use a template literal.
38
+
39
+ 16 16 │ const formatSpeed = (bytesPerSecond?: number): string => {
40
+ 17 17 │ if (!bytesPerSecond) return "--";
41
+ 18 │ - ····return·formatFileSize(bytesPerSecond)·+·"/s";
42
+ 18 │ + ····return·`${formatFileSize(bytesPerSecond)}/s`;
43
+ 19 19 │ };
44
+ 20 20 │
45
+
46
+
47
+ src/utils/fileHelpers.ts:17:10 lint/style/useTemplate FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
48
+
49
+ i Template literals are preferred over string concatenation.
50
+
51
+ 15 │ const i = Math.floor(Math.log(bytes) / Math.log(k));
52
+ 16 │
53
+ > 17 │ return Math.round((bytes / k ** i) * 100) / 100 + " " + sizes[i];
54
+ │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
55
+ 18 │ }
56
+ 19 │
57
+
58
+ i Unsafe fix: Use a template literal.
59
+
60
+ 15 15 │ const i = Math.floor(Math.log(bytes) / Math.log(k));
61
+ 16 16 │
62
+ 17 │ - ··return·Math.round((bytes·/·k·**·i)·*·100)·/·100·+·"·"·+·sizes[i];
63
+ 17 │ + ··return·`${Math.round((bytes·/·k·**·i)·*·100)·/·100}·${sizes[i]}`;
64
+ 18 18 │ }
65
+ 19 19 │
66
+
67
+
68
+ src/utils/fileHelpers.ts:93:34 lint/style/useTemplate FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
69
+
70
+ i Template literals are preferred over string concatenation.
71
+
72
+ 91 │ // Handle wildcard patterns like 'image/*'
73
+ 92 │ const [type] = allowed.split("/");
74
+ > 93 │ return mimeType.startsWith(type + "/");
75
+ │ ^^^^^^^^^^
76
+ 94 │ }
77
+ 95 │ return allowed === mimeType;
78
+
79
+ i Unsafe fix: Use a template literal.
80
+
81
+ 91 91 │ // Handle wildcard patterns like 'image/*'
82
+ 92 92 │ const [type] = allowed.split("/");
83
+ 93 │ - ······return·mimeType.startsWith(type·+·"/");
84
+ 93 │ + ······return·mimeType.startsWith(`${type}/`);
85
+ 94 94 │ }
86
+ 95 95 │ return allowed === mimeType;
87
+
88
+
89
+ src/UploadistaProvider.tsx:15:11 lint/suspicious/noExplicitAny ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
90
+
91
+ ! Unexpected any. Specify a different type.
92
+
93
+ 13 │ export interface UploadistaProviderProps {
94
+ 14 │ /** The Uploadista client instance */
95
+ > 15 │ client: any; // UploadClient from @uploadista/client
96
+ │ ^^^
97
+ 16 │ /** File system provider configuration or instance */
98
+ 17 │ fileSystemProvider?: FileSystemProvider | FileSystemProviderConfig;
99
+
100
+ i any disables many type checking rules. Its use should be avoided.
101
+
102
+
103
+ src/UploadistaProvider.tsx:2:8 lint/correctness/noUnusedImports FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━
104
+
105
+ ! These imports are unused.
106
+
107
+ 1 │ import type { ReactNode } from "react";
108
+ > 2 │ import React, { useMemo } from "react";
109
+ │ ^^^^^
110
+ 3 │ import {
111
+ 4 │ UploadistaContext,
112
+
113
+ i Unused imports might be the result of an incomplete refactoring.
114
+
115
+ i Unsafe fix: Remove the unused imports.
116
+
117
+ 2 │ import·React,·{·useMemo·}·from·"react";
118
+ │ -------
119
+
120
+ src/hooks/UploadistaContext.ts:5:11 lint/suspicious/noExplicitAny ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
121
+
122
+ ! Unexpected any. Specify a different type.
123
+
124
+ 4 │ export interface UploadistaContextType {
125
+ > 5 │ client: any; // UploadClient from @uploadista/client
126
+ │ ^^^
127
+ 6 │ fileSystemProvider: FileSystemProvider;
128
+ 7 │ }
129
+
130
+ i any disables many type checking rules. Its use should be avoided.
131
+
132
+
133
+ src/hooks/useSingleUpload.ts:5:3 lint/correctness/noUnusedImports FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━
134
+
135
+ ! Several of these imports are unused.
136
+
137
+ 3 │ FilePickResult,
138
+ 4 │ SingleUploadState,
139
+ > 5 │ UploadState,
140
+ │ ^^^^^^^^^^^
141
+ 6 │ UseSingleUploadOptions,
142
+ 7 │ } from "../types";
143
+
144
+ i Unused imports might be the result of an incomplete refactoring.
145
+
146
+ i Unsafe fix: Remove the unused imports.
147
+
148
+ 3 3 │ FilePickResult,
149
+ 4 4 │ SingleUploadState,
150
+ 5 │ - ··UploadState,
151
+ 6 5 │ UseSingleUploadOptions,
152
+ 7 6 │ } from "../types";
153
+
154
+
155
+ src/hooks/useUploadMetrics.ts:30:29 lint/correctness/noUnusedFunctionParameters FIXABLE ━━━━━━━━━━
156
+
157
+ ! This parameter is unused.
158
+
159
+ 28 │ // Update metrics based on current progress
160
+ 29 │ const update = useCallback(
161
+ > 30 │ (uploadedBytes: number, totalBytes: number, currentRetries = 0) => {
162
+ │ ^^^^^^^^^^
163
+ 31 │ if (!startTimeRef.current) {
164
+ 32 │ return;
165
+
166
+ i Unused parameters might be the result of an incomplete refactoring.
167
+
168
+ i Unsafe fix: If this is intentional, prepend totalBytes with an underscore.
169
+
170
+ 28 28 │ // Update metrics based on current progress
171
+ 29 29 │ const update = useCallback(
172
+ 30 │ - ····(uploadedBytes:·number,·totalBytes:·number,·currentRetries·=·0)·=>·{
173
+ 30 │ + ····(uploadedBytes:·number,·_totalBytes:·number,·currentRetries·=·0)·=>·{
174
+ 31 31 │ if (!startTimeRef.current) {
175
+ 32 32 │ return;
176
+
177
+
178
+ src/providers/NativeFileSystemProvider.ts:113:29 lint/style/noNonNullAssertion ━━━━━━━━━━━━━━━━━━━━━
179
+
180
+ ! Forbidden non-null assertion.
181
+
182
+ 111 │ reject(new Error(`Image picker error: ${res.errorCode}`));
183
+ 112 │ } else if (res.assets && res.assets.length > 0) {
184
+ > 113 │ const asset = res.assets[0]!;
185
+ │ ^^^^^^^^^^^^^^
186
+ 114 │ resolve({
187
+ 115 │ uri: asset.uri,
188
+
189
+
190
+ src/providers/NativeFileSystemProvider.ts:160:29 lint/style/noNonNullAssertion ━━━━━━━━━━━━━━━━━━━━━
191
+
192
+ ! Forbidden non-null assertion.
193
+
194
+ 158 │ reject(new Error(`Video picker error: ${res.errorCode}`));
195
+ 159 │ } else if (res.assets && res.assets.length > 0) {
196
+ > 160 │ const asset = res.assets[0]!;
197
+ │ ^^^^^^^^^^^^^^
198
+ 161 │ resolve({
199
+ 162 │ uri: asset.uri,
200
+
201
+
202
+ src/providers/NativeFileSystemProvider.ts:208:29 lint/style/noNonNullAssertion ━━━━━━━━━━━━━━━━━━━━━
203
+
204
+ ! Forbidden non-null assertion.
205
+
206
+ 206 │ reject(new Error(`Camera error: ${res.errorCode}`));
207
+ 207 │ } else if (res.assets && res.assets.length > 0) {
208
+ > 208 │ const asset = res.assets[0]!;
209
+ │ ^^^^^^^^^^^^^^
210
+ 209 │ resolve({
211
+ 210 │ uri: asset.uri,
212
+
213
+
214
+ src/providers/NativeFileSystemProvider.ts:20:14 lint/correctness/noUnusedVariables FIXABLE ━━━━━━━━━━
215
+
216
+ ! This variable error is unused.
217
+
218
+ 18 │ try {
219
+ 19 │ return await import("react-native-document-picker");
220
+ > 20 │ } catch (error) {
221
+ │ ^^^^^
222
+ 21 │ throw new Error(
223
+ 22 │ "react-native-document-picker not installed. Install with: npm install react-native-document-picker",
224
+
225
+ i Unused variables are often the result of an incomplete refactoring, typos, or other sources of bugs.
226
+
227
+ i Unsafe fix: If this is intentional, prepend error with an underscore.
228
+
229
+ 18 18 │ try {
230
+ 19 19 │ return await import("react-native-document-picker");
231
+ 20 │ - ····}·catch·(error)·{
232
+ 20 │ + ····}·catch·(_error)·{
233
+ 21 21 │ throw new Error(
234
+ 22 22 │ "react-native-document-picker not installed. Install with: npm install react-native-document-picker",
235
+
236
+
237
+ src/providers/NativeFileSystemProvider.ts:33:14 lint/correctness/noUnusedVariables FIXABLE ━━━━━━━━━━
238
+
239
+ ! This variable error is unused.
240
+
241
+ 31 │ try {
242
+ 32 │ return await import("react-native-image-picker");
243
+ > 33 │ } catch (error) {
244
+ │ ^^^^^
245
+ 34 │ throw new Error(
246
+ 35 │ "react-native-image-picker not installed. Install with: npm install react-native-image-picker",
247
+
248
+ i Unused variables are often the result of an incomplete refactoring, typos, or other sources of bugs.
249
+
250
+ i Unsafe fix: If this is intentional, prepend error with an underscore.
251
+
252
+ 31 31 │ try {
253
+ 32 32 │ return await import("react-native-image-picker");
254
+ 33 │ - ····}·catch·(error)·{
255
+ 33 │ + ····}·catch·(_error)·{
256
+ 34 34 │ throw new Error(
257
+ 35 35 │ "react-native-image-picker not installed. Install with: npm install react-native-image-picker",
258
+
259
+
260
+ src/providers/NativeFileSystemProvider.ts:46:14 lint/correctness/noUnusedVariables FIXABLE ━━━━━━━━━━
261
+
262
+ ! This variable error is unused.
263
+
264
+ 44 │ try {
265
+ 45 │ return await import("rn-fetch-blob");
266
+ > 46 │ } catch (error) {
267
+ │ ^^^^^
268
+ 47 │ throw new Error(
269
+ 48 │ "rn-fetch-blob not installed. Install with: npm install rn-fetch-blob",
270
+
271
+ i Unused variables are often the result of an incomplete refactoring, typos, or other sources of bugs.
272
+
273
+ i Unsafe fix: If this is intentional, prepend error with an underscore.
274
+
275
+ 44 44 │ try {
276
+ 45 45 │ return await import("rn-fetch-blob");
277
+ 46 │ - ····}·catch·(error)·{
278
+ 46 │ + ····}·catch·(_error)·{
279
+ 47 47 │ throw new Error(
280
+ 48 48 │ "rn-fetch-blob not installed. Install with: npm install rn-fetch-blob",
281
+
282
+
283
+ src/utils/permissions.ts:134:3 lint/correctness/noUnusedFunctionParameters FIXABLE ━━━━━━━━━━━━━━━
284
+
285
+ ! This parameter is unused.
286
+
287
+ 132 │ */
288
+ 133 │ export async function hasPermissions(
289
+ > 134 │ permissions: PermissionType[],
290
+ │ ^^^^^^^^^^^
291
+ 135 │ ): Promise<boolean> {
292
+ 136 │ try {
293
+
294
+ i Unused parameters might be the result of an incomplete refactoring.
295
+
296
+ i Unsafe fix: If this is intentional, prepend permissions with an underscore.
297
+
298
+ 132 132 │ */
299
+ 133 133 │ export async function hasPermissions(
300
+ 134 │ - ··permissions:·PermissionType[],
301
+ 134 │ + ··_permissions:·PermissionType[],
302
+ 135 135 │ ): Promise<boolean> {
303
+ 136 136 │ try {
304
+
305
+
306
+ src/utils/permissions.ts:152:3 lint/correctness/noUnusedFunctionParameters FIXABLE ━━━━━━━━━━━━━━━
307
+
308
+ ! This parameter is unused.
309
+
310
+ 150 │ */
311
+ 151 │ export async function getPermissionStatus(
312
+ > 152 │ permission: PermissionType,
313
+ │ ^^^^^^^^^^
314
+ 153 │ ): Promise<PermissionStatus> {
315
+ 154 │ try {
316
+
317
+ i Unused parameters might be the result of an incomplete refactoring.
318
+
319
+ i Unsafe fix: If this is intentional, prepend permission with an underscore.
320
+
321
+ 150 150 │ */
322
+ 151 151 │ export async function getPermissionStatus(
323
+ 152 │ - ··permission:·PermissionType,
324
+ 152 │ + ··_permission:·PermissionType,
325
+ 153 153 │ ): Promise<PermissionStatus> {
326
+ 154 154 │ try {
327
+
328
+
329
+ src/hooks/useGalleryUpload.ts:23:11 lint/suspicious/noImplicitAnyLet ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
330
+
331
+ × This variable implicitly has the any type.
332
+
333
+ 21 │ const selectAndUpload = useCallback(async () => {
334
+ 22 │ try {
335
+ > 23 │ let media;
336
+ │ ^^^^^
337
+ 24 │
338
+ 25 │ // Select appropriate media type
339
+
340
+ i Variable declarations without type annotation and initialization implicitly have the any type. Declare a type or initialize the variable with some value.
341
+
342
+
343
+ src/hooks/useMultiUpload.ts:255:33 lint/suspicious/useIterableCallbackReturn ━━━━━━━━━━━━━━━━━━━━━━━
344
+
345
+ × This callback passed to forEach() iterable method should not return a value.
346
+
347
+ 253 │ // Clear all items
348
+ 254 │ const clear = useCallback(() => {
349
+ > 255 │ abortControllersRef.current.forEach((controller) => controller.abort());
350
+ │ ^^^^^^^
351
+ 256 │ abortControllersRef.current.clear();
352
+ 257 │ uploadTasksRef.current.clear();
353
+
354
+ i Either remove this return or remove the returned value.
355
+
356
+ 253 │ // Clear all items
357
+ 254 │ const clear = useCallback(() => {
358
+ > 255 │ abortControllersRef.current.forEach((controller) => controller.abort());
359
+ │ ^^^^^^^^^^^^^^^^^^
360
+ 256 │ abortControllersRef.current.clear();
361
+ 257 │ uploadTasksRef.current.clear();
362
+
363
+
364
+ src/hooks/useMultiUpload.ts:270:35 lint/suspicious/useIterableCallbackReturn ━━━━━━━━━━━━━━━━━━━━━━━
365
+
366
+ × This callback passed to forEach() iterable method should not return a value.
367
+
368
+ 268 │ useEffect(() => {
369
+ 269 │ return () => {
370
+ > 270 │ abortControllersRef.current.forEach((controller) => controller.abort());
371
+ │ ^^^^^^^
372
+ 271 │ };
373
+ 272 │ }, []);
374
+
375
+ i Either remove this return or remove the returned value.
376
+
377
+ 268 │ useEffect(() => {
378
+ 269 │ return () => {
379
+ > 270 │ abortControllersRef.current.forEach((controller) => controller.abort());
380
+ │ ^^^^^^^^^^^^^^^^^^
381
+ 271 │ };
382
+ 272 │ }, []);
383
+
384
+
385
+ Skipped 12 suggested fixes.
386
+ If you wish to apply the suggested (unsafe) fixes, use the command biome check --write --unsafe
387
+
388
+ Checked 27 files in 21ms. No fixes applied.
389
+ Found 3 errors.
390
+ Found 13 warnings.
391
+ check ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
392
+
393
+ × Some errors were emitted while applying fixes.
394
+
395
+
396
+  ELIFECYCLE  Command failed with exit code 1.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 uploadista
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.