Skip to content

Commit 7e1170a

Browse files
committed
Fix linting
1 parent b17b384 commit 7e1170a

File tree

3 files changed

+14
-16
lines changed

3 files changed

+14
-16
lines changed

src/download.ts

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,8 @@ export async function downloadToString(url: string): Promise<string> {
5656
return result.toString()
5757
}
5858

59-
export async function downloadFile(url: string, options: string | DownloadOptions): Promise<string| null> {
60-
if (isString(options)) {
61-
options = { path: options };
62-
}
59+
export async function downloadFile(url: string, opts: string | DownloadOptions): Promise<string| null> {
60+
const options = isString(opts) ? { path: opts } : opts;
6361

6462
const result = createWriteStream(options.path as string);
6563
const sum = await downloadToStream(url, result, options.hashType);
@@ -69,10 +67,9 @@ export async function downloadFile(url: string, options: string | DownloadOption
6967
return sum;
7068
}
7169

72-
export async function downloadTgz(url: string, options: string | DownloadOptions): Promise<string | null> {
73-
if (isString(options)) {
74-
options = { cwd: options };
75-
}
70+
export async function downloadTgz(url: string, opts: string | DownloadOptions): Promise<string | null> {
71+
const options = isString(opts) ? { path: opts } : opts;
72+
7673
const gunzip = createGunzip();
7774
const extractor = extractTar(options);
7875
gunzip.pipe(extractor);
@@ -83,10 +80,9 @@ export async function downloadTgz(url: string, options: string | DownloadOptions
8380
return sum;
8481
}
8582

86-
export async function downloadZip(url: string, options: string | DownloadOptions): Promise<string | null> {
87-
if (isString(options)) {
88-
options = { path: options };
89-
}
83+
export async function downloadZip(url: string, opts: string | DownloadOptions): Promise<string | null> {
84+
const options = isString(opts) ? { path: opts } : opts;
85+
9086
const extractor = extractZip({ path: options.path as string });
9187
const sum = await downloadToStream(url, extractor, options.hashType);
9288
if (!checkHashSum(sum, options)) {

src/modules.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ declare module "memory-stream" {
99
private buffer;
1010
private options;
1111
constructor(options?: MemoryStreamOptions);
12+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
1213
_write(chunk: any, encoding: BufferEncoding, callback: (error?: Error | null) => void): void;
1314
get(): Buffer;
1415
toString(): string;

src/nodeAPIInclude/search.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,12 @@ async function dirHasFile(dir: string, fileName: string) {
2727
};
2828

2929
function goUp(dir: string) {
30-
const items = dir.split(pathSeparator);
30+
let myDir = dir;
31+
const items = myDir.split(pathSeparator);
3132
const scope = items[items.length - 2];
3233
if (scope && scope.charAt(0) === '@') {
33-
dir = joinPath(dir, '..');
34+
myDir = joinPath(myDir, '..');
3435
}
35-
dir = joinPath(dir, '..', '..');
36-
return normalizePath(dir);
36+
myDir = joinPath(myDir, '..', '..');
37+
return normalizePath(myDir);
3738
}

0 commit comments

Comments
 (0)