4 {regex: /function\s+\(/g, message: 'Unexpected whitespace between "function" and "("'},
5 {regex: /\)\s+{/g, message: 'Unexpected whitespace between ")" and "{"'},
6 {regex: /(catch|for|if|switch|while|with)\(/g, message: 'Expected whitespace between "%s" and "(" but found none'},
7 {regex: /}(catch|else|finally)/g, message: 'Expected whitespace between "}" and "%s" but found none'},
8 {regex: /(do|else|finally|try){/g, message: 'Expected whitespace between "%s" and "{" but found none'}
11 module.exports = function(context){
14 function checkForIrregularWhitespace(node){
15 context.getSourceLines().forEach(function(line, index){
16 rules.forEach(function(rule){
20 while ((match = rule.regex.exec(line)) !== null){
25 errors.push([node, loc, rule.message.replace('%s', match[1])]);
32 'Program': function(node){
33 checkForIrregularWhitespace(node);
35 'Program:exit': function(){
36 errors.forEach(function(error){
37 context.report.apply(context, error);
43 module.exports.schema = [];