chore: enable noUnusedLocals in schema, server, sdk and smaller packages (#52850)

This commit is contained in:
Kit Langton
2026-10-02 15:23:59 -07:00
committed by GitHub
Unverified
parent 680bca3183
commit eb1a9ea4d9
30 changed files with 20 additions and 42 deletions
+1
View File
@@ -1,5 +1,6 @@
{
"compilerOptions": {
"noUnusedLocals": true,
"target": "ESNext",
"module": "ESNext",
"moduleResolution": "bundler",
@@ -251,10 +251,7 @@ class StringSerializeHandler extends BaseSerializeHandler {
private _nullCellCount: number = 0
private _cursorStyle: IBufferCell
private _firstRow: number = 0
private _lastCursorRow: number = 0
private _lastCursorCol: number = 0
private _lastContentCursorRow: number = 0
private _lastContentCursorCol: number = 0
constructor(
buffer: IBuffer,
@@ -274,7 +271,6 @@ class StringSerializeHandler extends BaseSerializeHandler {
this._cursorStyle = this._buffer.getNullCell()
this._lastContentCursorRow = start
this._lastCursorRow = start
this._firstRow = start
}
@@ -292,8 +288,6 @@ class StringSerializeHandler extends BaseSerializeHandler {
if (!isLastRow && !wrapped) {
rowSeparator = "\r\n"
this._lastCursorRow = row + 1
this._lastCursorCol = 0
}
this._allRows[this._rowIndex] = this._currentRow
@@ -437,8 +431,7 @@ class StringSerializeHandler extends BaseSerializeHandler {
this._nullCellCount = 0
}
this._lastContentCursorRow = this._lastCursorRow = row
this._lastContentCursorCol = this._lastCursorCol = col
this._lastContentCursorRow = row
this._currentRow += `\u001b[${sgrSeq.join(";")}m`
@@ -456,8 +449,7 @@ class StringSerializeHandler extends BaseSerializeHandler {
this._currentRow += cell.getChars()
this._lastContentCursorRow = this._lastCursorRow = row
this._lastContentCursorCol = this._lastCursorCol = col + cell.getWidth()
this._lastContentCursorRow = row
}
}
@@ -466,8 +458,6 @@ class StringSerializeHandler extends BaseSerializeHandler {
if (this._buffer.length - this._firstRow <= this._terminal.rows) {
rowEnd = this._lastContentCursorRow + 1 - this._firstRow
this._lastCursorCol = this._lastContentCursorCol
this._lastCursorRow = this._lastContentCursorRow
}
let content = ""
+1
View File
@@ -2,6 +2,7 @@
"$schema": "https://json.schemastore.org/tsconfig",
"extends": "@tsconfig/node22/tsconfig.json",
"compilerOptions": {
"noUnusedLocals": true,
"jsx": "preserve",
"jsxImportSource": "solid-js",
"target": "ESNext",
+1 -1
View File
@@ -1,5 +1,5 @@
import { Schema } from "effect"
import type { CassetteMetadata, JsonValue } from "../api.js"
import type { JsonValue } from "../api.js"
import { HttpInteractionSchema } from "../http/model.js"
import { WebSocketInteractionSchema } from "../websocket/model.js"
-1
View File
@@ -1,5 +1,4 @@
import { Schema } from "effect"
import type { RequestSnapshot } from "../api.js"
export const RequestSnapshotSchema = Schema.Struct({
method: Schema.String,
+1
View File
@@ -2,6 +2,7 @@
"$schema": "https://json.schemastore.org/tsconfig",
"extends": "@tsconfig/node22/tsconfig.json",
"compilerOptions": {
"noUnusedLocals": true,
"rootDir": "src",
"outDir": "dist",
"module": "nodenext",
-1
View File
@@ -1919,7 +1919,6 @@ function renderSchemas(slots: ReadonlyArray<Slot>) {
tagged.fields.map(([name, schema]) => ({ name: `Class${classIndex}${name}`, schema })),
),
]
const [first, ...rest] = expanded
const document = SchemaRepresentation.toCodeDocument(
SchemaRepresentation.toRepresentations(
codegenAsts(expanded.map((slot) => slot.schema.ast)) as [SchemaAST.AST, ...Array<SchemaAST.AST>],
@@ -32,4 +32,4 @@ export const program = OpenCode.make().pipe(
}),
)
const _requiresHttpClient: Effect.Effect<unknown, never, HttpClient.HttpClient> = program
export const requiresHttpClient: Effect.Effect<unknown, never, HttpClient.HttpClient> = program
+1
View File
@@ -2,6 +2,7 @@
"$schema": "https://json.schemastore.org/tsconfig",
"extends": "@tsconfig/bun/tsconfig.json",
"compilerOptions": {
"noUnusedLocals": true,
"lib": ["ESNext", "DOM", "DOM.Iterable"],
"noUncheckedIndexedAccess": false
}
-1
View File
@@ -8,7 +8,6 @@ import type {
} from "./types.js"
import { MermaidSyntaxError } from "../diagnostics.js"
import {
decodeMermaidText,
firstMeaningfulMermaidLine,
meaningfulNumberedMermaidLines,
stripMermaidQuotes as stripQuotes,
-1
View File
@@ -2,7 +2,6 @@ import { DiagramCanvas } from "../core/canvas.js"
import { diagramTextWidth } from "../core/text.js"
import type { GanttGrid } from "./render-grid.js"
import type {
GanttCellStyle,
GanttDiagram,
GanttDiagramRenderOptions,
GanttLabelLayout,
@@ -120,10 +120,6 @@ function visualLength(value: string): number {
return diagramTextWidth(value)
}
function centeredStart(center: number, text: string): number {
return center - Math.floor(visualLength(text) / 2)
}
function mermaidLabelLines(label: string): string[] {
const lines = label.split(/(?:<br\s*\/?\s*>|\\n)/i).map((line) => line.trimEnd())
return lines.length > 0 ? lines : [""]
+1 -1
View File
@@ -1,7 +1,7 @@
import { orthogonalPathPoints, translateDiagramBounds, type DiagramPoint } from "../core/geometry.js"
import { SpatialIndex, spatialPathClaim, spatialRectClaim } from "../core/spatial.js"
import { diagramTextWidth, measureDiagramTextBox, splitDiagramLines } from "../core/text.js"
import { stateDiagramNoteConnector, type StateDiagramNoteConnector } from "./note.js"
import type { StateDiagramNoteConnector } from "./note.js"
import {
createStateTransitionRenderPlans,
hasReverseTransition,
+1
View File
@@ -2,6 +2,7 @@
"$schema": "https://json.schemastore.org/tsconfig",
"extends": "@tsconfig/bun/tsconfig.json",
"compilerOptions": {
"noUnusedLocals": true,
"lib": ["ESNext", "DOM", "DOM.Iterable"],
"noUncheckedIndexedAccess": false
}
@@ -1,5 +1,4 @@
import { describe, expect, test } from "bun:test"
import { Schema } from "effect"
import {
Agent,
Config,
+1
View File
@@ -2,6 +2,7 @@
"$schema": "https://json.schemastore.org/tsconfig",
"extends": "@tsconfig/bun/tsconfig.json",
"compilerOptions": {
"noUnusedLocals": true,
"lib": ["ESNext", "DOM", "DOM.Iterable"],
"module": "NodeNext",
"moduleResolution": "NodeNext",
+1
View File
@@ -2,6 +2,7 @@
"$schema": "https://json.schemastore.org/tsconfig",
"extends": "@tsconfig/bun/tsconfig.json",
"compilerOptions": {
"noUnusedLocals": true,
"lib": ["ESNext", "DOM", "DOM.Iterable"],
"noUncheckedIndexedAccess": false
},
-1
View File
@@ -1,4 +1,3 @@
import { Bus } from "@opencode/core/bus"
import { Event } from "@opencode/schema/event"
import { Effect, Stream } from "effect"
import { HttpServerResponse } from "effect/unstable/http"
+1
View File
@@ -2,6 +2,7 @@
"$schema": "https://json.schemastore.org/tsconfig",
"extends": "@tsconfig/bun/tsconfig.json",
"compilerOptions": {
"noUnusedLocals": true,
"lib": ["ESNext", "DOM", "DOM.Iterable"],
"noUncheckedIndexedAccess": false
},
@@ -92,7 +92,7 @@ export function disposeMarkdownProjection(key: string) {
}
export function highlightStreamingCode(key: string, text: string, language: string, complete = false) {
const instance = getWorker()
getWorker()
const id = ++nextID
latest.set(key, id)
keys.delete(key)
@@ -69,7 +69,6 @@ type RawReviewDiff = (PresentationFileDiff | FileDiffInfo) & {
type ReviewDiff = ((PresentationFileDiff & { file: string }) | FileDiffInfo) & {
preloaded?: PreloadMultiFileDiffResult<unknown, undefined>
}
type Item = ViewDiff & { preloaded?: PreloadMultiFileDiffResult<unknown, undefined> }
function diff(value: unknown): value is ReviewDiff {
if (!value || typeof value !== "object" || Array.isArray(value)) return false
+1
View File
@@ -2,6 +2,7 @@
"$schema": "https://json.schemastore.org/tsconfig",
"extends": "@tsconfig/node22/tsconfig.json",
"compilerOptions": {
"noUnusedLocals": true,
"jsx": "preserve",
"jsxImportSource": "solid-js",
"target": "ESNext",
@@ -10,7 +10,6 @@ import {
Exit,
Fiber,
FiberSet,
JsonSchema,
Layer,
PubSub,
Queue,
+1
View File
@@ -2,6 +2,7 @@
"$schema": "https://json.schemastore.org/tsconfig",
"extends": "@tsconfig/bun/tsconfig.json",
"compilerOptions": {
"noUnusedLocals": true,
"lib": ["ESNext", "DOM", "DOM.Iterable"],
"noUncheckedIndexedAccess": false
},
@@ -1424,11 +1424,6 @@ function capitalizeLabel(value: string) {
return value.charAt(0).toUpperCase() + value.slice(1)
}
function formatRankMove(change: number) {
if (change > 0) return `+${change}`
return `${change}`
}
function formatHeroRank(rank: number | null) {
if (rank === null) return "--"
return String(rank).padStart(2, "0")
@@ -1463,14 +1458,6 @@ function formatSparklinePoint(value: number) {
return Number(value.toFixed(2)).toString()
}
function formatModelRankMoveLabel(data: StatsModelPageData, i18n: ReturnType<typeof useI18n>) {
if (data.rank === null) return i18n.t("model.noUsageLastWeek")
if (data.previousRank === null) return i18n.t("model.newThisWeek")
const change = data.previousRank - data.rank
if (change === 0) return i18n.t("model.sameAsPreviousWeek")
return i18n.t("model.vsPreviousWeek", { change: formatRankMove(change) })
}
function formatTokens(value: number) {
if (value >= 1_000_000_000_000)
return `${trimNumber(value / 1_000_000_000_000, value >= 10_000_000_000_000 ? 0 : 1)}T`
@@ -11,7 +11,6 @@ import {
ComparisonCardsSection,
comparisonHref,
modelRefFromCatalog,
type ComparisonModelRef,
type ComparisonPair,
} from "../compare-cards"
import { formatCatalogLabName, getModelCatalog, type ModelCatalogEntry } from "../model-catalog"
+1
View File
@@ -1,6 +1,7 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"compilerOptions": {
"noUnusedLocals": true,
"target": "ESNext",
"module": "ESNext",
"skipLibCheck": true,
+1
View File
@@ -2,6 +2,7 @@
"$schema": "https://json.schemastore.org/tsconfig",
"extends": "@tsconfig/node22/tsconfig.json",
"compilerOptions": {
"noUnusedLocals": true,
"module": "ESNext",
"moduleResolution": "bundler",
"strict": true,
+1
View File
@@ -2,6 +2,7 @@
"$schema": "https://json.schemastore.org/tsconfig",
"extends": "@tsconfig/node22/tsconfig.json",
"compilerOptions": {
"noUnusedLocals": true,
"module": "ESNext",
"moduleResolution": "bundler",
"strict": true,
+1
View File
@@ -2,6 +2,7 @@
"$schema": "https://json.schemastore.org/tsconfig",
"extends": "@tsconfig/node22/tsconfig.json",
"compilerOptions": {
"noUnusedLocals": true,
"jsx": "preserve",
"jsxImportSource": "solid-js",
"target": "ESNext",