Skip to content

Commit

Permalink
lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ctw-joao-luis committed Dec 9, 2024
1 parent ef0ec03 commit 43934df
Show file tree
Hide file tree
Showing 5 changed files with 1,924 additions and 74 deletions.
15 changes: 14 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,23 @@
"@types/node": "22.9.0",
"@types/node-fetch": "2.6.12",
"@types/tmp": "0.2.6",
"@typescript-eslint/eslint-plugin": "8.16.0",
"css-loader": "7.1.2",
"eslint": "8.53.0",
"eslint-config-prettier": "9.1.0",
"eslint-import-resolver-webpack": "0.13.8",
"eslint-plugin-es": "4.1.0",
"eslint-plugin-file-progress": "1.4.0",
"eslint-plugin-filenames": "1.3.2",
"eslint-plugin-import": "2.29.1",
"eslint-plugin-jest": "27.6.3",
"eslint-plugin-prettier": "5.1.3",
"eslint-plugin-react": "7.33.2",
"eslint-plugin-react-hooks": "4.6.0",
"eslint-plugin-storybook": "0.6.15",
"eslint-plugin-tss-unused-classes": "1.0.2",
"jest": "29.7.0",
"prettier": "3.3.3",
"prettier": "3.4.2",
"style-loader": "4.0.0",
"tmp": "0.2.3",
"ts-jest": "29.2.5",
Expand Down
4 changes: 1 addition & 3 deletions src/bin/create-lichtblick-extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ import { program } from "commander";
import { createCommand } from "..";

program
.description(
"Creates a new Lichtblick extension.",
)
.description("Creates a new Lichtblick extension.")
.showHelpAfterError()
.argument("<name>", "Name for the new extension")
.allowExcessArguments(false)
Expand Down
2 changes: 1 addition & 1 deletion src/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ async function installDependencies(extensionDir: string, deps: string[]): Promis
});
child.on("close", (code) => {
if (code !== 0) {
reject(new Error(`npm exited with code ${code ?? "<null>"}`));
reject(new Error(`npm exited with code ${String(code ?? "<null>")}`));
return;
}
resolve();
Expand Down
25 changes: 1 addition & 24 deletions src/package.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { spawn } from "child_process";
import { createHash } from "crypto";
import { createReadStream, createWriteStream } from "fs";
import { mkdir, readFile, readdir, stat } from "fs/promises";
import JSZip from "jszip";
import ncp from "ncp";
import fetch from "node-fetch";
import { homedir } from "os";
import { join, normalize, relative, sep } from "path";
import { rimraf } from "rimraf";
Expand Down Expand Up @@ -133,7 +131,7 @@ async function prepublish(extensionPath: string, pkg: PackageManifest): Promise<
if (code === 0) {
resolve();
} else {
reject(new Error(`${tool} failed with exit code ${code ?? "<null>"}`));
reject(new Error(`${tool} failed with exit code ${String(code ?? "<null>")}`));
}
});
child.on("error", reject);
Expand Down Expand Up @@ -297,24 +295,3 @@ function inDirectory(directory: string, pathname: string): boolean {
const parts = relPath.split(sep);
return parts[0] !== "..";
}

async function githubRawFile(homepage: string, filename: string): Promise<string | undefined> {
const match = /^https:\/\/github\.com\/([^/]+)\/([^/?]+)$/.exec(homepage);
if (match == undefined) {
return undefined;
}

const [_, org, project] = match;
if (org == undefined || project == undefined) {
return undefined;
}

const url = `https://raw.githubusercontent.com/${org}/${project}/main/${filename}`;
try {
const res = await fetch(url);
const content = await res.text();
return content.length > 0 ? url : undefined;
} catch {
return undefined;
}
}
Loading

0 comments on commit 43934df

Please sign in to comment.