Skip to content

Commit 8420fa0

Browse files
author
Ubuntu
committed
fix(lint): resolve CI linting errors and configure husky hooks
- Remove unused imports from server.ts (DebugSessionCreationError, FileValidationError, getErrorMessage) - Replace any[] with unknown[] in debug-errors.ts type guard for better type safety - Remove unnecessary eslint-disable directives from adapter-loader.ts - Use proper typed constructor instead of any in dependencies.ts for adapter factory instantiation - Configure husky git hooks to catch linting errors before commit - Update package.json prepare script to initialize husky These changes ensure CI passes and prevent future linting issues from being committed.
1 parent e35742e commit 8420fa0

6 files changed

Lines changed: 17 additions & 20 deletions

File tree

‎.husky/pre-commit‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/usr/bin/env sh
2-
. "$(dirname -- "$0")/_/husky.sh"
32

43
# Run linting check
54
echo "🔍 Running ESLint checks before commit..."
@@ -26,4 +25,4 @@ else
2625
echo ""
2726
echo "❌ Pre-commit checks failed. Please address the issues."
2827
exit 1
29-
fi
28+
fi

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
]
1919
},
2020
"scripts": {
21-
"prepare": "npm run build",
21+
"prepare": "husky",
2222
"prebuild": "rimraf dist",
2323
"build": "npm run build:packages && tsc -p tsconfig.json && tsc src/index.ts src/server.ts --outDir dist --module NodeNext --moduleResolution NodeNext --esModuleInterop true --target ES2022 && tsc src/proxy/dap-proxy-entry.ts src/proxy/dap-proxy-worker.ts src/proxy/dap-proxy-core.ts src/proxy/dap-proxy-dependencies.ts src/proxy/dap-proxy-interfaces.ts src/proxy/dap-proxy-adapter-manager.ts src/proxy/dap-proxy-connection-manager.ts src/proxy/dap-proxy-message-parser.ts src/proxy/dap-proxy-request-tracker.ts src/proxy/dap-proxy.ts src/proxy/minimal-dap.ts src/proxy/index.ts src/proxy/proxy-config.ts src/proxy/proxy-manager.ts --outDir dist --module NodeNext --moduleResolution NodeNext --esModuleInterop true --target ES2022 && npm run postbuild",
2424
"build:shared": "npm run build -w @debugmcp/shared --if-present",

‎src/adapters/adapter-loader.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ export class AdapterLoader {
7171
try {
7272
const req = createRequire(import.meta.url);
7373
const fsPath = fileURLToPath(url);
74-
// eslint-disable-next-line @typescript-eslint/no-var-requires
7574
loadedModule = req(fsPath) as Record<string, unknown>;
7675
this.logger.debug?.(`[AdapterLoader] Loaded via createRequire from ${fsPath}`);
7776
loaded = true;

‎src/container/dependencies.ts‎

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,18 @@
44
*/
55
import { ContainerConfig } from './types.js';
66
import { createLogger } from '../utils/logger.js';
7-
import {
8-
IFileSystem,
9-
IProcessManager,
10-
INetworkManager,
7+
import {
8+
IFileSystem,
9+
IProcessManager,
10+
INetworkManager,
1111
ILogger,
12-
IEnvironment
12+
IEnvironment,
13+
IAdapterFactory
1314
} from '@debugmcp/shared';
14-
import {
15-
IProcessLauncher,
16-
IDebugTargetLauncher,
17-
IProxyProcessLauncher
15+
import {
16+
IProcessLauncher,
17+
IDebugTargetLauncher,
18+
IProxyProcessLauncher
1819
} from '@debugmcp/shared';
1920
import {
2021
FileSystemImpl,
@@ -110,8 +111,9 @@ export function createProductionDependencies(config: ContainerConfig = {}): Depe
110111
).then((mod: Record<string, unknown>) => {
111112
const Factory = mod[factoryName] as unknown;
112113
if (typeof Factory === 'function') {
113-
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-floating-promises
114-
adapterRegistry.register(lang, new (Factory as unknown as new () => any)());
114+
// We need a constructor type that returns IAdapterFactory
115+
type AdapterFactoryConstructor = new () => IAdapterFactory;
116+
adapterRegistry.register(lang, new (Factory as AdapterFactoryConstructor)());
115117
}
116118
}).catch(() => {
117119
// Optional in container; ignore failures

‎src/errors/debug-errors.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ export class PortAllocationError extends McpError {
176176
*/
177177
export function isMcpError<T extends McpError>(
178178
error: unknown,
179-
errorClass: new (...args: any[]) => T
179+
errorClass: new (...args: unknown[]) => T
180180
): error is T {
181181
return error instanceof errorClass;
182182
}

‎src/server.ts‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,7 @@ import {
1515
SessionNotFoundError,
1616
SessionTerminatedError,
1717
UnsupportedLanguageError,
18-
ProxyNotRunningError,
19-
DebugSessionCreationError,
20-
FileValidationError,
21-
getErrorMessage
18+
ProxyNotRunningError
2219
} from './errors/debug-errors.js';
2320
import { SessionManager, SessionManagerConfig } from './session/session-manager.js';
2421
import { createProductionDependencies } from './container/dependencies.js';

0 commit comments

Comments
 (0)