function sorter(a, b, context, ignoreCase, requiredFirst, callbacksLast, noSortAlphabetically) {
  const aKey = String(astUtil.getKeyValue(context, a));
  const bKey = String(astUtil.getKeyValue(context, b));

  if (requiredFirst) {
    if (isRequiredProp(a) && !isRequiredProp(b)) {
      return -1;
    }
    if (!isRequiredProp(a) && isRequiredProp(b)) {
      return 1;
    }
  }

  if (callbacksLast) {
    if (isCallbackPropName(aKey) && !isCallbackPropName(bKey)) {
      return 1;
    }
    if (!isCallbackPropName(aKey) && isCallbackPropName(bKey)) {
      return -1;
    }
  }

  if (!noSortAlphabetically) {
    if (ignoreCase) {
      return aKey.localeCompare(bKey);
    }

    if (aKey < bKey) {
      return -1;
    }
    if (aKey > bKey) {
      return 1;
    }
  }
  return 0;
}
Compares two elements.

@param {ASTNode} a the first element to compare.
@param {ASTNode} b the second element to compare.
@param {Context} context The context of the two nodes.
@param {boolean=} ignoreCase whether or not to ignore case when comparing the two elements.
@param {boolean=} requiredFirst whether or not to sort required elements first.
@param {boolean=} callbacksLast whether or not to sort callbacks after everything else.
@param {boolean=} noSortAlphabetically whether or not to disable alphabetical sorting of the elements.
@returns {number} the sort order of the two elements.