Skip to content

⬅️ Back to Table of Contents

📄 createProjectProgram

📊 Analysis Summary

Metric Count
🔧 Functions 1
📦 Imports 6

📚 Table of Contents

🛠️ File Location:

📂 packages/typescript-estree/src/create-program/createProjectProgram.ts

📦 Imports

Name Source
debug debug
ParseSettings ../parseSettings
ASTAndDefiniteProgram ./shared
firstDefined ../node-utils
createProjectProgramError ./createProjectProgramError
getAstFromProgram ./shared

Functions

createProjectProgram(parseSettings: ParseSettings, programsForProjects: readonly ts.Program[]): ASTAndDefiniteProgram

Parameters:

  • parseSettings any: Internal settings for parsing the file

Returns: undefined If found, the source file corresponding to the code and the containing program

Raw JSDoc
/**
 * @param parseSettings Internal settings for parsing the file
 * @returns If found, the source file corresponding to the code and the containing program
 */

Calls:

  • log
  • firstDefined (from ../node-utils)
  • getAstFromProgram (from ./shared)
  • createProjectProgramError(parseSettings, programsForProjects).join
Code
export function createProjectProgram(
  parseSettings: ParseSettings,
  programsForProjects: readonly ts.Program[],
): ASTAndDefiniteProgram {
  log('Creating project program for: %s', parseSettings.filePath);

  const astAndProgram = firstDefined(programsForProjects, currentProgram =>
    getAstFromProgram(currentProgram, parseSettings.filePath),
  );

  if (!astAndProgram) {
    throw new Error(
      createProjectProgramError(parseSettings, programsForProjects).join('\n'),
    );
  }

  return astAndProgram;
}

Generated by Syntax Scribe