lib/rules/array-callback-return.js
/**
         * Checks whether or not the last code path segment is reachable.
         * Then reports this function if the segment is reachable.
         *
         * If the last code path segment is reachable, there are paths which are not
         * returned or thrown.
         * @param {ASTNode} node A node to check.
         * @returns {void}
         */
Checks whether or not the last code path segment is reachable.
Then reports this function if the segment is reachable.

If the last code path segment is reachable, there are paths which are not
returned or thrown.
@param {ASTNode} node A node to check.
@returns {void}
Checks whether or not the last code path segment is reachable . Then reports this function if the segment is reachable . If the last code path segment is reachable there are paths which are not returned or thrown . @param { ASTNode } node A node to check . @returns { void }
function checkLastSegment(node) {
            if (!funcInfo.shouldCheck) {
                return;
            }
            let messageId = null;
            if (funcInfo.arrayMethodName === "forEach") {
                if (options.checkForEach && node.type === "ArrowFunctionExpression" && node.expression) {
                    messageId = "expectedNoReturnValue";
                }
            } else {
                if (node.body.type === "BlockStatement" && funcInfo.codePath.currentSegments.some(isReachable)) {
                    messageId = funcInfo.hasReturn ? "expectedAtEnd" : "expectedInside";
                }
            }
            if (messageId) {
                let name = astUtils.getFunctionNameWithKind(funcInfo.node);
                name = messageId === "expectedNoReturnValue" ? lodash.upperFirst(name) : name;
                context.report({
                    node,
                    loc: getLocation(node, context.getSourceCode()).loc.start,
                    messageId,
                    data: { name }
                });
            }
        }
function checkLastSegment ( node ) { if ( ! funcInfo . shouldCheck ) { return ; } let messageId = null ; if ( funcInfo . arrayMethodName === "forEach" ) { if ( options . checkForEach && node . type === "ArrowFunctionExpression" && node . expression ) { messageId = "expectedNoReturnValue" ; } } else { if ( node . body . type === "BlockStatement" && funcInfo . codePath . currentSegments . some ( isReachable ) ) { messageId = funcInfo . hasReturn ? "expectedAtEnd" : "expectedInside" ; } } if ( messageId ) { let name = astUtils . getFunctionNameWithKind ( funcInfo . node ) ; name = messageId === "expectedNoReturnValue" ? lodash . upperFirst ( name ) : name ; context . report ( { node , loc : getLocation ( node , context . getSourceCode ( ) ) . loc . start , messageId , data : { name } } ) ; } }
Checks whether or not the last code path segment is reachable.
Checks whether or not the last code path segment is reachable .