Skip to content

⬅️ Back to Table of Contents

📄 validateDefaultProjectForFilesGlob

📊 Analysis Summary

Metric Count
🔧 Functions 1
📊 Variables & Constants 1

📚 Table of Contents

🛠️ File Location:

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

Variables & Constants

Name Type Kind Value Exported
DEFAULT_PROJECT_FILES_ERROR... "\n\nHaving many files run with the d... const ` Having many files run with the default project is known to cause performanc...

Functions

validateDefaultProjectForFilesGlob(allowDefaultProject: string[] | undefined): void

Parameters:

  • allowDefaultProject string[] | undefined

Returns: void

Calls:

  • glob.includes
Code
export function validateDefaultProjectForFilesGlob(
  allowDefaultProject: string[] | undefined,
): void {
  if (!allowDefaultProject?.length) {
    return;
  }

  for (const glob of allowDefaultProject) {
    if (glob === '*') {
      throw new Error(
        `allowDefaultProject contains the overly wide '*'.${DEFAULT_PROJECT_FILES_ERROR_EXPLANATION}`,
      );
    }
    if (glob.includes('**')) {
      throw new Error(
        `allowDefaultProject glob '${glob}' contains a disallowed '**'.${DEFAULT_PROJECT_FILES_ERROR_EXPLANATION}`,
      );
    }
  }
}

Generated by Syntax Scribe