Skip to content

Commit 8eaa80f

Browse files
brielovclaude
andcommitted
Fix linting warnings across codebase
- Add eslint-disable for runtime utilities in base.js (injected into generated code) - Add void to floating promises in test-integration.ts and index.ts - Apply formatter to LSP files 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 234ae5f commit 8eaa80f

8 files changed

Lines changed: 43 additions & 55 deletions

File tree

scripts/test-integration.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ async function runWithTimeout(file: string): Promise<{ ok: boolean; output: stri
3232
resolve({ ok: false, output: `TIMEOUT after ${TIMEOUT_MS}ms` });
3333
}, TIMEOUT_MS);
3434

35-
proc.exited.then(async (code) => {
35+
void proc.exited.then(async (code) => {
3636
clearTimeout(timeout);
3737
const stderr = await new Response(proc.stderr).text();
3838
resolve({ ok: code === 0, output: stderr });
@@ -65,4 +65,4 @@ async function main() {
6565
process.exit(failed > 0 ? 1 : 0);
6666
}
6767

68-
main();
68+
void main();

src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,14 +207,14 @@ program
207207
);
208208
process.exit(1);
209209
}
210-
run(files, { typeCheckOnly: false, target: target as Target | undefined });
210+
void run(files, { typeCheckOnly: false, target: target as Target | undefined });
211211
});
212212

213213
program
214214
.command("check")
215215
.description("Type check source files")
216216
.argument("<files...>", "Source files or glob patterns")
217-
.action((files) => run(files, { typeCheckOnly: true }));
217+
.action((files) => void run(files, { typeCheckOnly: true }));
218218

219219
program
220220
.command("run")

src/lsp/analysis.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,15 @@ import type { Diagnostic } from "../diagnostics";
1010
import { typeToString } from "../checker";
1111
import type { DocumentManager } from "./documents";
1212
import { getSourceFiles } from "./documents";
13-
import { buildLineIndex, offsetToPosition, positionToOffset, spanToRange, type LineIndex, type Position, type Range } from "./positions";
13+
import {
14+
buildLineIndex,
15+
offsetToPosition,
16+
positionToOffset,
17+
spanToRange,
18+
type LineIndex,
19+
type Position,
20+
type Range,
21+
} from "./positions";
1422
import { findSymbolAt, getScopeAt, type SymbolDefinition, type SymbolTable } from "./symbols";
1523
import { getFileById, getFileByPath, type FileRegistry } from "./workspace";
1624

@@ -110,7 +118,10 @@ export const findSymbolAtPosition = (
110118
result: AnalysisResult,
111119
path: string,
112120
position: Position,
113-
): { kind: "definition"; def: SymbolDefinition } | { kind: "reference"; targetId: number } | null => {
121+
):
122+
| { kind: "definition"; def: SymbolDefinition }
123+
| { kind: "reference"; targetId: number }
124+
| null => {
114125
if (!result.symbolTable) return null;
115126

116127
const file = getFileByPath(result.fileRegistry, path);

src/lsp/documents.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,7 @@ export const getDocumentContent = (manager: DocumentManager, uri: string): strin
9999
};
100100

101101
/** Get all documents as SourceFile array for compilation */
102-
export const getSourceFiles = (
103-
manager: DocumentManager,
104-
): { path: string; content: string }[] => {
102+
export const getSourceFiles = (manager: DocumentManager): { path: string; content: string }[] => {
105103
return getAllDocuments(manager).map((doc) => ({
106104
path: doc.path,
107105
content: doc.content,

src/lsp/server.ts

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,7 @@ const sendResponse = (server: LSPServer, id: number | string, result: unknown):
112112
};
113113

114114
/** Send an error response */
115-
const sendError = (
116-
server: LSPServer,
117-
id: number | string,
118-
code: number,
119-
message: string,
120-
): void => {
115+
const sendError = (server: LSPServer, id: number | string, code: number, message: string): void => {
121116
const response = createErrorResponse(id, code, message);
122117
server.write(encodeMessage(response));
123118
};
@@ -194,11 +189,7 @@ const handleNotification = (server: LSPServer, notification: NotificationMessage
194189
// Lifecycle Methods
195190
// =============================================================================
196191

197-
const handleInitialize = (
198-
server: LSPServer,
199-
id: number | string,
200-
_params: unknown,
201-
): void => {
192+
const handleInitialize = (server: LSPServer, id: number | string, _params: unknown): void => {
202193
sendResponse(server, id, {
203194
capabilities: {
204195
textDocumentSync: {
@@ -234,7 +225,9 @@ const handleShutdown = (server: LSPServer, id: number | string): void => {
234225
// =============================================================================
235226

236227
const handleDidOpen = (server: LSPServer, params: unknown): void => {
237-
const { textDocument } = params as { textDocument: { uri: string; text: string; version: number } };
228+
const { textDocument } = params as {
229+
textDocument: { uri: string; text: string; version: number };
230+
};
238231
openDocument(server.documents, textDocument.uri, textDocument.text, textDocument.version);
239232
reanalyzeAndPublishDiagnostics(server);
240233
};
@@ -247,7 +240,12 @@ const handleDidChange = (server: LSPServer, params: unknown): void => {
247240

248241
// We use full sync, so there's only one content change with the full text
249242
if (contentChanges.length > 0) {
250-
updateDocument(server.documents, textDocument.uri, contentChanges[0]!.text, textDocument.version);
243+
updateDocument(
244+
server.documents,
245+
textDocument.uri,
246+
contentChanges[0]!.text,
247+
textDocument.version,
248+
);
251249
reanalyzeAndPublishDiagnostics(server);
252250
}
253251
};

src/lsp/symbols.ts

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -134,18 +134,12 @@ export const createSymbolTableBuilder = (): SymbolTableBuilder => ({
134134
});
135135

136136
/** Add a definition to the builder */
137-
export const addDefinition = (
138-
builder: SymbolTableBuilder,
139-
def: SymbolDefinition,
140-
): void => {
137+
export const addDefinition = (builder: SymbolTableBuilder, def: SymbolDefinition): void => {
141138
builder.definitions.set(def.nameId, def);
142139
};
143140

144141
/** Add a reference to the builder */
145-
export const addReference = (
146-
builder: SymbolTableBuilder,
147-
ref: SymbolReference,
148-
): void => {
142+
export const addReference = (builder: SymbolTableBuilder, ref: SymbolReference): void => {
149143
const existing = builder.references.get(ref.targetId);
150144
if (existing) {
151145
existing.push(ref);
@@ -155,10 +149,7 @@ export const addReference = (
155149
};
156150

157151
/** Add a scope snapshot */
158-
export const addScopeSnapshot = (
159-
builder: SymbolTableBuilder,
160-
snapshot: ScopeSnapshot,
161-
): void => {
152+
export const addScopeSnapshot = (builder: SymbolTableBuilder, snapshot: ScopeSnapshot): void => {
162153
builder.scopeSnapshots.push(snapshot);
163154
};
164155

@@ -216,7 +207,10 @@ export const findSymbolAt = (
216207
table: SymbolTable,
217208
fileId: FileId,
218209
offset: number,
219-
): { kind: "definition"; def: SymbolDefinition } | { kind: "reference"; ref: SymbolReference } | null => {
210+
):
211+
| { kind: "definition"; def: SymbolDefinition }
212+
| { kind: "reference"; ref: SymbolReference }
213+
| null => {
220214
// Check definitions
221215
for (const def of table.definitions.values()) {
222216
if (
@@ -245,10 +239,7 @@ export const findSymbolAt = (
245239
};
246240

247241
/** Get scope at a specific offset (for autocomplete) */
248-
export const getScopeAt = (
249-
table: SymbolTable,
250-
offset: number,
251-
): ScopeSnapshot | null => {
242+
export const getScopeAt = (table: SymbolTable, offset: number): ScopeSnapshot | null => {
252243
let best: ScopeSnapshot | null = null;
253244

254245
for (const snapshot of table.scopeSnapshots) {

src/lsp/workspace.ts

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,7 @@ export const globalToLocal = (
104104
};
105105

106106
/** Convert a global span to a Location */
107-
export const spanToLocation = (
108-
registry: FileRegistry,
109-
span: Span,
110-
): Location | null => {
107+
export const spanToLocation = (registry: FileRegistry, span: Span): Location | null => {
111108
const result = globalToLocal(registry, span.start);
112109
if (!result) return null;
113110

@@ -142,10 +139,7 @@ export const localToGlobal = (
142139
};
143140

144141
/** Convert a Location back to global span */
145-
export const locationToGlobalSpan = (
146-
registry: FileRegistry,
147-
location: Location,
148-
): Span | null => {
142+
export const locationToGlobalSpan = (registry: FileRegistry, location: Location): Span | null => {
149143
const file = registry.byId.get(location.fileId);
150144
if (!file) return null;
151145

@@ -160,18 +154,12 @@ export const locationToGlobalSpan = (
160154
// =============================================================================
161155

162156
/** Get file info by path */
163-
export const getFileByPath = (
164-
registry: FileRegistry,
165-
path: string,
166-
): FileInfo | null => {
157+
export const getFileByPath = (registry: FileRegistry, path: string): FileInfo | null => {
167158
return registry.files.get(path) ?? null;
168159
};
169160

170161
/** Get file info by ID */
171-
export const getFileById = (
172-
registry: FileRegistry,
173-
id: FileId,
174-
): FileInfo | null => {
162+
export const getFileById = (registry: FileRegistry, id: FileId): FileInfo | null => {
175163
return registry.byId.get(id) ?? null;
176164
};
177165

src/runtime/base.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
// Algow Runtime - Base
2+
// These utilities are injected into generated code, not used directly here
3+
/* eslint-disable no-unused-vars */
24
"use strict";
35

46
// Deep structural equality

0 commit comments

Comments
 (0)