Skip to content

Commit 6438b8e

Browse files
dhaneshclaude
andcommitted
style(lint): apply biome lint autofixes and fix iterable-callback returns
Mechanical cleanup surfaced by enabling Biome lint: node: import protocol, `import type`, removal of unused imports/vars/members, template literals, literal member access, optional chaining, Number.isNaN. Rewrites 9 forEach callbacks that implicitly returned a value as for-of loops, and suppresses one deliberate control-char regex (the ANSI stripper). No behavior change — 722 tests pass. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Piqz8qJ21eRpPrmWwxr6fg
1 parent 3b8d6ba commit 6438b8e

85 files changed

Lines changed: 342 additions & 390 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

cli/__tests__/config.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
*/
77

88
import { describe, test, expect, beforeEach, afterEach } from 'bun:test';
9-
import { existsSync, mkdirSync, writeFileSync, rmSync } from 'fs';
10-
import { join } from 'path';
9+
import { existsSync, mkdirSync, writeFileSync, rmSync } from 'node:fs';
10+
import { join } from 'node:path';
1111
import {
1212
loadConfig,
1313
getTierPatterns,

cli/__tests__/drift.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
*/
77

88
import { describe, test, expect, beforeEach, afterEach } from 'bun:test';
9-
import { existsSync, mkdirSync, writeFileSync, rmSync, readFileSync } from 'fs';
10-
import { join } from 'path';
9+
import { existsSync, mkdirSync, writeFileSync, rmSync, readFileSync } from 'node:fs';
10+
import { join } from 'node:path';
1111
import { computeFileHash, detectDrift } from '../lib/evidence.js';
1212

1313
// ============================================================

cli/__tests__/evidence.test.ts

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,14 @@
77
*/
88

99
import { describe, test, expect, beforeEach, afterEach } from 'bun:test';
10-
import { existsSync, mkdirSync, writeFileSync, rmSync } from 'fs';
11-
import { join } from 'path';
10+
import { existsSync, mkdirSync, writeFileSync, rmSync } from 'node:fs';
11+
import { join } from 'node:path';
1212
import {
1313
computeFileHash,
1414
detectDrift,
1515
parseTestAnnotations,
1616
buildTraceabilityMatrix,
1717
aggregateSatisfactionLevel,
18-
type DriftReport,
19-
type TraceabilityMatrix,
2018
} from '../lib/evidence.js';
2119
import type { Evidence } from '../lib/parser.js';
2220

@@ -321,11 +319,11 @@ test('idempotent retry', () => {});
321319

322320
const matrix = buildTraceabilityMatrix(['traced.test.ts'], TEST_DIR);
323321

324-
expect(matrix['B1']).toHaveLength(2);
325-
expect(matrix['B1'][0].test_function).toBe('no duplicates');
326-
expect(matrix['B1'][1].test_function).toBe('idempotent retry');
327-
expect(matrix['T1']).toHaveLength(1);
328-
expect(matrix['T1'][0].test_function).toBe('idempotent retry');
322+
expect(matrix.B1).toHaveLength(2);
323+
expect(matrix.B1[0].test_function).toBe('no duplicates');
324+
expect(matrix.B1[1].test_function).toBe('idempotent retry');
325+
expect(matrix.T1).toHaveLength(1);
326+
expect(matrix.T1[0].test_function).toBe('idempotent retry');
329327
});
330328

331329
test('handles multiple test files', () => {
@@ -345,9 +343,9 @@ test('test B', () => {});
345343
);
346344

347345
const matrix = buildTraceabilityMatrix(['a.test.ts', 'b.test.ts'], TEST_DIR);
348-
expect(matrix['B1']).toHaveLength(2);
349-
expect(matrix['B1'].map((e) => e.test_file)).toContain('a.test.ts');
350-
expect(matrix['B1'].map((e) => e.test_file)).toContain('b.test.ts');
346+
expect(matrix.B1).toHaveLength(2);
347+
expect(matrix.B1.map((e) => e.test_file)).toContain('a.test.ts');
348+
expect(matrix.B1.map((e) => e.test_file)).toContain('b.test.ts');
351349
});
352350

353351
test('returns empty matrix for files with no annotations', () => {

cli/__tests__/json-md-integration.test.ts

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,11 @@
77
*/
88

99
import { describe, test, expect, beforeEach, afterEach } from 'bun:test';
10-
import { mkdirSync, writeFileSync, rmSync, existsSync } from 'fs';
11-
import { join } from 'path';
10+
import { mkdirSync, writeFileSync, rmSync, existsSync } from 'node:fs';
11+
import { join } from 'node:path';
1212

1313
// Parser functions (status, graph, verify, solve)
14-
import {
15-
loadFeature,
16-
getFeatureFiles,
17-
findManifoldDir,
18-
listFeatures,
19-
type FeatureData,
20-
type FeatureFiles,
21-
} from '../lib/parser.js';
14+
import { loadFeature, getFeatureFiles, findManifoldDir, listFeatures } from '../lib/parser.js';
2215

2316
// Linker functions (validate, show)
2417
import {
@@ -207,7 +200,7 @@ This constraint exists in both JSON and Markdown.
207200
function createTestDir(): string {
208201
const dir = join(
209202
'/tmp',
210-
'manifold-jsonmd-test-' + Date.now() + '-' + Math.random().toString(36).slice(2)
203+
`manifold-jsonmd-test-${Date.now()}-${Math.random().toString(36).slice(2)}`
211204
);
212205
mkdirSync(dir, { recursive: true });
213206
return dir;
@@ -838,7 +831,7 @@ describe('Feature Listing', () => {
838831
});
839832

840833
test('returns empty array for nonexistent directory', () => {
841-
const features = listFeatures('/tmp/manifold-does-not-exist-' + Date.now());
834+
const features = listFeatures(`/tmp/manifold-does-not-exist-${Date.now()}`);
842835
expect(features).toEqual([]);
843836
});
844837

cli/__tests__/manifold-linker.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
*/
55

66
import { describe, test, expect, beforeEach, afterEach } from 'bun:test';
7-
import { mkdirSync, writeFileSync, rmSync, existsSync } from 'fs';
8-
import { join } from 'path';
7+
import { mkdirSync, writeFileSync, rmSync, existsSync } from 'node:fs';
8+
import { join } from 'node:path';
99
import {
1010
validateManifoldLink,
1111
loadAndValidateManifold,
@@ -261,7 +261,7 @@ Description.
261261
});
262262

263263
describe('detectManifoldFormat', () => {
264-
const testDir = '/tmp/manifold-test-' + Date.now();
264+
const testDir = `/tmp/manifold-test-${Date.now()}`;
265265

266266
beforeEach(() => {
267267
mkdirSync(testDir, { recursive: true });
@@ -303,7 +303,7 @@ describe('detectManifoldFormat', () => {
303303
});
304304

305305
describe('loadAndValidateManifold', () => {
306-
const testDir = '/tmp/manifold-load-test-' + Date.now();
306+
const testDir = `/tmp/manifold-load-test-${Date.now()}`;
307307

308308
beforeEach(() => {
309309
mkdirSync(testDir, { recursive: true });
@@ -400,7 +400,7 @@ This is the statement.
400400
});
401401

402402
describe('loadManifoldByFeature', () => {
403-
const testDir = '/tmp/manifold-feature-test-' + Date.now();
403+
const testDir = `/tmp/manifold-feature-test-${Date.now()}`;
404404

405405
beforeEach(() => {
406406
mkdirSync(testDir, { recursive: true });

cli/__tests__/structure-schema.test.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ import {
1414
PhaseSchema,
1515
ConstraintTypeSchema,
1616
TensionTypeSchema,
17-
TensionStatusSchema,
18-
RequiredTruthStatusSchema,
1917
} from '../lib/structure-schema.js';
2018

2119
describe('PhaseSchema', () => {

cli/__tests__/verify-flags.test.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
*/
77

88
import { describe, test, expect, beforeEach, afterEach } from 'bun:test';
9-
import { existsSync, mkdirSync, writeFileSync, rmSync } from 'fs';
10-
import { join } from 'path';
9+
import { existsSync, mkdirSync, writeFileSync, rmSync } from 'node:fs';
10+
import { join } from 'node:path';
1111
import {
1212
aggregateSatisfactionLevel,
1313
verifyAllEvidence,
@@ -90,10 +90,10 @@ describe('--levels flag: satisfaction level computation', () => {
9090
levels[id] = aggregateSatisfactionLevel(evidence);
9191
}
9292

93-
expect(levels['B1']).toBe('VERIFIED');
94-
expect(levels['B2']).toBe('IMPLEMENTED');
95-
expect(levels['T1']).toBe('DOCUMENTED');
96-
expect(levels['S1']).toBe('DOCUMENTED');
93+
expect(levels.B1).toBe('VERIFIED');
94+
expect(levels.B2).toBe('IMPLEMENTED');
95+
expect(levels.T1).toBe('DOCUMENTED');
96+
expect(levels.S1).toBe('DOCUMENTED');
9797
});
9898

9999
test('level counts for bar chart display', () => {
@@ -115,10 +115,10 @@ describe('--levels flag: satisfaction level computation', () => {
115115
counts[level] = (counts[level] || 0) + 1;
116116
}
117117

118-
expect(counts['DOCUMENTED']).toBe(1);
119-
expect(counts['IMPLEMENTED']).toBe(1);
120-
expect(counts['TESTED']).toBe(2);
121-
expect(counts['VERIFIED']).toBe(1);
118+
expect(counts.DOCUMENTED).toBe(1);
119+
expect(counts.IMPLEMENTED).toBe(1);
120+
expect(counts.TESTED).toBe(2);
121+
expect(counts.VERIFIED).toBe(1);
122122
});
123123
});
124124

cli/__tests__/workflow.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -477,27 +477,27 @@ describe('phase transition rules', () => {
477477
};
478478

479479
test('INITIALIZED can only transition to CONSTRAINED', () => {
480-
expect(validTransitions['INITIALIZED']).toEqual(['CONSTRAINED']);
480+
expect(validTransitions.INITIALIZED).toEqual(['CONSTRAINED']);
481481
});
482482

483483
test('CONSTRAINED can only transition to TENSIONED', () => {
484-
expect(validTransitions['CONSTRAINED']).toEqual(['TENSIONED']);
484+
expect(validTransitions.CONSTRAINED).toEqual(['TENSIONED']);
485485
});
486486

487487
test('TENSIONED can only transition to ANCHORED', () => {
488-
expect(validTransitions['TENSIONED']).toEqual(['ANCHORED']);
488+
expect(validTransitions.TENSIONED).toEqual(['ANCHORED']);
489489
});
490490

491491
test('ANCHORED can only transition to GENERATED', () => {
492-
expect(validTransitions['ANCHORED']).toEqual(['GENERATED']);
492+
expect(validTransitions.ANCHORED).toEqual(['GENERATED']);
493493
});
494494

495495
test('GENERATED can only transition to VERIFIED', () => {
496-
expect(validTransitions['GENERATED']).toEqual(['VERIFIED']);
496+
expect(validTransitions.GENERATED).toEqual(['VERIFIED']);
497497
});
498498

499499
test('VERIFIED can transition back to INITIALIZED for iteration', () => {
500-
expect(validTransitions['VERIFIED']).toContain('INITIALIZED');
500+
expect(validTransitions.VERIFIED).toContain('INITIALIZED');
501501
});
502502
});
503503

cli/commands/completion.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Satisfies: U4 (Shell completion support for feature names)
66
*/
77

8-
import { Command } from 'commander';
8+
import type { Command } from 'commander';
99
import { findManifoldDir, listFeatures } from '../lib/parser.js';
1010

1111
// Bash completion script template
@@ -329,7 +329,7 @@ export function registerCompletionCommand(program: Command): void {
329329
const manifoldDir = findManifoldDir();
330330
if (manifoldDir) {
331331
const features = listFeatures(manifoldDir);
332-
features.forEach((f) => console.log(f));
332+
for (const f of features) console.log(f);
333333
}
334334
});
335335
}

cli/commands/doctor.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77

88
import type { Command } from 'commander';
9-
import { dirname } from 'path';
9+
import { dirname } from 'node:path';
1010
import { findManifoldDir } from '../lib/parser.js';
1111
import { runDoctor, type DoctorReport } from '../lib/doctor.js';
1212
import { println, printError, formatHeader, formatKeyValue, style, toJSON } from '../lib/output.js';
@@ -26,7 +26,7 @@ export function registerDoctorCommand(program: Command): void {
2626
'Check repo health: detect invalid manifolds, constraint dependency cycles, plugin-sync drift, stale fingerprints, and file-drift'
2727
)
2828
.option('--json', 'Output as JSON')
29-
.action(async function (this: Command, options: DoctorOptions) {
29+
.action(async function (this: Command, _options: DoctorOptions) {
3030
// Use optsWithGlobals() to capture --json even when defined at parent level
3131
// Satisfies: RT-6 (U3) — --json must work whether passed as local or global flag
3232
const mergedOpts = this.optsWithGlobals() as DoctorOptions;

0 commit comments

Comments
 (0)