function inLifeCycleMethod(context, node, checkAsyncSafeLifeCycles) {
  let scope = getScope(context, node);
  while (scope) {
    if (scope.block && scope.block.parent && scope.block.parent.key) {
      const name = scope.block.parent.key.name;

      if (LIFE_CYCLE_METHODS.indexOf(name) >= 0) {
        return true;
      }
      if (checkAsyncSafeLifeCycles && ASYNC_SAFE_LIFE_CYCLE_METHODS.indexOf(name) >= 0) {
        return true;
      }
    }
    scope = scope.upper;
  }
  return false;
}
Check if we are in a lifecycle method
@param {object} context
@param {ASTNode} node The AST node being checked.
@param {boolean} checkAsyncSafeLifeCycles
@return {boolean} true if we are in a class constructor, false if not