kleros/kleros-v2

View on GitHub
web/src/utils/atlas/uploadToIpfs.ts

Summary

Maintainability
A
1 hr
Test Coverage

Function uploadToIpfs has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export async function uploadToIpfs(config: Config, payload: IpfsUploadPayload): Promise<string | null> {
  const formData = new FormData();
  formData.append("file", payload.file, payload.name);
  formData.append("name", payload.name);
  formData.append("product", payload.product);
Severity: Minor
Found in web/src/utils/atlas/uploadToIpfs.ts - About 1 hr to fix

Unnecessary 'await'.
Open

      return await response.text();
Severity: Minor
Found in web/src/utils/atlas/uploadToIpfs.ts by tslint

Rule: no-return-await

Disallows unnecessary return await.

Rationale

An async function always wraps the return value in a Promise. Using return await just adds extra time before the overreaching promise is resolved without changing the semantics.

Notes
  • Has Fix

Config

Not configurable.

Examples
"no-return-await": true

For more information see this page.

There are no issues that match your filters.

Category
Status