function checkLastSegment(node) {
      let loc, name;

      /*
       * Skip if it expected no return value or unreachable.
       * When unreachable, all paths are returned or thrown.
       */
      if (funcInfo.codePath.currentSegments.every(isUnreachable) ||
          isSimpleArrow(node) ||
          isClassConstructor(node)
      ) {
          return;
      }

      // Adjust a location and a message.
      if (node.type === "Program") {

          // The head of program.
          loc = { line: 1, column: 0 };
          name = "program";
      } else if (node.type === "ArrowFunctionExpression") {

          // `=>` token
          loc = context.getSourceCode().getTokenBefore(node.body, astUtils.isArrowToken).loc.start;
      } else if (
          node.parent.type === "MethodDefinition" ||
          (node.parent.type === "Property" && node.parent.method)
      ) {

          // Method name.
          loc = node.parent.key.loc.start;
      } else {

          // Function name or `function` keyword.
          loc = (node.id || node).loc.start;
      }

      if (!name) {
          name = astUtils.getFunctionNameWithKind(node);
      }

      // Reports.
      context.report({
          node,
          loc,
          message: "Expected to return a value at the end of {{name}}.",
          data: { name }
      });
    }
/**
    * Checks whether of not the implicit returning is consistent if the last
    * code path segment is reachable.
    *
    * @param {ASTNode} node - A program/function node to check.
    * @returns {void}
    */
Checks whether of not the implicit returning is consistent if the last
code path segment is reachable.

@param {ASTNode} node - A program/function node to check.
@returns {void}
Checks whether of not the implicit returning is consistent if the last code path segment is reachable . @param { ASTNode } node - A program / function node to check . @returns { void }
function checkLastSegment(node) {
      let loc, name;
      if (funcInfo.codePath.currentSegments.every(isUnreachable) ||
          isSimpleArrow(node) ||
          isClassConstructor(node)
      ) {
          return;
      }
      if (node.type === "Program") {
          loc = { line: 1, column: 0 };
          name = "program";
      } else if (node.type === "ArrowFunctionExpression") {
          loc = context.getSourceCode().getTokenBefore(node.body, astUtils.isArrowToken).loc.start;
      } else if (
          node.parent.type === "MethodDefinition" ||
          (node.parent.type === "Property" && node.parent.method)
      ) {
          loc = node.parent.key.loc.start;
      } else {
          loc = (node.id || node).loc.start;
      }
      if (!name) {
          name = astUtils.getFunctionNameWithKind(node);
      }
      context.report({
          node,
          loc,
          message: "Expected to return a value at the end of {{name}}.",
          data: { name }
      });
    }
function checkLastSegment ( node ) { let loc , name ; if ( funcInfo . codePath . currentSegments . every ( isUnreachable ) || isSimpleArrow ( node ) || isClassConstructor ( node ) ) { return ; } if ( node . type === "Program" ) { loc = { line : 1 , column : 0 } ; name = "program" ; } else if ( node . type === "ArrowFunctionExpression" ) { loc = context . getSourceCode ( ) . getTokenBefore ( node . body , astUtils . isArrowToken ) . loc . start ; } else if ( node . parent . type === "MethodDefinition" || ( node . parent . type === "Property" && node . parent . method ) ) { loc = node . parent . key . loc . start ; } else { loc = ( node . id || node ) . loc . start ; } if ( ! name ) { name = astUtils . getFunctionNameWithKind ( node ) ; } context . report ( { node , loc , message : "Expected to return a value at the end of {{name}}." , data : { name } } ) ; }
Checks whether of not the implicit returning is consistent if the last
 code path segment is reachable.
Checks whether of not the implicit returning is consistent if the last code path segment is reachable .
/*
       * Skip if it expected no return value or unreachable.
       * When unreachable, all paths are returned or thrown.
       */ // Adjust a location and a message. // The head of program. // `=>` token // Method name. // Function name or `function` keyword. // Reports.