Skip to content

⬅️ Back to Table of Contents

📄 scopeUtils.ts

📊 Analysis Summary

Metric Count
🔧 Functions 1
📦 Imports 2

📚 Table of Contents

🛠️ File Location:

📂 packages/eslint-plugin/src/util/scopeUtils.ts

📦 Imports

Name Source
TSESTree @typescript-eslint/utils
SourceCode @typescript-eslint/utils/ts-eslint

Functions

isReferenceToGlobalFunction(calleeName: string, node: TSESTree.Node, sourceCode: SourceCode): boolean

Code
export function isReferenceToGlobalFunction(
  calleeName: string,
  node: TSESTree.Node,
  sourceCode: SourceCode,
): boolean {
  const ref = sourceCode
    .getScope(node)
    .references.find(ref => ref.identifier.name === calleeName);

  // ensure it's the "global" version
  return !ref?.resolved?.defs.length;
}
  • Parameters:
  • calleeName: string
  • node: TSESTree.Node
  • sourceCode: SourceCode
  • Return Type: boolean
  • Calls:
  • sourceCode .getScope(node) .references.find
  • Internal Comments:
    // ensure it's the "global" version