diff --git a/.eslintignore b/.eslintignore index 8ca6e026..d2fabcea 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,3 +1,4 @@ venv .venv -standalone_app \ No newline at end of file +standalone_app +vscode \ No newline at end of file diff --git a/package.json b/package.json index 9c214ab9..5b5d301a 100644 --- a/package.json +++ b/package.json @@ -5,10 +5,10 @@ "description": "Dashboard for Optuna", "main": "index.js", "scripts": { - "fmt": "biome format --write . && biome check standalone_app --apply", + "fmt": "biome format --write . && biome check standalone_app vscode --apply", "lint": "npm run lint:eslint && npm run lint:biome", "lint:eslint": "eslint . --ext .ts,.tsx --max-warnings 0", - "lint:biome": "biome format . && biome ci standalone_app", + "lint:biome": "biome format . && biome ci standalone_app vscode", "watch": "NODE_ENV=development TYPESCRIPT_LOADER=esbuild-loader webpack --watch", "build": "webpack", "build:dev": "NODE_ENV=development TYPESCRIPT_LOADER=esbuild-loader webpack", diff --git a/vscode/src/web/extension.ts b/vscode/src/web/extension.ts index 914f35ba..270e4866 100644 --- a/vscode/src/web/extension.ts +++ b/vscode/src/web/extension.ts @@ -5,7 +5,7 @@ export function activate(context: vscode.ExtensionContext) { 'Congratulations, your extension "optuna-dashboard" is now active in the web extension host!' ) - let disposable = vscode.commands.registerCommand( + const disposable = vscode.commands.registerCommand( "optuna-dashboard.openOptunaDashboard", async (fileUri: vscode.Uri) => { // In VS Code, the path separator of fileUri is always '/' @@ -30,15 +30,17 @@ export function activate(context: vscode.ExtensionContext) { const appPath = panel.webview.asWebviewUri(indexJsUri) panel.webview.html = getWebviewContent(appPath) + // biome-ignore lint/suspicious/noExplicitAny: ` panel.webview.onDidReceiveMessage(async (message: any) => { switch (message.type) { - case "webviewDidLoad": + case "webviewDidLoad": { const storageContentBase64 = await readFileAsBase64(fileUri) panel.webview.postMessage({ type: "optunaStorage", content: storageContentBase64, }) break + } } }) } @@ -55,9 +57,7 @@ async function readFileAsBase64(uri: vscode.Uri): Promise { function uint8ArrayToBase64(uint8Array: Uint8Array): string { const binString = Array.prototype.map - .call(uint8Array, function (ch) { - return String.fromCharCode(ch) - }) + .call(uint8Array, (ch) => String.fromCharCode(ch)) .join("") return btoa(binString) }