code: function isSafeReference(upperRef) {
          const id = upperRef.identifier;
  
          return (
              !upperRef.isWrite() ||
              variable.scope.variableScope === upperRef.from.variableScope &&
              id.range[0] < border
          );
      }
docs: Checks whether a given reference is safe or not.
  The reference is every reference of the upper scope's variable we are
  looking now.
  
  It's safeafe if the reference matches one of the following condition.
  - is readonly.
  - doesn't exist inside a local function and after the border.
  
  @param {eslint-scope.Reference} upperRef - A reference to check.
  @returns {boolean} `true` if the reference is safe.