lib/rules/array-callback-return.js
// Checks the return statement is valid.
Checks the return statement is valid.
Checks the return statement is valid .
ReturnStatement(node) {
                if (!funcInfo.shouldCheck) {
                    return;
                }
                funcInfo.hasReturn = true;
                let messageId = null;
                if (funcInfo.arrayMethodName === "forEach") {
                    if (options.checkForEach && node.argument) {
                        messageId = "expectedNoReturnValue";
                    }
                } else {
                    if (!options.allowImplicit && !node.argument) {
                        messageId = "expectedReturnValue";
                    }
                }
                if (messageId) {
                    context.report({
                        node,
                        messageId,
                        data: {
                            name: lodash.upperFirst(astUtils.getFunctionNameWithKind(funcInfo.node))
                        }
                    });
                }
            }
ReturnStatement ( node ) { if ( ! funcInfo . shouldCheck ) { return ; } funcInfo . hasReturn = true ; let messageId = null ; if ( funcInfo . arrayMethodName === "forEach" ) { if ( options . checkForEach && node . argument ) { messageId = "expectedNoReturnValue" ; } } else { if ( ! options . allowImplicit && ! node . argument ) { messageId = "expectedReturnValue" ; } } if ( messageId ) { context . report ( { node , messageId , data : { name : lodash . upperFirst ( astUtils . getFunctionNameWithKind ( funcInfo . node ) ) } } ) ; } }
Checks the return statement is valid.
Checks the return statement is valid .
// if checkForEach: true, returning a value at any path inside a forEach is not allowed // if allowImplicit: false, should also check node.argument