function* iterateIdentifierReferences(id, globalScope) {
  const variable = eslintUtils.findVariable(globalScope, id)
  if (!variable) {
    return
  }

  for (const reference of variable.references) {
    yield reference
  }
}
Iterate references of the given identifier.
@param {Identifier} id
@param {import('eslint').Scope.Scope} globalScope
@returns {Iterable<import('eslint').Scope.Reference>}