From 54f38d7734184063118363d726b0b79c3a13f0cf Mon Sep 17 00:00:00 2001 From: Paulo Carinhena <63272749+paulocarinhena@users.noreply.github.com> Date: Sat, 14 Nov 2026 17:26:16 -0300 Subject: [PATCH] Adota o oxlint e zera erros e avisos de lint [skip release] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - oxlint 1.93 com plugins typescript, react, jsx-a11y, import e unicorn (.oxlintrc.json); script `npm run lint`; passo Lint no gitweb-build.yml (erros bloqueiam, avisos ficam no log). - Erros: imports/variáveis sem uso, regex -> startsWith, spreads inúteis; exceções intencionais (caracteres de controle, new Array pré-alocado) anotadas com o motivo. - Diálogos: o fundo só fecha quando o clique cai nele mesmo, sem stopPropagation no painel. - Acessibilidade: separadores de menu como
{bins[active].title}
+{fmt.number(series[active].additions)}{' '} diff --git a/GitWeb/src/renderer/src/components/RepoPickerModal.tsx b/GitWeb/src/renderer/src/components/RepoPickerModal.tsx index 7e701ef..d6a2437 100644 --- a/GitWeb/src/renderer/src/components/RepoPickerModal.tsx +++ b/GitWeb/src/renderer/src/components/RepoPickerModal.tsx @@ -20,6 +20,7 @@ function RepoPickerModal({ open, repoPaths, onConfirm, onCancel }: RepoPickerMod useFocusTrap(panelRef, open, { onEscape: onCancel }) useEffect(() => { + // oxlint-disable-next-line react/set-state-in-effect -- preselects every repository found, each time the picker opens if (open) setSelected(new Set(repoPaths)) }, [open, repoPaths]) @@ -37,14 +38,20 @@ function RepoPickerModal({ open, repoPaths, onConfirm, onCancel }: RepoPickerMod const allSelected = selected.size === repoPaths.length return ( -
{t.noBranchFound}
)} @@ -505,6 +505,7 @@ function SyncCard({ compact }: { compact: boolean }): JSX.Element { return found }, [currentRepoPath]) useEffect(() => { + // oxlint-disable-next-line react/set-state-in-effect -- asks main over IPC whether an origin exists once the branch has no upstream if (noUpstream) void checkOrigin() }, [noUpstream, checkOrigin]) const needsRepository = noUpstream && !hasOrigin @@ -514,6 +515,7 @@ function SyncCard({ compact }: { compact: boolean }): JSX.Element { useEffect(() => { if (!publishPrompt || !currentRepoPath) return clearPublishPrompt() + // oxlint-disable-next-line react/set-state-in-effect -- opens the publish dialog the start screen asked for, then clears the request setPublishOpen(true) }, [publishPrompt, currentRepoPath, clearPublishPrompt]) // Re-checked on click and when the dialog closes: an origin added outside diff --git a/GitWeb/src/renderer/src/components/UserSearchField.tsx b/GitWeb/src/renderer/src/components/UserSearchField.tsx index 331555f..6d31869 100644 --- a/GitWeb/src/renderer/src/components/UserSearchField.tsx +++ b/GitWeb/src/renderer/src/components/UserSearchField.tsx @@ -46,6 +46,7 @@ function UserSearchField({ id, host, value, onChange, statusOf, invalid, describ const showList = open && searchable useEffect(() => { + // oxlint-disable-next-line react/set-state-in-effect -- resets results as the query changes; the search itself runs over IPC setHighlighted(-1) if (!open || !searchable) { setResults([]) diff --git a/GitWeb/src/renderer/src/global-jsx.d.ts b/GitWeb/src/renderer/src/global-jsx.d.ts index ecc466a..8567d1d 100644 --- a/GitWeb/src/renderer/src/global-jsx.d.ts +++ b/GitWeb/src/renderer/src/global-jsx.d.ts @@ -15,4 +15,6 @@ declare global { } } +// Required: it makes this file a module, so `declare global` is allowed. +// oxlint-disable-next-line unicorn/require-module-specifiers export {} diff --git a/GitWeb/src/renderer/src/lib/ai/commitInvestigation.ts b/GitWeb/src/renderer/src/lib/ai/commitInvestigation.ts index aefd458..c85b663 100644 --- a/GitWeb/src/renderer/src/lib/ai/commitInvestigation.ts +++ b/GitWeb/src/renderer/src/lib/ai/commitInvestigation.ts @@ -462,7 +462,7 @@ export async function investigateCommitWithWorkers(input: CommitInvestigationInp ) const chunk = chunks[index] findings.push(...parseFindings(response.content).map((finding) => ({ ...finding, chunk }))) - } catch (error) { + } catch { if (input.isCancelled()) return { path: file.path, coverage: 'partial', findings } coverage = 'partial' } finally { diff --git a/GitWeb/src/renderer/src/lib/ai/proposeFix.ts b/GitWeb/src/renderer/src/lib/ai/proposeFix.ts index cc89d91..0abb5b7 100644 --- a/GitWeb/src/renderer/src/lib/ai/proposeFix.ts +++ b/GitWeb/src/renderer/src/lib/ai/proposeFix.ts @@ -5,7 +5,6 @@ import { proposeFixUserMessage, type AiLanguage } from '../../../../shared/aiPrompts' -import type { AiSettings } from '../../../../shared/ai' import { sendChatRequest } from './providers' import { unifiedPreview } from '../../../../shared/patch' import type { ResolvedAiConfig } from '../../../../shared/ai' diff --git a/GitWeb/src/renderer/src/lib/ai/tools.ts b/GitWeb/src/renderer/src/lib/ai/tools.ts index 80c5468..d3b0b39 100644 --- a/GitWeb/src/renderer/src/lib/ai/tools.ts +++ b/GitWeb/src/renderer/src/lib/ai/tools.ts @@ -1248,7 +1248,7 @@ async function prepareToolCallInner(call: ToolCallRequest): Promise