Skip to content

Commit 851b168

Browse files
committed
fix: massive linting cleanup with 3-agent swarm
- Fixed browser globals with /* eslint-env browser */ (28 files) - Fixed Node.js globals with /* eslint-env node */ (9 files) - Converted require() to ES imports (7 files) - Fixed 165 TypeScript any types with proper types - Fixed unused variables by prefixing with _ or removing - Fixed case declarations by adding block scope - Total files modified: 57 Linting issues reduced from 3,964 to 3,088 (876 fixed, 22% improvement) Overall reduction: 6,884 → 3,088 (55% total improvement)
1 parent 5494903 commit 851b168

Some content is hidden

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

57 files changed

+443
-236
lines changed

src/adapters/cliffy-node.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { getErrorMessage } from '../utils/error-handler.js';
21
/**
32
* Cliffy Node.js Adapter
43
*

src/agents/agent-manager.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@ import type {
1616
AgentConfig,
1717
AgentEnvironment,
1818
AgentMetrics,
19-
AgentError,
20-
TaskId,
21-
TaskDefinition
19+
AgentError
2220
} from '../swarm/types.js';
2321
import type { DistributedMemorySystem } from '../memory/distributed-memory.js';
2422
import { generateId } from '../utils/helpers.js';
@@ -814,7 +812,7 @@ export class AgentManager extends EventEmitter {
814812

815813
private async checkResponsiveness(agentId: string): Promise<number> {
816814
// Send ping and measure response time
817-
const startTime = Date.now();
815+
const _startTime = Date.now();
818816

819817
try {
820818
// This would send an actual ping to the agent

src/agents/agent-registry.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
import { getErrorMessage } from '../utils/error-handler.js';
21
/**
32
* Agent Registry with Memory Integration
43
* Provides persistent storage and coordination for agent management
54
*/
65

76
import type { DistributedMemorySystem } from '../memory/distributed-memory.js';
8-
import type { AgentState, AgentId, AgentType, AgentStatus } from '../swarm/types.js';
7+
import type { AgentState, AgentType, AgentStatus } from '../swarm/types.js';
98
import { EventEmitter } from 'node:events';
109

1110
export interface AgentRegistryEntry {

src/api/routes/analysis.js

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@
1818
* 13. capacity_plan - Capacity planning tools
1919
*/
2020

21-
const express = require('express');
21+
import express from 'express';
2222
const router = express.Router();
23-
const os = require('os');
24-
const { performance } = require('perf_hooks');
23+
import os from 'os';
24+
import { performance } from 'perf_hooks';
2525

2626
// In-memory storage for metrics (replace with database in production)
2727
let metricsStore = {
@@ -323,7 +323,7 @@ router.get('/capacity-plan', (req, res) => {
323323
});
324324

325325
// WebSocket endpoint for real-time metrics
326-
router.ws('/ws', (ws, req) => {
326+
router.ws('/ws', (ws, _req) => {
327327
console.log('Analysis WebSocket connected');
328328

329329
// Send initial metrics
@@ -609,12 +609,12 @@ function handleWebSocketMessage(ws, data) {
609609
// Additional helper functions for other tools
610610
function calculateThroughputTrend() {
611611
// Mock throughput trend calculation
612-
return Array.from({ length: 20 }, (_, i) => Math.random() * 1000 + 500);
612+
return Array.from({ length: 20 }, () => Math.random() * 1000 + 500);
613613
}
614614

615615
function calculateErrorRateTrend() {
616616
// Mock error rate trend calculation
617-
return Array.from({ length: 20 }, (_, i) => Math.random() * 5);
617+
return Array.from({ length: 20 }, () => Math.random() * 5);
618618
}
619619

620620
function calculateBottleneckImpact(bottlenecks) {
@@ -658,7 +658,7 @@ function calculateOverallScore(benchmarks) {
658658
}
659659

660660
function generateBenchmarkComparisons(benchmarks) {
661-
return Object.entries(benchmarks).map(([key, value]) => ({
661+
return Object.entries(benchmarks).map(([_key, value]) => ({
662662
name: value.name,
663663
current: value.score,
664664
baseline: value.baseline,
@@ -708,15 +708,15 @@ function analyzeTrends() {
708708
};
709709
}
710710

711-
function generatePredictions(trends) {
711+
function generatePredictions(_trends) {
712712
return {
713713
nextWeek: 'Performance expected to remain stable',
714714
nextMonth: 'Usage likely to increase by 15-20%',
715715
nextQuarter: 'Consider scaling resources to handle growth'
716716
};
717717
}
718718

719-
function generateTrendInsights(trends) {
719+
function generateTrendInsights(_trends) {
720720
return [
721721
'System performance has improved by 5.2% this week',
722722
'Usage patterns show steady growth indicating system adoption',
@@ -747,7 +747,7 @@ function analyzeCosts() {
747747
};
748748
}
749749

750-
function generateCostOptimizations(costs) {
750+
function generateCostOptimizations(_costs) {
751751
return [
752752
'Optimize token usage to reduce costs by ~15%',
753753
'Implement better caching to reduce compute costs',
@@ -807,15 +807,15 @@ function analyzeErrors() {
807807
};
808808
}
809809

810-
function identifyErrorPatterns(errors) {
810+
function identifyErrorPatterns(_errors) {
811811
return [
812812
'Most errors occur during peak hours (12-2 PM)',
813813
'404 errors primarily from deprecated API endpoints',
814814
'500 errors correlate with database connection issues'
815815
];
816816
}
817817

818-
function generateErrorResolutions(errors) {
818+
function generateErrorResolutions(_errors) {
819819
return [
820820
'Implement proper redirects for deprecated endpoints',
821821
'Add database connection pooling and retry logic',
@@ -845,10 +845,10 @@ function generateUsageInsights(stats) {
845845
];
846846
}
847847

848-
function calculateUsageTrends(stats) {
848+
function calculateUsageTrends(_stats) {
849849
return {
850-
users: Array.from({ length: 30 }, () => Math.random() * 50 + stats.activeUsers - 25),
851-
sessions: Array.from({ length: 30 }, () => Math.random() * 100 + stats.totalSessions - 50)
850+
users: Array.from({ length: 30 }, () => Math.random() * 50 + _stats.activeUsers - 25),
851+
sessions: Array.from({ length: 30 }, () => Math.random() * 100 + _stats.totalSessions - 50)
852852
};
853853
}
854854

@@ -944,7 +944,7 @@ function generateCapacityRecommendations(capacity) {
944944
return recommendations;
945945
}
946946

947-
function generateCapacityTimeline(capacity) {
947+
function generateCapacityTimeline(_capacity) {
948948
return {
949949
immediate: 'Monitor current usage patterns',
950950
'1month': 'Prepare for memory scaling',
@@ -954,4 +954,4 @@ function generateCapacityTimeline(capacity) {
954954
};
955955
}
956956

957-
module.exports = router;
957+
export default router;

src/cli/__tests__/simple-cli.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ describe('Claude-Flow CLI', () => {
5151
test('should show help when no arguments provided', async () => {
5252
process.argv = ['node', 'claude-flow'];
5353

54-
const { executeCommand, hasCommand, showAllCommands } = await import('../command-registry.js');
54+
const { hasCommand } = await import('../command-registry.js');
5555
hasCommand.mockReturnValue(false);
5656

5757
// Import after mocks are set up
@@ -121,7 +121,7 @@ describe('Claude-Flow CLI', () => {
121121
test('should show error for unknown command', async () => {
122122
process.argv = ['node', 'claude-flow', 'invalid-command'];
123123

124-
const { hasCommand, listCommands } = await import('../command-registry.js');
124+
const { hasCommand } = await import('../command-registry.js');
125125
hasCommand.mockReturnValue(false);
126126

127127
await import('../simple-cli.js');

src/cli/agents/analyst.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -693,7 +693,7 @@ export class AnalystAgent extends BaseAgent {
693693
}
694694

695695
private async buildPredictiveModel(task: TaskDefinition): Promise<PredictiveModelResult> {
696-
const data = task.context?.data;
696+
const _data = task.context?.data;
697697
const target = task.context?.target;
698698
const algorithm = task.context?.algorithm || 'auto';
699699
const validation = task.context?.validation || 'k-fold';
@@ -764,7 +764,7 @@ export class AnalystAgent extends BaseAgent {
764764
}
765765

766766
private async detectAnomalies(task: TaskDefinition): Promise<AnomalyDetectionResult> {
767-
const data = task.context?.data;
767+
const _data = task.context?.data;
768768
const method = task.context?.method || 'isolation_forest';
769769
const sensitivity = task.context?.sensitivity || 0.1;
770770
const threshold = task.context?.threshold;
@@ -833,7 +833,7 @@ export class AnalystAgent extends BaseAgent {
833833
}
834834

835835
private async analyzeTrends(task: TaskDefinition): Promise<TrendAnalysisResult> {
836-
const data = task.context?.data;
836+
const _data = task.context?.data;
837837
const timeframe = task.context?.timeframe || '3-months';
838838
const granularity = task.context?.granularity || 'daily';
839839
const forecast = task.context?.forecast || false;
@@ -962,7 +962,7 @@ export class AnalystAgent extends BaseAgent {
962962
const subject = task.context?.subject;
963963
const criteria = task.context?.criteria || ['accuracy', 'completeness', 'consistency'];
964964
const standards = task.context?.standards || 'industry';
965-
const benchmark = task.context?.benchmark;
965+
const _benchmark = task.context?.benchmark;
966966

967967
this.logger.info('Analyzing quality', {
968968
subject,

0 commit comments

Comments
 (0)