From 36152d2492f30594942c2d7b7a43221932e397a1 Mon Sep 17 00:00:00 2001 From: Elijah Potter Date: Mon, 22 Jan 2024 09:39:55 -0700 Subject: [PATCH] Fixed bug in previous suggestion filtering on web --- web/src/lib/Editor.svelte | 1 - web/src/lib/analysis.ts | 14 ++++++++------ web/yarn.lock | 12 ------------ 3 files changed, 8 insertions(+), 19 deletions(-) diff --git a/web/src/lib/Editor.svelte b/web/src/lib/Editor.svelte index 202114e8..685e27ae 100644 --- a/web/src/lib/Editor.svelte +++ b/web/src/lib/Editor.svelte @@ -30,7 +30,6 @@ function calcHeight(boxContent: string): number { let numberOfLineBreaks = (boxContent.match(/\n/g) || []).length; let newHeight = 20 + numberOfLineBreaks * 30 + 12 + 2; - console.log(newHeight); return newHeight; } diff --git a/web/src/lib/analysis.ts b/web/src/lib/analysis.ts index a78e07e9..1f9e2b36 100644 --- a/web/src/lib/analysis.ts +++ b/web/src/lib/analysis.ts @@ -81,11 +81,12 @@ export function spanContent(span: Span, source: string): string { } export async function lintText(text: string, useWasm = defaultUseWasm): Promise { + let lints; + if (useWasm) { const wasm = await import('wasm'); - const lints = wasm.lint(text); - return lints; + lints = wasm.lint(text); } else { const req = await fetch(`/lint`, { method: 'POST', @@ -97,11 +98,12 @@ export async function lintText(text: string, useWasm = defaultUseWasm): Promise< const res: LintResponse = await req.json(); - // We only want to show fixable errors. - const lints = res.lints.filter((lint) => lint.suggestions.length > 0); - console.log(lints); - return lints; + lints = res.lints; } + + // We only want to show fixable errors. + lints = lints.filter((lint) => lint.suggestions.length > 0); + return lints; } export async function applySuggestion( diff --git a/web/yarn.lock b/web/yarn.lock index 50ca1ca1..69e67331 100644 --- a/web/yarn.lock +++ b/web/yarn.lock @@ -419,13 +419,6 @@ resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.9.5.tgz#10491ccf4f63c814d4149e0316541476ea603602" integrity sha512-1q+mykKE3Vot1kaFJIDoUFv5TuW+QQVaf2FmTT9krg86pQrGStOSJJ0Zil7CFagyxDuouTepzt5Y5TVzyajOdQ== -"@sveltejs/adapter-auto@^2.0.0": - version "2.1.1" - resolved "https://registry.yarnpkg.com/@sveltejs/adapter-auto/-/adapter-auto-2.1.1.tgz#e055c71bdb8d2923d63db089752675f70ab1a0f3" - integrity sha512-nzi6x/7/3Axh5VKQ8Eed3pYxastxoa06Y/bFhWb7h3Nu+nGRVxKAy3+hBJgmPCwWScy8n0TsstZjSVKfyrIHkg== - dependencies: - import-meta-resolve "^4.0.0" - "@sveltejs/adapter-node@^3.0.0": version "3.0.0" resolved "https://registry.yarnpkg.com/@sveltejs/adapter-node/-/adapter-node-3.0.0.tgz#639ac5a26a6ed8efee14ed88a1bb4bab81abccb1" @@ -1489,11 +1482,6 @@ import-fresh@^3.2.1: parent-module "^1.0.0" resolve-from "^4.0.0" -import-meta-resolve@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/import-meta-resolve/-/import-meta-resolve-4.0.0.tgz#0b1195915689f60ab00f830af0f15cc841e8919e" - integrity sha512-okYUR7ZQPH+efeuMJGlq4f8ubUgO50kByRPyt/Cy1Io4PSRsPjxME+YlVaCOx+NIToW7hCsZNFJyTPFFKepRSA== - imurmurhash@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea"