forked from claude-did-this/claude-hub
- Fix JSON parsing error handling in Express middleware test - Remove brittle test case that relied on unrealistic sync throw behavior - Update Jest config to handle ES modules from Octokit dependencies - Align Docker image naming to use claudecode:latest consistently - Add tsconfig.test.json for proper test TypeScript configuration - Clean up duplicate and meaningless test cases for better maintainability All tests now pass (344 passing, 27 skipped, 0 failing) 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
135 lines
4.1 KiB
JavaScript
135 lines
4.1 KiB
JavaScript
const js = require('@eslint/js');
|
|
const tseslint = require('@typescript-eslint/eslint-plugin');
|
|
const tsparser = require('@typescript-eslint/parser');
|
|
|
|
module.exports = [
|
|
js.configs.recommended,
|
|
{
|
|
languageOptions: {
|
|
ecmaVersion: 'latest',
|
|
sourceType: 'commonjs',
|
|
globals: {
|
|
console: 'readonly',
|
|
process: 'readonly',
|
|
Buffer: 'readonly',
|
|
__dirname: 'readonly',
|
|
__filename: 'readonly',
|
|
module: 'readonly',
|
|
require: 'readonly',
|
|
exports: 'readonly',
|
|
global: 'readonly',
|
|
setImmediate: 'readonly',
|
|
clearImmediate: 'readonly',
|
|
setTimeout: 'readonly',
|
|
clearTimeout: 'readonly',
|
|
setInterval: 'readonly',
|
|
clearInterval: 'readonly',
|
|
fetch: 'readonly',
|
|
URL: 'readonly'
|
|
}
|
|
},
|
|
rules: {
|
|
// Error prevention
|
|
'no-unused-vars': ['error', { 'argsIgnorePattern': '^_', 'varsIgnorePattern': '^_', 'caughtErrorsIgnorePattern': '^_' }],
|
|
'no-console': 'warn',
|
|
'no-debugger': 'error',
|
|
|
|
// Code style
|
|
'indent': ['error', 2],
|
|
'quotes': ['error', 'single'],
|
|
'semi': ['error', 'always'],
|
|
'comma-dangle': ['error', 'never'],
|
|
|
|
// Best practices
|
|
'eqeqeq': 'error',
|
|
'no-eval': 'error',
|
|
'no-implied-eval': 'error',
|
|
'no-new-func': 'error',
|
|
'no-return-assign': 'error',
|
|
'no-self-compare': 'error',
|
|
'no-sequences': 'error',
|
|
'no-throw-literal': 'error',
|
|
'no-unmodified-loop-condition': 'error',
|
|
'no-unused-expressions': 'error',
|
|
'no-useless-call': 'error',
|
|
'no-useless-concat': 'error',
|
|
'no-useless-return': 'error',
|
|
'no-void': 'error',
|
|
'radix': 'error',
|
|
'wrap-iife': 'error',
|
|
'yoda': 'error',
|
|
|
|
// Node.js specific
|
|
'no-process-exit': 'error',
|
|
'no-sync': 'warn',
|
|
|
|
// Security
|
|
'no-buffer-constructor': 'error'
|
|
}
|
|
},
|
|
// TypeScript files configuration
|
|
{
|
|
files: ['**/*.ts', '**/*.tsx'],
|
|
languageOptions: {
|
|
parser: tsparser,
|
|
parserOptions: {
|
|
ecmaVersion: 'latest',
|
|
sourceType: 'commonjs',
|
|
project: './tsconfig.json'
|
|
}
|
|
},
|
|
plugins: {
|
|
'@typescript-eslint': tseslint
|
|
},
|
|
rules: {
|
|
// Disable base rules that are covered by TypeScript equivalents
|
|
'no-unused-vars': 'off',
|
|
'@typescript-eslint/no-unused-vars': ['error', { 'argsIgnorePattern': '^_', 'varsIgnorePattern': '^_', 'caughtErrorsIgnorePattern': '^_' }],
|
|
|
|
// TypeScript specific rules
|
|
'@typescript-eslint/no-explicit-any': 'warn',
|
|
'@typescript-eslint/no-non-null-assertion': 'warn',
|
|
'@typescript-eslint/prefer-nullish-coalescing': 'error',
|
|
'@typescript-eslint/prefer-optional-chain': 'error',
|
|
'@typescript-eslint/no-unnecessary-type-assertion': 'error',
|
|
'@typescript-eslint/no-floating-promises': 'error',
|
|
'@typescript-eslint/await-thenable': 'error',
|
|
'@typescript-eslint/no-misused-promises': 'error',
|
|
'@typescript-eslint/require-await': 'error',
|
|
'@typescript-eslint/prefer-as-const': 'error',
|
|
'@typescript-eslint/no-inferrable-types': 'error',
|
|
'@typescript-eslint/no-unnecessary-condition': 'warn',
|
|
|
|
// Style rules
|
|
'@typescript-eslint/consistent-type-definitions': ['error', 'interface'],
|
|
'@typescript-eslint/consistent-type-imports': ['error', { prefer: 'type-imports' }]
|
|
}
|
|
},
|
|
// Test files (JavaScript and TypeScript)
|
|
{
|
|
files: ['test/**/*.js', '**/*.test.js', 'test/**/*.ts', '**/*.test.ts'],
|
|
languageOptions: {
|
|
parser: tsparser,
|
|
parserOptions: {
|
|
ecmaVersion: 'latest',
|
|
sourceType: 'commonjs',
|
|
project: './tsconfig.test.json'
|
|
},
|
|
globals: {
|
|
jest: 'readonly',
|
|
describe: 'readonly',
|
|
test: 'readonly',
|
|
it: 'readonly',
|
|
expect: 'readonly',
|
|
beforeEach: 'readonly',
|
|
afterEach: 'readonly',
|
|
beforeAll: 'readonly',
|
|
afterAll: 'readonly'
|
|
}
|
|
},
|
|
rules: {
|
|
'no-console': 'off',
|
|
'@typescript-eslint/no-explicit-any': 'off' // Allow any in tests for mocking
|
|
}
|
|
}
|
|
]; |