Skip to content

⬅️ Back to Table of Contents

📄 getErrorLabel.ts

📊 Analysis Summary

Metric Count
🔧 Functions 1
📦 Imports 1

📚 Table of Contents

🛠️ File Location:

📂 packages/ast-spec/tests/util/getErrorLabel.ts

📦 Imports

Name Source
ErrorLabel ./parsers/parser-types.js

Functions

getErrorLabel(isBabelError: boolean, isTSESTreeError: boolean): ErrorLabel

Code
(
  isBabelError: boolean,
  isTSESTreeError: boolean,
): ErrorLabel => {
  if (!isBabelError && isTSESTreeError) {
    return ErrorLabel.TSESTree;
  }

  if (isBabelError && !isTSESTreeError) {
    return ErrorLabel.Babel;
  }

  if (isBabelError && isTSESTreeError) {
    return ErrorLabel.Both;
  }

  return ErrorLabel.None;
}
  • Parameters:
  • isBabelError: boolean
  • isTSESTreeError: boolean
  • Return Type: ErrorLabel