Merge pull request #833 from c-bata/biome-ci-vscode

[vscode] Use `biome ci` instead of `eslint`
This commit is contained in:
c-bata
2024-03-11 14:21:11 +09:00
committed by GitHub
3 changed files with 9 additions and 8 deletions
+2 -1
View File
@@ -1,3 +1,4 @@
venv
.venv
standalone_app
standalone_app
vscode
+2 -2
View File
@@ -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",
+5 -5
View File
@@ -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: <explanation>`
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<string> {
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)
}