Skip to content

Commit e6a991c

Browse files
committed
Fix critical issues: Jest config, module resolution, and unused variables 🔧
1 parent 9b2240a commit e6a991c

16 files changed

+177
-173
lines changed

jest.config.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,21 @@ module.exports = {
2626
}
2727
},
2828
moduleNameMapper: {
29-
'^@/(.*)$': '<rootDir>/src/$1'
29+
'^@/(.*)$': '<rootDir>/src/$1',
30+
'^(\.{1,2}/.*)\.js$': '$1'
3031
},
3132
transform: {
32-
'^.+\\.ts$': ['ts-jest', {
33+
'^.+\.ts$': ['ts-jest', {
3334
tsconfig: {
3435
esModuleInterop: true,
35-
allowSyntheticDefaultImports: true
36+
allowSyntheticDefaultImports: true,
37+
moduleResolution: 'node'
3638
}
3739
}]
3840
},
3941
setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
4042
testTimeout: 10000,
41-
verbose: true
43+
verbose: true,
44+
extensionsToTreatAsEsm: ['.ts'],
45+
testPathIgnorePatterns: ['/node_modules/', '/dist/']
4246
};

package-lock.json

Lines changed: 18 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"version": "1.0.0",
44
"description": "🚀 Gamify your development experience - Track coding progress, earn achievements, and level up!",
55
"main": "dist/index.js",
6-
"type": "module",
6+
"type": "commonjs",
77
"bin": {
88
"devxp": "./dist/index.js"
99
},
@@ -100,9 +100,11 @@
100100
"figlet": "^1.8.2",
101101
"gradient-string": "^3.0.0",
102102
"ora": "^8.2.0",
103+
"sqlite": "^5.1.1",
103104
"sqlite3": "^5.1.7",
104105
"terminal-kit": "^3.1.2",
105106
"tinyexec": "^1.0.1",
106-
"tslib": "^2.8.1"
107+
"tslib": "^2.8.1",
108+
"zod": "^4.0.15"
107109
}
108110
}

src/commands/config.command.ts

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -43,25 +43,25 @@ Examples:
4343
const value = valueParts.join(' ');
4444

4545
switch (action) {
46-
case 'get':
47-
await this.get(key);
48-
break;
49-
case 'set':
50-
await this.set(key, value);
51-
break;
52-
case 'list':
53-
await this.list();
54-
break;
55-
case 'reset':
56-
await this.reset();
57-
break;
58-
case 'path':
59-
console.log(chalk.green(`Config file path: ${configFile}`));
60-
break;
61-
default:
62-
console.error(chalk.red(`Unknown action: ${action}`));
63-
console.log(this.help);
64-
break;
46+
case 'get':
47+
await this.get(key);
48+
break;
49+
case 'set':
50+
await this.set(key, value);
51+
break;
52+
case 'list':
53+
await this.list();
54+
break;
55+
case 'reset':
56+
await this.reset();
57+
break;
58+
case 'path':
59+
console.log(chalk.green(`Config file path: ${configFile}`));
60+
break;
61+
default:
62+
console.error(chalk.red(`Unknown action: ${action}`));
63+
console.log(this.help);
64+
break;
6565
}
6666
}
6767

src/commands/install.command.ts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* Install command - Set up git hooks and shell integration
33
*/
4-
import type { Command } from '../types/command.js';
4+
import type { Command } from '../types/command';
55
import { promises as fs } from 'fs';
66
import path from 'path';
77
import os from 'os';
@@ -138,20 +138,20 @@ fi
138138
if (args.includes('--fish')) shell = 'fish';
139139

140140
switch (shell) {
141-
case 'zsh':
142-
await this.installZshIntegration();
143-
spinner.succeed('Zsh integration installed');
144-
break;
145-
case 'bash':
146-
await this.installBashIntegration();
147-
spinner.succeed('Bash integration installed');
148-
break;
149-
case 'fish':
150-
await this.installFishIntegration();
151-
spinner.succeed('Fish integration installed');
152-
break;
153-
default:
154-
spinner.warn(`Unknown shell: ${shell}. Please install manually.`);
141+
case 'zsh':
142+
await this.installZshIntegration();
143+
spinner.succeed('Zsh integration installed');
144+
break;
145+
case 'bash':
146+
await this.installBashIntegration();
147+
spinner.succeed('Bash integration installed');
148+
break;
149+
case 'fish':
150+
await this.installFishIntegration();
151+
spinner.succeed('Fish integration installed');
152+
break;
153+
default:
154+
spinner.warn(`Unknown shell: ${shell}. Please install manually.`);
155155
}
156156
} catch (error) {
157157
spinner.fail('Failed to install shell integration');
@@ -306,7 +306,7 @@ end
306306
}
307307
}
308308

309-
validate(args: ReadonlyArray<string>): boolean {
309+
validate(_args: ReadonlyArray<string>): boolean {
310310
// All arguments are optional
311311
return true;
312312
}

src/commands/leaderboard.command.ts

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -155,14 +155,14 @@ Options:
155155

156156
private getRankDisplay(rank: number): string {
157157
switch (rank) {
158-
case 1:
159-
return chalk.yellow('🥇 1st');
160-
case 2:
161-
return chalk.gray('🥈 2nd');
162-
case 3:
163-
return chalk.rgb(205, 127, 50)('🥉 3rd');
164-
default:
165-
return chalk.white(`#${rank}`);
158+
case 1:
159+
return chalk.yellow('🥇 1st');
160+
case 2:
161+
return chalk.gray('🥈 2nd');
162+
case 3:
163+
return chalk.rgb(205, 127, 50)('🥉 3rd');
164+
default:
165+
return chalk.white(`#${rank}`);
166166
}
167167
}
168168

@@ -209,15 +209,15 @@ Options:
209209

210210
private formatPeriod(period: string): string {
211211
switch (period) {
212-
case 'weekly':
213-
return 'This Week';
214-
case 'monthly':
215-
return 'This Month';
216-
case 'all':
217-
case 'global':
218-
return 'All Time';
219-
default:
220-
return period;
212+
case 'weekly':
213+
return 'This Week';
214+
case 'monthly':
215+
return 'This Month';
216+
case 'all':
217+
case 'global':
218+
return 'All Time';
219+
default:
220+
return period;
221221
}
222222
}
223223

src/commands/shell-integration.ts

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ shellIntegrationCommand
121121
if (isInstalled) {
122122
console.log(chalk.green('✅ Installed'));
123123
console.log(chalk.white(`📁 Config directory: ${process.env['HOME']}/.config/devxp/`));
124-
console.log(chalk.white(`📄 Integration file: shell-integration.zsh`));
124+
console.log(chalk.white('📄 Integration file: shell-integration.zsh'));
125125

126126
// Test if it works
127127
const testResult = await shellIntegration.test();
@@ -238,34 +238,34 @@ shellIntegrationCommand
238238
.action(async (mode) => {
239239
try {
240240
switch (mode?.toLowerCase()) {
241-
case 'on':
242-
shellIntegration.enablePrivacyMode();
243-
console.log(chalk.green('🔒 Privacy mode enabled'));
244-
console.log(chalk.yellow('Commands will not be tracked while privacy mode is active'));
245-
break;
241+
case 'on':
242+
shellIntegration.enablePrivacyMode();
243+
console.log(chalk.green('🔒 Privacy mode enabled'));
244+
console.log(chalk.yellow('Commands will not be tracked while privacy mode is active'));
245+
break;
246246

247-
case 'off':
248-
shellIntegration.disablePrivacyMode();
249-
console.log(chalk.green('🔓 Privacy mode disabled'));
250-
console.log(chalk.cyan('Command tracking resumed'));
251-
break;
247+
case 'off':
248+
shellIntegration.disablePrivacyMode();
249+
console.log(chalk.green('🔓 Privacy mode disabled'));
250+
console.log(chalk.cyan('Command tracking resumed'));
251+
break;
252252

253-
case 'status':
254-
case undefined:
255-
const isPrivacy = shellIntegration.isPrivacyMode();
256-
if (isPrivacy) {
257-
console.log(chalk.yellow('🔒 Privacy mode is ON'));
258-
console.log(chalk.gray('Commands are not being tracked'));
259-
} else {
260-
console.log(chalk.green('🔓 Privacy mode is OFF'));
261-
console.log(chalk.gray('Commands are being tracked normally'));
262-
}
263-
break;
253+
case 'status':
254+
case undefined:
255+
const isPrivacy = shellIntegration.isPrivacyMode();
256+
if (isPrivacy) {
257+
console.log(chalk.yellow('🔒 Privacy mode is ON'));
258+
console.log(chalk.gray('Commands are not being tracked'));
259+
} else {
260+
console.log(chalk.green('🔓 Privacy mode is OFF'));
261+
console.log(chalk.gray('Commands are being tracked normally'));
262+
}
263+
break;
264264

265-
default:
266-
console.error(chalk.red(`Invalid mode: ${mode}`));
267-
console.log(chalk.cyan('Use: on, off, or status'));
268-
process.exit(1);
265+
default:
266+
console.error(chalk.red(`Invalid mode: ${mode}`));
267+
console.log(chalk.cyan('Use: on, off, or status'));
268+
process.exit(1);
269269
}
270270

271271
} catch (error) {

src/commands/stats.command.ts

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/**
22
* Stats command - Display detailed statistics and charts
33
*/
4-
import type { Command } from '../types/command.js';
5-
import { database } from '../modules/database.js';
4+
import type { Command } from '../types/command';
5+
import { database } from '../modules/database';
66
import chalk from 'chalk';
77
import ora from 'ora';
88

@@ -85,21 +85,21 @@ Options:
8585
private async getActivitiesForPeriod(userId: string, period: string): Promise<any[]> {
8686
let limit = 100;
8787
switch (period) {
88-
case 'day':
89-
limit = 50;
90-
break;
91-
case 'week':
92-
limit = 200;
93-
break;
94-
case 'month':
95-
limit = 500;
96-
break;
97-
case 'year':
98-
limit = 2000;
99-
break;
100-
case 'all':
101-
limit = undefined;
102-
break;
88+
case 'day':
89+
limit = 50;
90+
break;
91+
case 'week':
92+
limit = 200;
93+
break;
94+
case 'month':
95+
limit = 500;
96+
break;
97+
case 'year':
98+
limit = 2000;
99+
break;
100+
case 'all':
101+
limit = undefined;
102+
break;
103103
}
104104
return database.getUserActivities(userId, limit);
105105
}
@@ -234,7 +234,7 @@ Options:
234234
return chalk.green('█'.repeat(filled)) + chalk.gray('░'.repeat(empty));
235235
}
236236

237-
private calculateMilestones(user: any, activities: any[], xpHistory: any[]): string[] {
237+
private calculateMilestones(user: any, activities: any[], _xpHistory: any[]): string[] {
238238
const milestones: string[] = [];
239239

240240
// Check for level milestones

src/commands/status.command.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
/**
22
* Status command - Show current level, XP, and recent activity
33
*/
4-
import type { Command } from '../types/command.js';
5-
import { database } from '../modules/database.js';
6-
import { xpSystem } from '../modules/xp-system.js';
7-
import { achievementManager } from '../modules/achievements.js';
4+
import type { Command } from '../types/command';
5+
import { database } from '../modules/database';
6+
import { xpSystem } from '../modules/xp-system';
7+
import { achievementManager } from '../modules/achievements';
88
import chalk from 'chalk';
99
import ora from 'ora';
1010

@@ -196,7 +196,7 @@ Options:
196196
}
197197
}
198198

199-
validate(args: ReadonlyArray<string>): boolean {
199+
validate(_args: ReadonlyArray<string>): boolean {
200200
// All arguments are optional, so always valid
201201
return true;
202202
}

0 commit comments

Comments
 (0)