How to use the ts-lib-utils.getProjectRootNamesAndCompilerOptions function in ts-lib-utils

To help you get started, we’ve selected a few ts-lib-utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github plantain-00 / type-coverage / packages / core / src / core.ts View on Github external
export async function lint(project: string, options?: Partial) {
  const lintOptions = { ...defaultLintOptions, ...options }
  const { rootNames, compilerOptions } = await getProjectRootNamesAndCompilerOptions(project)

  const program = ts.createProgram(rootNames, compilerOptions, undefined, lintOptions.oldProgram)
  const checker = program.getTypeChecker()

  const allFiles = new Set()
  const sourceFileInfos: SourceFileInfo[] = []
  const typeCheckResult = await readCache(lintOptions.enableCache)
  const ignoreFileGlobs = lintOptions.ignoreFiles
    ? (typeof lintOptions.ignoreFiles === 'string'
      ? [lintOptions.ignoreFiles]
      : lintOptions.ignoreFiles)
    : undefined
  for (const sourceFile of program.getSourceFiles()) {
    let file = sourceFile.fileName
    if (!file.includes('node_modules') && (!lintOptions.files || lintOptions.files.includes(file))) {
      file = path.relative(process.cwd(), file)

ts-lib-utils

Utils to develop library using typescript

MIT
Latest version published 4 years ago

Package Health Score

56 / 100
Full package analysis

Similar packages