2 * @fileoverview Rule to check that spaced function application
3 * @author Matt DuVall <http://www.mattduvall.com>
8 //------------------------------------------------------------------------------
10 //------------------------------------------------------------------------------
12 module.exports = function(context) {
14 function detectOpenSpaces(node) {
15 var lastCalleeToken = context.getLastToken(node.callee);
16 var tokens = context.getTokens(node);
17 var i = tokens.indexOf(lastCalleeToken), l = tokens.length;
18 while (i < l && tokens[i].value !== "(") {
24 // look for a space between the callee and the open paren
25 if (tokens[i - 1].range[1] !== tokens[i].range[0]) {
26 context.report(node, "Unexpected space between function name and paren.");
31 "CallExpression": detectOpenSpaces,
32 "NewExpression": detectOpenSpaces