Skip to content

⬅️ Back to Table of Contents

📄 rangeToLoc

📊 Analysis Summary

Metric Count
🔧 Functions 1
📦 Imports 2

📚 Table of Contents

🛠️ File Location:

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

📦 Imports

Name Source
TSESLint @typescript-eslint/utils
TSESTree @typescript-eslint/utils

Functions

rangeToLoc(sourceCode: TSESLint.SourceCode, range: TSESLint.AST.Range): TSESTree.SourceLocation

Parameters:

  • sourceCode TSESLint.SourceCode
  • range TSESLint.AST.Range

Returns: TSESTree.SourceLocation

Calls:

  • sourceCode.getLocFromIndex
Code
export function rangeToLoc(
  sourceCode: TSESLint.SourceCode,
  range: TSESLint.AST.Range,
): TSESTree.SourceLocation {
  return {
    end: sourceCode.getLocFromIndex(range[1]),
    start: sourceCode.getLocFromIndex(range[0]),
  };
}

Generated by Syntax Scribe