From: Iskren Chernev Date: Sun, 22 Mar 2015 21:42:12 +0000 (-0700) Subject: Fix jshint errors in grunt tasks X-Git-Tag: 2.10.2~15^2~24 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4e7d258065c9737113ff9c510574dea00a524a14;p=thirdparty%2Fmoment.git Fix jshint errors in grunt tasks --- diff --git a/tasks/bump_version.js b/tasks/bump_version.js index 7490058a4..5d59a651d 100644 --- a/tasks/bump_version.js +++ b/tasks/bump_version.js @@ -1,7 +1,7 @@ module.exports = function (grunt) { grunt.registerTask('bump_version', function (version) { if (!version || version.split('.').length !== 3) { - grunt.fail.fatal('malformed version. Use\n\n grunt bump_version:1.2.3') + grunt.fail.fatal('malformed version. Use\n\n grunt bump_version:1.2.3'); } grunt.config('string-replace.moment-js', { diff --git a/tasks/component.js b/tasks/component.js index cc11fa685..f9398aead 100644 --- a/tasks/component.js +++ b/tasks/component.js @@ -7,4 +7,4 @@ module.exports = function (grunt) { grunt.file.write('component.json', JSON.stringify(config, true, 2) + '\n'); }); -} +}; diff --git a/tasks/embed_locales.js b/tasks/embed_locales.js index dc620a092..7583bf803 100644 --- a/tasks/embed_locales.js +++ b/tasks/embed_locales.js @@ -17,7 +17,7 @@ module.exports = function (grunt) { grunt.file.write(config.dest, modifiedContents); }); - var languageReset = 'moment.locale(\'en\');' + var languageReset = 'moment.locale(\'en\');'; function determineEmbeddedContent(files) { var embeddedContent = ''; diff --git a/tasks/history.js b/tasks/history.js index 7d0f769b7..fc6d3ffac 100644 --- a/tasks/history.js +++ b/tasks/history.js @@ -26,7 +26,7 @@ function makeBar(length) { } function normalize() { - var i, + var i, max = 0, max2 = 0; for (i = 0; i < count; i ++) { @@ -82,15 +82,15 @@ function getSizeAtVersion(version, path) { } function getRemote() { - var old_versions = '1.0.1 1.1.0 1.1.1 1.1.2 1.2.0 1.3.0 1.4.0'.split(' '), - new_versions = '1.5.0 1.5.1 1.6.0 1.6.1 1.7.0 1.7.1'.split(' '), + var oldVersions = '1.0.1 1.1.0 1.1.1 1.1.2 1.2.0 1.3.0 1.4.0'.split(' '), + newVersions = '1.5.0 1.5.1 1.6.0 1.6.1 1.7.0 1.7.1'.split(' '), i; - for (i = 0; i < old_versions.length; i++) { - getSizeAtVersion(old_versions[i], '/moment.min.js'); + for (i = 0; i < oldVersions.length; i++) { + getSizeAtVersion(oldVersions[i], '/moment.min.js'); } - for (i = 0; i < new_versions.length; i++) { - getSizeAtVersion(new_versions[i], '/min/moment.min.js'); + for (i = 0; i < newVersions.length; i++) { + getSizeAtVersion(newVersions[i], '/min/moment.min.js'); } } @@ -120,4 +120,4 @@ module.exports = function (grunt) { getRemote(); getLocal(); }); -}; \ No newline at end of file +}; diff --git a/tasks/nuget.js b/tasks/nuget.js index 4c1e7d011..f5b8cedfa 100644 --- a/tasks/nuget.js +++ b/tasks/nuget.js @@ -26,4 +26,4 @@ module.exports = function (grunt) { grunt.registerTask('nuget-publish', [ 'nugetpack', 'nugetpush', 'clean:nuget' ]); -} +}; diff --git a/tasks/qtest.js b/tasks/qtest.js index b36a4c077..99f78c0a4 100644 --- a/tasks/qtest.js +++ b/tasks/qtest.js @@ -21,7 +21,7 @@ module.exports = function (grunt) { done(err); return; } - var err = null; + err = null; if (report.failed !== 0) { err = new Error(report.failed + " tests failed"); } diff --git a/tasks/transpile.js b/tasks/transpile.js index dd3d709f3..97b8ead2f 100644 --- a/tasks/transpile.js +++ b/tasks/transpile.js @@ -5,14 +5,6 @@ module.exports = function (grunt) { var TMP_DIR = "build/tmp"; function moveComments(code) { - var comments = code.split('\n') - .map(function(line) { - return line.trim(); - }) - .filter(function(line) { - return line.slice(0, 3) === '//!'; - }); - var comments = [], rest = []; code.split('\n').forEach(function (line) { if (line.trim().slice(0, 3) === '//!') { @@ -58,10 +50,8 @@ module.exports = function (grunt) { var batchSize = 50, promise = Promise.resolve(null), files = grunt.file.expand({cwd: opts.base}, opts.pattern), - i; - - for (i = 0; i < files.length; i += batchSize) { - (function(i) { + i, + transpileOne = function (i) { promise = promise.then(function() { grunt.log.writeln("transpiling from", opts.pattern, i); return Promise.all(files.slice(i, i + batchSize).map(function(file) { @@ -77,8 +67,12 @@ module.exports = function (grunt) { }); })); }); - }(i)); + }; + + for (i = 0; i < files.length; i += batchSize) { + transpileOne(i); } + return promise; } diff --git a/tasks/zones.js b/tasks/zones.js index 61ad03b7b..72629274a 100644 --- a/tasks/zones.js +++ b/tasks/zones.js @@ -36,7 +36,7 @@ module.exports = function (grunt) { // country code TAB coordinates TAB timezone .map(function (line) { return line.split('\t')[2]; })); }); - }; + } function runTestsInZone (zone, next) { grunt.log.ok('Running tests in zone ' + zone); @@ -50,11 +50,11 @@ module.exports = function (grunt) { }, function (err, result, code) { if (code !== 0) { grunt.log.error(result.stdout.split(/\r\n|\r|\n/) - .filter(function (line) { return /^(>>|Warning:|$)/.test(line) }) + .filter(function (line) { return /^(>>|Warning:|$)/.test(line); }) .map(function (line) { return (line.substr(0, 3) === '>> ' ? line.substr(3) : line); }) .join('\n')); } next(); }); - }; + } };