UNPKG

eslint-plugin-exception-handling

Version:

💣 Lints unhandled functions that might throw errors. For JavaScript/TypeScript eslint.

11 lines (10 loc) • 468 B
import { isImportDeclaration, isImportSpecifier } from "./ast-guards.js"; import { getImportDeclaration } from "./get-import-declaration.js"; export function getFunctionId(context, node) { if (isImportDeclaration(node)) { const name = node.specifiers.find(isImportSpecifier)?.local.name; const fileName = getImportDeclaration(context, node); return `${fileName.path}#${name}`; } return `${context.physicalFilename}#${node.name}`; }