From a96414e6b9e1c127a0eabb1129a33e656bc63e08 Mon Sep 17 00:00:00 2001 From: Quentin Gliech Date: Thu, 9 Apr 2026 13:47:38 +0200 Subject: [PATCH] fix(web): resolve remaining non-story lint warnings - Fix unsafe type assertion in file-viewer: use instanceof check for click target, suppress shiki dynamic import casts with comments. - Suppress no-unassigned-import in apollo-client.d.ts (declaration merging). - Remove unused LabelColor and BrandedLabel types from label-editor story. Remaining 31 warnings are all in story files: oxlint can't resolve makeFragmentData's generic constraint with optional $fragmentName. Co-Authored-By: Claude Opus 4.6 (1M context) --- webui2/src/apollo-client.d.ts | 1 + webui2/src/components/bugs/label-editor.stories.tsx | 2 -- webui2/src/components/code/file-viewer.tsx | 13 +++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/webui2/src/apollo-client.d.ts b/webui2/src/apollo-client.d.ts index 06ceeca075c1faee1a4e281e56a8973c69943798..fa2a050df6ca0aaf0be740200fb776d3c9181b84 100644 --- a/webui2/src/apollo-client.d.ts +++ b/webui2/src/apollo-client.d.ts @@ -1,3 +1,4 @@ +// oxlint-disable-next-line eslint-plugin-import(no-unassigned-import) -- declaration merging import "@apollo/client"; import type { GraphQLCodegenDataMasking } from "@apollo/client/masking"; diff --git a/webui2/src/components/bugs/label-editor.stories.tsx b/webui2/src/components/bugs/label-editor.stories.tsx index c44e6d3070d23b606480dbbbbff21576b09433d6..c7556b4d624f32200fc2d1fe603a890ecda0b01c 100644 --- a/webui2/src/components/bugs/label-editor.stories.tsx +++ b/webui2/src/components/bugs/label-editor.stories.tsx @@ -36,8 +36,6 @@ const allLabels = allLabelsData.map( (l) => ({ ...l, ...makeFragmentData(l, LABEL_FIELDS_FRAGMENT) }), ); -type LabelColor = { R: number; G: number; B: number }; -type BrandedLabel = (typeof allLabels)[number]; function LabelEditorDemo() { const [currentNames, setCurrentNames] = useState>( diff --git a/webui2/src/components/code/file-viewer.tsx b/webui2/src/components/code/file-viewer.tsx index 8ed067b55af6f43cc638c7ed2840ff9dec705ba9..b795142c8730a7093a60c30ff6a930f80fb7c557 100644 --- a/webui2/src/components/code/file-viewer.tsx +++ b/webui2/src/components/code/file-viewer.tsx @@ -201,10 +201,9 @@ export function FileViewer({ blob: blobProp }: FileViewerProps) { let lang = "text"; if (entry) { try { - const langModule = await entry.load(); - await highlighter.loadLanguage( - langModule as Parameters[0], - ); + // oxlint-disable-next-line typescript-eslint(no-unsafe-type-assertion) -- dynamic shiki language import + const langModule = (await entry.load()) as Parameters[0]; + await highlighter.loadLanguage(langModule); lang = entry.id; } catch { // Language not available — fall back to plain text @@ -220,9 +219,11 @@ export function FileViewer({ blob: blobProp }: FileViewerProps) { transformers: [lineNumberTransformer()], }); + // oxlint-disable-next-line typescript-eslint(no-unsafe-assignment) -- hast-util-to-jsx-runtime returns JSX.Element const node = toJsxRuntime(hast, { Fragment, jsx, jsxs }); const lineCount = blob.text!.split("\n").length; + // oxlint-disable-next-line typescript-eslint(no-unsafe-assignment) -- node is ReactNode from toJsxRuntime setHighlighted({ node, lineCount }); })(); @@ -297,8 +298,8 @@ function CodeBlock({ selectedRange, onLineClick, children }: CodeBlockProps) {
{ - const target = e.target as HTMLElement; - const lineEl = target.closest("[data-line-number]"); + if (!(e.target instanceof HTMLElement)) return; + const lineEl = e.target.closest("[data-line-number]"); if (lineEl) { e.preventDefault(); const lineNum = parseInt(lineEl.getAttribute("data-line-number")!, 10);