From 393f9b373beb7546f0243218d5bce8189757e2cb Mon Sep 17 00:00:00 2001 From: Greduan Date: Sun, 12 Oct 2014 21:44:10 -0500 Subject: [PATCH] Check for a shebang and remove it if it's there --- gulp.jslint.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/gulp.jslint.js b/gulp.jslint.js index 5ff61f6..135cdff 100755 --- a/gulp.jslint.js +++ b/gulp.jslint.js @@ -18,7 +18,7 @@ return function (src, fn) { var retVal, js, lint = function () { - var myRet; + var myRet, str; // prepare for linting exports src.jslint = {}; @@ -26,6 +26,11 @@ // convert to string js = src.contents.toString('utf8'); + // check for shebang + if (js.substr(0, js.indexOf('\n')).match(/^#! ?/)) { + js = js.replace(js.split('\n', 1) + '\n', ''); + } + // lint the file src.jslint.edition = JSLINT.edition; src.jslint.success = JSLINT(js, options); @@ -125,4 +130,4 @@ // begin linting return evtStr.map(doLint(options)); }; -}()); \ No newline at end of file +}());