fix: resolve PR check failures for TypeScript and ESLint issues

- Remove unnecessary conditional checks in githubController.ts that caused TypeScript lint warnings
- Fix ESLint configuration to properly handle mixed JavaScript and TypeScript test files
- Update Jest configuration to remove deprecated isolatedModules option
- Add isolatedModules: true to tsconfig.json as recommended by ts-jest
- Ensure all tests pass and build succeeds

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Jonathan
2025-05-31 11:47:24 -05:00
parent 1c4cc39209
commit f42017f2a5
4 changed files with 30 additions and 6 deletions

View File

@@ -105,9 +105,31 @@ module.exports = [
'@typescript-eslint/consistent-type-imports': ['error', { prefer: 'type-imports' }]
}
},
// Test files (JavaScript and TypeScript)
// Test files (JavaScript)
{
files: ['test/**/*.js', '**/*.test.js', 'test/**/*.ts', '**/*.test.ts'],
files: ['test/**/*.js', '**/*.test.js'],
languageOptions: {
ecmaVersion: 'latest',
sourceType: 'commonjs',
globals: {
jest: 'readonly',
describe: 'readonly',
test: 'readonly',
it: 'readonly',
expect: 'readonly',
beforeEach: 'readonly',
afterEach: 'readonly',
beforeAll: 'readonly',
afterAll: 'readonly'
}
},
rules: {
'no-console': 'off'
}
},
// Test files (TypeScript)
{
files: ['test/**/*.ts', '**/*.test.ts'],
languageOptions: {
parser: tsparser,
parserOptions: {
@@ -127,6 +149,9 @@ module.exports = [
afterAll: 'readonly'
}
},
plugins: {
'@typescript-eslint': tseslint
},
rules: {
'no-console': 'off',
'@typescript-eslint/no-explicit-any': 'off' // Allow any in tests for mocking

View File

@@ -8,9 +8,7 @@ module.exports = {
'**/test/e2e/scenarios/**/*.test.{js,ts}'
],
transform: {
'^.+\\.ts$': ['ts-jest', {
isolatedModules: true
}],
'^.+\\.ts$': 'ts-jest',
'^.+\\.js$': 'babel-jest'
},
moduleFileExtensions: ['ts', 'js', 'json'],

View File

@@ -117,7 +117,7 @@ export const handleWebhook: WebhookHandler = async (req, res) => {
// Validate request body structure for webhook processing
// Use Object.prototype.toString for secure type checking to prevent bypass
const bodyType = Object.prototype.toString.call(req.body);
if (bodyType !== '[object Object]' || req.body === null || req.body === undefined) {
if (bodyType !== '[object Object]') {
logger.error('Webhook request missing or invalid body structure');
return res.status(400).json({ error: 'Missing or invalid request body' });
}

View File

@@ -28,6 +28,7 @@
"allowUnreachableCode": false,
"noFallthroughCasesInSwitch": true,
"noErrorTruncation": true,
"isolatedModules": true,
"types": ["node", "jest"]
},
"include": [