All files / cli/src/generators typescript-config.js

100% Statements 3/3
100% Branches 0/0
100% Functions 3/3
100% Lines 3/3

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110                2x                                                                                                             44x                                                                                 2x          
/**
 * TypeScript configuration generator
 */
 
/**
 * Generate tsconfig.json for Coherent.js projects
 */
export function generateTsConfig() {
  return {
    compilerOptions: {
      // Target and Module
      target: 'ES2022',
      module: 'ESNext',
      lib: ['ES2022'],
 
      // Module Resolution
      moduleResolution: 'bundler',
      resolveJsonModule: true,
      allowSyntheticDefaultImports: true,
      esModuleInterop: true,
 
      // Emit
      outDir: './dist',
      declaration: true,
      declarationMap: true,
      sourceMap: true,
      removeComments: false,
 
      // Type Checking
      strict: true,
      noUnusedLocals: true,
      noUnusedParameters: true,
      noImplicitReturns: true,
      noFallthroughCasesInSwitch: true,
      noUncheckedIndexedAccess: true,
      allowUnusedLabels: false,
      allowUnreachableCode: false,
 
      // Interop Constraints
      forceConsistentCasingInFileNames: true,
      skipLibCheck: true,
 
      // Advanced
      noEmit: false,
      incremental: true
    },
    include: [
      'src/**/*'
    ],
    exclude: [
      'node_modules',
      'dist',
      'build',
      '**/*.test.ts',
      '**/*.spec.ts'
    ]
  };
}
 
/**
 * Generate jsconfig.json for JavaScript projects with better IDE support
 */
export function generateJsConfig() {
  return {
    compilerOptions: {
      // Module
      module: 'ESNext',
      moduleResolution: 'bundler',
      target: 'ES2022',
 
      // Type Checking
      checkJs: true,
      allowJs: true,
 
      // Module Resolution
      resolveJsonModule: true,
      allowSyntheticDefaultImports: true,
      esModuleInterop: true,
 
      // Interop Constraints
      forceConsistentCasingInFileNames: true,
      skipLibCheck: true,
 
      // Advanced
      baseUrl: '.',
      paths: {
        '@/*': ['src/*']
      }
    },
    include: [
      'src/**/*'
    ],
    exclude: [
      'node_modules',
      'dist',
      'build'
    ]
  };
}
 
/**
 * Get TypeScript dependencies
 */
export function getTypeScriptDependencies() {
  return {
    typescript: '^5.9.2',
    '@types/node': '^24.3.0'
  };
}