function resolve(p, context) {
  try {
    return relative(p, getPhysicalFilename(context), context.settings);
  } catch (err) {
    if (!erroredContexts.has(context)) {
      // The `err.stack` string starts with `err.name` followed by colon and `err.message`.
      // We're filtering out the default `err.name` because it adds little value to the message.
      // @ts-expect-error this might be an Error
      let errMessage = err.message;
      // @ts-expect-error this might be an Error
      if (err.name !== ERROR_NAME && err.stack) {
        // @ts-expect-error this might be an Error
        errMessage = err.stack.replace(/^Error: /, '');
      }
      context.report({
        message: `Resolve error: ${errMessage}`,
        loc: { line: 1, column: 0 },
      });
      erroredContexts.add(context);
    }
  }
}
Given
@param p - module path
@param context - ESLint context
@return - the full module filesystem path; null if package is core; undefined if not found
@type {import('./resolve').default}