Skip to content

Commit c3458fc

Browse files
committed
lint
1 parent 01abb20 commit c3458fc

9 files changed

Lines changed: 24 additions & 59 deletions

File tree

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"eslint.workingDirectories": [ "./backend", "./frontend" ],
3+
}

backend/src/app.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ class App {
9292
await TargetValuesService.initialize();
9393
logger.info('Targets initialized');
9494
} catch (error) {
95-
logger.warn('GitHub App failed to connect', (error as any)?.message || error);
95+
logger.warn('GitHub App failed to connect', error instanceof Error ? error.message : String(error));
9696
}
9797

9898
}

backend/src/controllers/api-docs.controller.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -982,7 +982,7 @@ class ApiDocsController {
982982
}
983983

984984
res.status(200).json(openApiSpec);
985-
} catch (error) {
985+
} catch {
986986
res.status(500).json({ error: "Failed to retrieve API documentation" });
987987
}
988988
}

backend/src/controllers/teams.controller.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ class TeamsController {
3333
async getMemberByLogin(req: Request, res: Response): Promise<void> {
3434
try {
3535
const { login } = req.params;
36-
const exact = req.query.exact === 'true';
3736
const member = await teamsService.getMemberByLogin(login);
3837
if (member) {
3938
res.json(member);

backend/src/services/seats.service.ts

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -27,22 +27,11 @@ type MemberDailyActivity = {
2727
};
2828
};
2929

30-
interface ActivityTotalDocument {
31-
org: string;
32-
date: Date;
33-
assignee: mongoose.Types.ObjectId;
34-
assignee_id: number;
35-
assignee_login: string;
36-
total_active_time_ms?: number;
37-
last_activity_at?: Date;
38-
last_activity_editor?: string;
39-
}
40-
4130
interface MemberDocument {
4231
_id: mongoose.Types.ObjectId;
4332
id: number;
4433
login: string;
45-
[key: string]: any; // For other properties
34+
// [key: string]: any; // For other properties
4635
}
4736

4837
class SeatsService {
@@ -129,7 +118,7 @@ class SeatsService {
129118
}
130119

131120
// Build query with date range filtering if provided
132-
const query: mongoose.FilterQuery<any> = {
121+
const query: mongoose.FilterQuery<SeatType> = {
133122
assignee: member._id
134123
};
135124

@@ -184,7 +173,7 @@ class SeatsService {
184173

185174
if (!member) {
186175
// Try case-insensitive search as a fallback
187-
const regex = new RegExp(`^${identifierString.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&')}$`, 'i');
176+
const regex = new RegExp(`^${identifierString.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&')}$`, 'i');
188177
const memberCaseInsensitive = await Member.findOne({
189178
login: regex
190179
}).lean() as MemberDocument | null;
@@ -203,22 +192,17 @@ class SeatsService {
203192
// Now TypeScript knows member has these properties
204193
numericId = member.id;
205194
}
206-
} catch (memberLookupError: unknown) {
207-
// Properly type the error
195+
} catch {
208196
return []; // Return empty array on error
209197
}
210198
} else {
211199
numericId = Number(identifier);
212-
//console.log(`Using numeric ID directly: ${numericId}`);
213200
}
214201

215-
// Build query
216-
const query: Record<string, any> = { assignee_id: numericId };
202+
const query: mongoose.FilterQuery<SeatType> = { assignee_id: numericId };
217203

218-
// Add filters
219204
if (params.org) {
220205
query.org = params.org;
221-
// console.log(`Added org filter: ${params.org}`);
222206
}
223207

224208
if (params.since || params.until) {

backend/src/services/smee.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import logger from "./logger.js";
22
import Client from "smee-client";
3-
import { EventSource } from "eventsource";
3+
import { ErrorEvent, EventSource } from "eventsource";
44

55
export interface WebhookServiceOptions {
66
url?: string,
@@ -61,7 +61,7 @@ class WebhookService {
6161
});
6262
this.eventSource = await this.smee.start();
6363
// also catch any lower‑level EventSource errors
64-
this.eventSource.addEventListener('error', (err: any) => {
64+
this.eventSource.addEventListener('error', (err: ErrorEvent) => {
6565
const m = err?.message || err;
6666
if (typeof m === 'string' && m.includes('ECONNRESET')) {
6767
logger.warn('Smee EventSource', 'read ECONNRESET, reconnecting');

backend/src/services/survey.service.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -69,18 +69,18 @@ class SurveyService {
6969
/**
7070
* Get all surveys based on filtering criteria
7171
*/
72-
async getAllSurveys(params: {
73-
org?: string;
74-
team?: string;
75-
reasonLength?: string;
76-
since?: string;
77-
until?: string;
78-
status?: string;
79-
userId?: string;
80-
}) {
72+
async getAllSurveys(params: {
73+
org?: string;
74+
team?: string;
75+
reasonLength?: string;
76+
since?: string;
77+
until?: string;
78+
status?: string;
79+
userId?: string;
80+
}) {
8181
const { org, team, reasonLength, since, until, status, userId } = params;
8282

83-
const dateFilter: mongoose.FilterQuery<any> = {};
83+
const dateFilter: mongoose.FilterQuery<SurveyType> = {};
8484

8585
// Validate the date strings before creating Date objects
8686
if (since) {

backend/src/services/target-calculation-service.ts

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import settingsService, { SettingsType } from './settings.service.js';
1+
import { SettingsType } from './settings.service.js';
22
import adoptionService, { AdoptionType } from './adoption.service.js';
33
import metricsService from './metrics.service.js';
44
import { MetricDailyResponseType } from "../models/metrics.model.js";
@@ -48,25 +48,6 @@ interface Targets {
4848
[key: string]: Record<string, Target>;
4949
}
5050

51-
// More specific typed interfaces for metrics data
52-
interface MetricsData {
53-
copilot_ide_code_completions?: {
54-
total_code_suggestions: number;
55-
total_engaged_users: number; // NEW
56-
};
57-
copilot_ide_chat?: {
58-
total_chats: number;
59-
};
60-
copilot_dotcom_chat?: { // NEW
61-
total_chats: number;
62-
};
63-
copilot_dotcom_pull_requests?: {
64-
total_pr_summaries_created: number;
65-
};
66-
total_active_users: number;
67-
total_engaged_users?: number; // NEW (top-level, used in debug log)
68-
}
69-
7051
export class TargetCalculationService {
7152
// Class variables to store fetched data
7253
settings!: SettingsType;
@@ -841,7 +822,6 @@ RESULT:
841822
calculateProductivityOrThroughputBoostPercent(): Target {
842823
const adoptedDevs = this.calculateAdoptedDevs().current;
843824
const weeklyTimeSavedHrs = this.calculateWeeklyTimeSavedHrs().current;
844-
const monthlyTimeSavings = adoptedDevs * weeklyTimeSavedHrs * 4; // Assuming 4 weeks per month
845825

846826
// Convert hours per year to number
847827
const hoursPerYear = typeof this.settings.hoursPerYear === 'number' ? this.settings.hoursPerYear : 2000;

backend/src/services/target.service.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import mongoose from 'mongoose';
2-
import adoptionService, { AdoptionType } from './adoption.service.js';
3-
import app from '../index.js';
2+
import { AdoptionType } from './adoption.service.js'
43
import { SettingsType } from './settings.service.js';
54
import { TargetCalculationService } from './target-calculation-service.js';
65

0 commit comments

Comments
 (0)