Skip to content

Commit 4ed709e

Browse files
committed
fix(lint): apply biome auto-fixes across extractors and domain files
useOptionalChain rewrites and formatting fixes flagged by Biome in CI.
1 parent cdc84cf commit 4ed709e

31 files changed

Lines changed: 83 additions & 78 deletions

src/domain/graph/journal.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ interface JournalResult {
235235
}
236236

237237
function parseJournalHeader(firstLine: string | undefined): number | null {
238-
if (!firstLine || !firstLine.startsWith(HEADER_PREFIX)) {
238+
if (!firstLine?.startsWith(HEADER_PREFIX)) {
239239
debug('Journal has malformed or missing header');
240240
return null;
241241
}

src/domain/wasm-worker-entry.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -815,7 +815,9 @@ function serializeExtractorOutput(
815815
...(symbols.objectRestParamBindings?.length
816816
? { objectRestParamBindings: symbols.objectRestParamBindings }
817817
: {}),
818-
...(symbols.objectPropBindings?.length ? { objectPropBindings: symbols.objectPropBindings } : {}),
818+
...(symbols.objectPropBindings?.length
819+
? { objectPropBindings: symbols.objectPropBindings }
820+
: {}),
819821
...(symbols.newExpressions?.length ? { newExpressions: symbols.newExpressions } : {}),
820822
};
821823
}

src/domain/wasm-worker-pool.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,8 @@ function deserializeResult(ser: SerializedExtractorOutput | null): ExtractorOutp
112112
if (ser.spreadArgBindings?.length) out.spreadArgBindings = ser.spreadArgBindings;
113113
if (ser.forOfBindings?.length) out.forOfBindings = ser.forOfBindings;
114114
if (ser.arrayCallbackBindings?.length) out.arrayCallbackBindings = ser.arrayCallbackBindings;
115-
if (ser.objectRestParamBindings?.length) out.objectRestParamBindings = ser.objectRestParamBindings;
115+
if (ser.objectRestParamBindings?.length)
116+
out.objectRestParamBindings = ser.objectRestParamBindings;
116117
if (ser.objectPropBindings?.length) out.objectPropBindings = ser.objectPropBindings;
117118
if (ser.newExpressions?.length) out.newExpressions = ser.newExpressions;
118119
return out;

src/extractors/c.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ function extractCParameters(paramListNode: TreeSitterNode | null): SubDeclaratio
189189
if (!paramListNode) return params;
190190
for (let i = 0; i < paramListNode.childCount; i++) {
191191
const param = paramListNode.child(i);
192-
if (!param || param.type !== 'parameter_declaration') continue;
192+
if (param?.type !== 'parameter_declaration') continue;
193193
const nameNode = param.childForFieldName('declarator');
194194
if (nameNode) {
195195
const name = unwrapCDeclaratorName(nameNode);
@@ -205,7 +205,7 @@ function extractStructFields(structNode: TreeSitterNode): SubDeclaration[] {
205205
if (!body) return fields;
206206
for (let i = 0; i < body.childCount; i++) {
207207
const member = body.child(i);
208-
if (!member || member.type !== 'field_declaration') continue;
208+
if (member?.type !== 'field_declaration') continue;
209209
const nameNode = member.childForFieldName('declarator');
210210
if (nameNode) {
211211
const name = unwrapCDeclaratorName(nameNode);
@@ -221,7 +221,7 @@ function extractEnumEntries(enumNode: TreeSitterNode): SubDeclaration[] {
221221
if (!body) return entries;
222222
for (let i = 0; i < body.childCount; i++) {
223223
const member = body.child(i);
224-
if (!member || member.type !== 'enumerator') continue;
224+
if (member?.type !== 'enumerator') continue;
225225
const nameNode = member.childForFieldName('name');
226226
if (nameNode) {
227227
entries.push({ name: nameNode.text, kind: 'constant', line: member.startPosition.row + 1 });

src/extractors/clojure.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ function extractClojureParams(defnNode: TreeSitterNode): SubDeclaration[] {
224224
// Find the parameter vector [x y z]
225225
for (let i = 0; i < defnNode.childCount; i++) {
226226
const child = defnNode.child(i);
227-
if (!child || child.type !== 'vec_lit') continue;
227+
if (child?.type !== 'vec_lit') continue;
228228
for (let j = 0; j < child.childCount; j++) {
229229
const param = child.child(j);
230230
if (!param) continue;

src/extractors/cpp.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ function extractCppParameters(paramListNode: TreeSitterNode | null): SubDeclarat
292292
if (!paramListNode) return params;
293293
for (let i = 0; i < paramListNode.childCount; i++) {
294294
const param = paramListNode.child(i);
295-
if (!param || param.type !== 'parameter_declaration') continue;
295+
if (param?.type !== 'parameter_declaration') continue;
296296
const nameNode = param.childForFieldName('declarator');
297297
if (nameNode) {
298298
const name = unwrapCppDeclaratorName(nameNode);
@@ -309,7 +309,7 @@ function extractCppClassFields(classNode: TreeSitterNode): SubDeclaration[] {
309309
if (!body) return fields;
310310
for (let i = 0; i < body.childCount; i++) {
311311
const member = body.child(i);
312-
if (!member || member.type !== 'field_declaration') continue;
312+
if (member?.type !== 'field_declaration') continue;
313313
const nameNode = member.childForFieldName('declarator');
314314
if (nameNode) {
315315
const name = unwrapCppDeclaratorName(nameNode);
@@ -330,7 +330,7 @@ function extractCppEnumEntries(enumNode: TreeSitterNode): SubDeclaration[] {
330330
if (!body) return entries;
331331
for (let i = 0; i < body.childCount; i++) {
332332
const member = body.child(i);
333-
if (!member || member.type !== 'enumerator') continue;
333+
if (member?.type !== 'enumerator') continue;
334334
const nameNode = member.childForFieldName('name');
335335
if (nameNode) {
336336
entries.push({ name: nameNode.text, kind: 'constant', line: member.startPosition.row + 1 });

src/extractors/cuda.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ function extractCudaParameters(paramListNode: TreeSitterNode | null): SubDeclara
262262
if (!paramListNode) return params;
263263
for (let i = 0; i < paramListNode.childCount; i++) {
264264
const param = paramListNode.child(i);
265-
if (!param || param.type !== 'parameter_declaration') continue;
265+
if (param?.type !== 'parameter_declaration') continue;
266266
const nameNode = param.childForFieldName('declarator');
267267
if (nameNode) {
268268
// Reuse the field-name drill helper so function-type parameters like
@@ -282,7 +282,7 @@ function extractCudaClassFields(classNode: TreeSitterNode): SubDeclaration[] {
282282
if (!body) return fields;
283283
for (let i = 0; i < body.childCount; i++) {
284284
const member = body.child(i);
285-
if (!member || member.type !== 'field_declaration') continue;
285+
if (member?.type !== 'field_declaration') continue;
286286
const nameNode = member.childForFieldName('declarator');
287287
if (!nameNode) continue;
288288
// Skip method declarations — a `field_declaration` whose declarator
@@ -380,7 +380,7 @@ function extractCudaEnumEntries(enumNode: TreeSitterNode): SubDeclaration[] {
380380
if (!body) return entries;
381381
for (let i = 0; i < body.childCount; i++) {
382382
const member = body.child(i);
383-
if (!member || member.type !== 'enumerator') continue;
383+
if (member?.type !== 'enumerator') continue;
384384
const nameNode = member.childForFieldName('name');
385385
if (nameNode) {
386386
entries.push({ name: nameNode.text, kind: 'constant', line: member.startPosition.row + 1 });

src/extractors/elixir.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,9 @@ function collectModuleMembers(
122122
): void {
123123
for (let i = 0; i < doBlock.childCount; i++) {
124124
const child = doBlock.child(i);
125-
if (!child || child.type !== 'call') continue;
125+
if (child?.type !== 'call') continue;
126126
const target = child.childForFieldName('target');
127-
if (!target || target.type !== 'identifier') continue;
127+
if (target?.type !== 'identifier') continue;
128128

129129
if (target.text === 'def' || target.text === 'defp') {
130130
const fnName = extractFunctionName(child);
@@ -184,7 +184,7 @@ function extractElixirParams(defCallNode: TreeSitterNode): SubDeclaration[] {
184184

185185
for (let i = 0; i < args.childCount; i++) {
186186
const child = args.child(i);
187-
if (!child || child.type !== 'call') continue;
187+
if (child?.type !== 'call') continue;
188188
const innerArgs = findChild(child, 'arguments');
189189
if (!innerArgs) continue;
190190
for (let j = 0; j < innerArgs.childCount; j++) {
@@ -277,13 +277,13 @@ function pushElixirMapValues(node: TreeSitterNode, stack: TreeSitterNode[]): voi
277277
const parts: TreeSitterNode[] = [];
278278
for (let i = 0; i < node.childCount; i++) {
279279
const content = node.child(i);
280-
if (!content || content.type !== 'map_content') continue;
280+
if (content?.type !== 'map_content') continue;
281281
for (let j = 0; j < content.childCount; j++) {
282282
const kws = content.child(j);
283-
if (!kws || kws.type !== 'keywords') continue;
283+
if (kws?.type !== 'keywords') continue;
284284
for (let k = 0; k < kws.childCount; k++) {
285285
const pair = kws.child(k);
286-
if (!pair || pair.type !== 'pair') continue;
286+
if (pair?.type !== 'pair') continue;
287287
for (let p = 0; p < pair.childCount; p++) {
288288
const part = pair.child(p);
289289
if (!part || part.type === 'keyword') continue;

src/extractors/fsharp.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ function handleValueDefinition(
303303
currentModule: string | null,
304304
): void {
305305
const first = node.child(0);
306-
if (!first || first.type !== 'val') return;
306+
if (first?.type !== 'val') return;
307307

308308
const declLeft = findChild(node, 'value_declaration_left');
309309
if (!declLeft) return;

src/extractors/go.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ function extractGoReceiverType(receiver: TreeSitterNode): string | null {
111111
function handleGoTypeDecl(node: TreeSitterNode, ctx: ExtractorOutput): void {
112112
for (let i = 0; i < node.childCount; i++) {
113113
const spec = node.child(i);
114-
if (!spec || spec.type !== 'type_spec') continue;
114+
if (spec?.type !== 'type_spec') continue;
115115
const nameNode = spec.childForFieldName('name');
116116
const typeNode = spec.childForFieldName('type');
117117
if (!nameNode || !typeNode) continue;
@@ -213,7 +213,7 @@ function extractGoImportSpec(spec: TreeSitterNode, ctx: ExtractorOutput): void {
213213
function handleGoConstDecl(node: TreeSitterNode, ctx: ExtractorOutput): void {
214214
for (let i = 0; i < node.childCount; i++) {
215215
const spec = node.child(i);
216-
if (!spec || spec.type !== 'const_spec') continue;
216+
if (spec?.type !== 'const_spec') continue;
217217
const constName = spec.childForFieldName('name');
218218
if (constName) {
219219
ctx.definitions.push({
@@ -288,7 +288,7 @@ function inferAddressOfComposite(
288288
): boolean {
289289
if (rhs.type !== 'unary_expression') return false;
290290
const operand = rhs.childForFieldName('operand');
291-
if (!operand || operand.type !== 'composite_literal') return false;
291+
if (operand?.type !== 'composite_literal') return false;
292292
const typeNode = operand.childForFieldName('type');
293293
if (!typeNode) return false;
294294
const typeName = extractGoTypeName(typeNode);
@@ -409,7 +409,7 @@ function extractGoParameters(paramListNode: TreeSitterNode | null): SubDeclarati
409409
if (!paramListNode) return params;
410410
for (let i = 0; i < paramListNode.childCount; i++) {
411411
const param = paramListNode.child(i);
412-
if (!param || param.type !== 'parameter_declaration') continue;
412+
if (param?.type !== 'parameter_declaration') continue;
413413
// A parameter_declaration may have multiple identifiers (e.g., `a, b int`)
414414
for (let j = 0; j < param.childCount; j++) {
415415
const child = param.child(j);
@@ -494,7 +494,7 @@ function extractStructFields(structTypeNode: TreeSitterNode): SubDeclaration[] {
494494
if (!fieldList) return fields;
495495
for (let i = 0; i < fieldList.childCount; i++) {
496496
const field = fieldList.child(i);
497-
if (!field || field.type !== 'field_declaration') continue;
497+
if (field?.type !== 'field_declaration') continue;
498498
const nameNode = field.childForFieldName('name');
499499
if (nameNode) {
500500
fields.push({ name: nameNode.text, kind: 'property', line: field.startPosition.row + 1 });

0 commit comments

Comments
 (0)