function getParser(path, context) {
  const parserPath = getParserPath(path, context);
  if (parserPath) {
    return parserPath;
  }
  if (
    !!context.languageOptions
    && !!context.languageOptions.parser
    && typeof context.languageOptions.parser !== 'string'
    && (
      // @ts-expect-error TODO: figure out a better type
      typeof context.languageOptions.parser.parse === 'function'
      // @ts-expect-error TODO: figure out a better type
      || typeof context.languageOptions.parser.parseForESLint === 'function'
    )
  ) {
    return context.languageOptions.parser;
  }

  return null;
}
@type {(path: string, context: import('eslint').Rule.RuleContext) => string | null | (import('eslint').Linter.ParserModule)}