diff options
author | kpdecker <kpdecker@gmail.com> | 2015-08-03 16:43:09 -0500 |
---|---|---|
committer | kpdecker <kpdecker@gmail.com> | 2015-08-03 17:03:37 -0500 |
commit | 9b1f9c7e4434d99f0dd013db4370b1b59c3754b7 (patch) | |
tree | 916538a8f53cd7c925581243565473a18fcd5f5a | |
parent | 8e868ab22509c6ca5f5e7419e61c10e6e771b954 (diff) | |
download | handlebars.js-9b1f9c7e4434d99f0dd013db4370b1b59c3754b7.zip handlebars.js-9b1f9c7e4434d99f0dd013db4370b1b59c3754b7.tar.gz handlebars.js-9b1f9c7e4434d99f0dd013db4370b1b59c3754b7.tar.bz2 |
Style updates
29 files changed, 154 insertions, 124 deletions
diff --git a/Gruntfile.js b/Gruntfile.js index c2ff15e..945101c 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -9,6 +9,8 @@ module.exports = function(grunt) { }, files: [ '*.js', + 'bench/**/*.js', + 'tasks/**/*.js', 'lib/**/!(*.min|parser).js', 'spec/**/!(*.amd|json2|require).js' ] diff --git a/bench/.eslintrc b/bench/.eslintrc new file mode 100644 index 0000000..e03f181 --- /dev/null +++ b/bench/.eslintrc @@ -0,0 +1,14 @@ +{ + "globals": { + "require": true + }, + "rules": { + // Disabling for tests, for now. + "no-path-concat": 0, + + "no-var": 0, + "no-shadow": 0, + "handle-callback-err": 0, + "no-console": 0 + } +}
\ No newline at end of file diff --git a/bench/dist-size.js b/bench/dist-size.js index 9e5fdc0..9176054 100644 --- a/bench/dist-size.js +++ b/bench/dist-size.js @@ -1,5 +1,4 @@ -var _ = require('underscore'), - async = require('async'), +var async = require('async'), fs = require('fs'), zlib = require('zlib'); diff --git a/bench/index.js b/bench/index.js index 462b046..3e357e5 100644 --- a/bench/index.js +++ b/bench/index.js @@ -2,7 +2,7 @@ var fs = require('fs'); var metrics = fs.readdirSync(__dirname); metrics.forEach(function(metric) { - if (metric === 'index.js' || !/(.*)\.js$/.test(metric)) { + if (metric === 'index.js' || !(/(.*)\.js$/.test(metric))) { return; } diff --git a/bench/templates/arguments.js b/bench/templates/arguments.js index 5480c8d..aaa0346 100644 --- a/bench/templates/arguments.js +++ b/bench/templates/arguments.js @@ -1,6 +1,6 @@ module.exports = { helpers: { - foo: function(options) { + foo: function() { return ''; } }, diff --git a/bench/templates/array-each.js b/bench/templates/array-each.js index f1eb1e8..50e1c02 100644 --- a/bench/templates/array-each.js +++ b/bench/templates/array-each.js @@ -1,7 +1,7 @@ module.exports = { - context: { names: [{name: "Moe"}, {name: "Larry"}, {name: "Curly"}, {name: "Shemp"}] }, - handlebars: "{{#each names}}{{name}}{{/each}}", - dust: "{#names}{name}{/names}", - mustache: "{{#names}}{{name}}{{/names}}", - eco: "<% for item in @names: %><%= item.name %><% end %>" + context: { names: [{name: 'Moe'}, {name: 'Larry'}, {name: 'Curly'}, {name: 'Shemp'}] }, + handlebars: '{{#each names}}{{name}}{{/each}}', + dust: '{#names}{name}{/names}', + mustache: '{{#names}}{{name}}{{/names}}', + eco: '<% for item in @names: %><%= item.name %><% end %>' }; diff --git a/bench/templates/array-mustache.js b/bench/templates/array-mustache.js index 908f805..220c6fe 100644 --- a/bench/templates/array-mustache.js +++ b/bench/templates/array-mustache.js @@ -1,4 +1,4 @@ module.exports = { - context: { names: [{name: "Moe"}, {name: "Larry"}, {name: "Curly"}, {name: "Shemp"}] }, - handlebars: "{{#names}}{{name}}{{/names}}" -} + context: { names: [{name: 'Moe'}, {name: 'Larry'}, {name: 'Curly'}, {name: 'Shemp'}] }, + handlebars: '{{#names}}{{name}}{{/names}}' +}; diff --git a/bench/templates/complex.js b/bench/templates/complex.js index ddf361b..feba874 100644 --- a/bench/templates/complex.js +++ b/bench/templates/complex.js @@ -3,13 +3,13 @@ var fs = require('fs'); module.exports = { context: { header: function() { - return "Colors"; + return 'Colors'; }, hasItems: true, // To make things fairer in mustache land due to no `{{if}}` construct on arrays items: [ - {name: "red", current: true, url: "#Red"}, - {name: "green", current: false, url: "#Green"}, - {name: "blue", current: false, url: "#Blue"} + {name: 'red', current: true, url: '#Red'}, + {name: 'green', current: false, url: '#Green'}, + {name: 'blue', current: false, url: '#Blue'} ] }, diff --git a/bench/templates/data.js b/bench/templates/data.js index f532dec..be10e83 100644 --- a/bench/templates/data.js +++ b/bench/templates/data.js @@ -1,4 +1,4 @@ module.exports = { - context: { names: [{name: "Moe"}, {name: "Larry"}, {name: "Curly"}, {name: "Shemp"}] }, - handlebars: "{{#each names}}{{@index}}{{name}}{{/each}}" -} + context: { names: [{name: 'Moe'}, {name: 'Larry'}, {name: 'Curly'}, {name: 'Shemp'}] }, + handlebars: '{{#each names}}{{@index}}{{name}}{{/each}}' +}; diff --git a/bench/templates/depth-1.js b/bench/templates/depth-1.js index 74809bc..0f2576f 100644 --- a/bench/templates/depth-1.js +++ b/bench/templates/depth-1.js @@ -1,6 +1,6 @@ module.exports = { - context: { names: [{name: "Moe"}, {name: "Larry"}, {name: "Curly"}, {name: "Shemp"}], foo: 'bar' }, - handlebars: "{{#each names}}{{../foo}}{{/each}}", - mustache: "{{#names}}{{foo}}{{/names}}", - eco: "<% for item in @names: %><%= @foo %><% end %>" + context: { names: [{name: 'Moe'}, {name: 'Larry'}, {name: 'Curly'}, {name: 'Shemp'}], foo: 'bar' }, + handlebars: '{{#each names}}{{../foo}}{{/each}}', + mustache: '{{#names}}{{foo}}{{/names}}', + eco: '<% for item in @names: %><%= @foo %><% end %>' }; diff --git a/bench/templates/depth-2.js b/bench/templates/depth-2.js index 1d38baa..bff6ce8 100644 --- a/bench/templates/depth-2.js +++ b/bench/templates/depth-2.js @@ -1,6 +1,6 @@ module.exports = { - context: { names: [{bat: 'foo', name: ["Moe"]}, {bat: 'foo', name: ["Larry"]}, {bat: 'foo', name: ["Curly"]}, {bat: 'foo', name: ["Shemp"]}], foo: 'bar' }, - handlebars: "{{#each names}}{{#each name}}{{../bat}}{{../../foo}}{{/each}}{{/each}}", - mustache: "{{#names}}{{#name}}{{bat}}{{foo}}{{/name}}{{/names}}", - eco: "<% for item in @names: %><% for child in item.name: %><%= item.bat %><%= @foo %><% end %><% end %>" + context: { names: [{bat: 'foo', name: ['Moe']}, {bat: 'foo', name: ['Larry']}, {bat: 'foo', name: ['Curly']}, {bat: 'foo', name: ['Shemp']}], foo: 'bar' }, + handlebars: '{{#each names}}{{#each name}}{{../bat}}{{../../foo}}{{/each}}{{/each}}', + mustache: '{{#names}}{{#name}}{{bat}}{{foo}}{{/name}}{{/names}}', + eco: '<% for item in @names: %><% for child in item.name: %><%= item.bat %><%= @foo %><% end %><% end %>' }; diff --git a/bench/templates/index.js b/bench/templates/index.js index a718ea3..943f9cd 100644 --- a/bench/templates/index.js +++ b/bench/templates/index.js @@ -2,7 +2,7 @@ var fs = require('fs'); var templates = fs.readdirSync(__dirname); templates.forEach(function(template) { - if (template === 'index.js' || !/(.*)\.js$/.test(template)) { + if (template === 'index.js' || !(/(.*)\.js$/.test(template))) { return; } module.exports[RegExp.$1] = require('./' + RegExp.$1); diff --git a/bench/templates/object-mustache.js b/bench/templates/object-mustache.js index 52dbc26..41774b7 100644 --- a/bench/templates/object-mustache.js +++ b/bench/templates/object-mustache.js @@ -1,4 +1,4 @@ module.exports = { - context: { person: { name: "Larry", age: 45 } }, - handlebars: "{{#person}}{{name}}{{age}}{{/person}}" + context: { person: { name: 'Larry', age: 45 } }, + handlebars: '{{#person}}{{name}}{{age}}{{/person}}' }; diff --git a/bench/templates/object.js b/bench/templates/object.js index fef127a..084c070 100644 --- a/bench/templates/object.js +++ b/bench/templates/object.js @@ -1,7 +1,7 @@ module.exports = { - context: { person: { name: "Larry", age: 45 } }, - handlebars: "{{#with person}}{{name}}{{age}}{{/with}}", - dust: "{#person}{name}{age}{/person}", - eco: "<%= @person.name %><%= @person.age %>", - mustache: "{{#person}}{{name}}{{age}}{{/person}}" + context: { person: { name: 'Larry', age: 45 } }, + handlebars: '{{#with person}}{{name}}{{age}}{{/with}}', + dust: '{#person}{name}{age}{/person}', + eco: '<%= @person.name %><%= @person.age %>', + mustache: '{{#person}}{{name}}{{age}}{{/person}}' }; diff --git a/bench/templates/partial-recursion.js b/bench/templates/partial-recursion.js index 9d604fd..b903553 100644 --- a/bench/templates/partial-recursion.js +++ b/bench/templates/partial-recursion.js @@ -1,10 +1,10 @@ module.exports = { context: { name: '1', kids: [{ name: '1.1', kids: [{name: '1.1.1', kids: []}] }] }, partials: { - mustache: { recursion: "{{name}}{{#kids}}{{>recursion}}{{/kids}}" }, - handlebars: { recursion: "{{name}}{{#each kids}}{{>recursion}}{{/each}}" } + mustache: { recursion: '{{name}}{{#kids}}{{>recursion}}{{/kids}}' }, + handlebars: { recursion: '{{name}}{{#each kids}}{{>recursion}}{{/each}}' } }, - handlebars: "{{name}}{{#each kids}}{{>recursion}}{{/each}}", - dust: "{name}{#kids}{>recursion:./}{/kids}", - mustache: "{{name}}{{#kids}}{{>recursion}}{{/kids}}" + handlebars: '{{name}}{{#each kids}}{{>recursion}}{{/each}}', + dust: '{name}{#kids}{>recursion:./}{/kids}', + mustache: '{{name}}{{#kids}}{{>recursion}}{{/kids}}' }; diff --git a/bench/templates/partial.js b/bench/templates/partial.js index a6e6631..949e9c0 100644 --- a/bench/templates/partial.js +++ b/bench/templates/partial.js @@ -1,11 +1,11 @@ module.exports = { - context: { peeps: [{name: "Moe", count: 15}, {name: "Larry", count: 5}, {name: "Curly", count: 1}] }, + context: { peeps: [{name: 'Moe', count: 15}, {name: 'Larry', count: 5}, {name: 'Curly', count: 1}] }, partials: { - mustache: { variables: "Hello {{name}}! You have {{count}} new messages." }, - handlebars: { variables: "Hello {{name}}! You have {{count}} new messages." } + mustache: { variables: 'Hello {{name}}! You have {{count}} new messages.' }, + handlebars: { variables: 'Hello {{name}}! You have {{count}} new messages.' } }, - handlebars: "{{#each peeps}}{{>variables}}{{/each}}", - dust: "{#peeps}{>variables/}{/peeps}", - mustache: "{{#peeps}}{{>variables}}{{/peeps}}" + handlebars: '{{#each peeps}}{{>variables}}{{/each}}', + dust: '{#peeps}{>variables/}{/peeps}', + mustache: '{{#peeps}}{{>variables}}{{/peeps}}' }; diff --git a/bench/templates/paths.js b/bench/templates/paths.js index d84e061..fed039d 100644 --- a/bench/templates/paths.js +++ b/bench/templates/paths.js @@ -1,7 +1,7 @@ module.exports = { - context: { person: { name: {bar: {baz: "Larry"}}, age: 45 } }, - handlebars: "{{person.name.bar.baz}}{{person.age}}{{person.foo}}{{animal.age}}", - dust: "{person.name.bar.baz}{person.age}{person.foo}{animal.age}", - eco: "<%= @person.name.bar.baz %><%= @person.age %><%= @person.foo %><% if @animal: %><%= @animal.age %><% end %>", - mustache: "{{person.name.bar.baz}}{{person.age}}{{person.foo}}{{animal.age}}" + context: { person: { name: {bar: {baz: 'Larry'}}, age: 45 } }, + handlebars: '{{person.name.bar.baz}}{{person.age}}{{person.foo}}{{animal.age}}', + dust: '{person.name.bar.baz}{person.age}{person.foo}{animal.age}', + eco: '<%= @person.name.bar.baz %><%= @person.age %><%= @person.foo %><% if @animal: %><%= @animal.age %><% end %>', + mustache: '{{person.name.bar.baz}}{{person.age}}{{person.foo}}{{animal.age}}' }; diff --git a/bench/templates/string.js b/bench/templates/string.js index 335e37c..6b0e94a 100644 --- a/bench/templates/string.js +++ b/bench/templates/string.js @@ -1,7 +1,7 @@ module.exports = { context: {}, - handlebars: "Hello world", - dust: "Hello world", - mustache: "Hello world", - eco: "Hello world" + handlebars: 'Hello world', + dust: 'Hello world', + mustache: 'Hello world', + eco: 'Hello world' }; diff --git a/bench/templates/subexpression.js b/bench/templates/subexpression.js index 261c22d..659b530 100644 --- a/bench/templates/subexpression.js +++ b/bench/templates/subexpression.js @@ -4,11 +4,11 @@ module.exports = { return 'foo ' + value; }, header: function() { - return "Colors"; + return 'Colors'; } }, - handlebars: "{{echo (header)}}", - eco: "<%= @echo(@header()) %>" + handlebars: '{{echo (header)}}', + eco: '<%= @echo(@header()) %>' }; module.exports.context = module.exports.helpers; diff --git a/bench/templates/variables.js b/bench/templates/variables.js index d354238..41e4fea 100644 --- a/bench/templates/variables.js +++ b/bench/templates/variables.js @@ -1,8 +1,8 @@ module.exports = { - context: {name: "Mick", count: 30}, - handlebars: "Hello {{name}}! You have {{count}} new messages.", - dust: "Hello {name}! You have {count} new messages.", - mustache: "Hello {{name}}! You have {{count}} new messages.", - eco: "Hello <%= @name %>! You have <%= @count %> new messages." + context: {name: 'Mick', count: 30}, + handlebars: 'Hello {{name}}! You have {{count}} new messages.', + dust: 'Hello {name}! You have {count} new messages.', + mustache: 'Hello {{name}}! You have {{count}} new messages.', + eco: 'Hello <%= @name %>! You have <%= @count %> new messages.' }; diff --git a/bench/throughput.js b/bench/throughput.js index d27a94d..b0b229f 100644 --- a/bench/throughput.js +++ b/bench/throughput.js @@ -1,23 +1,22 @@ var _ = require('underscore'), runner = require('./util/template-runner'), - templates = require('./templates'), eco, dust, Handlebars, Mustache, eco; try { - dust = require("dustjs-linkedin"); + dust = require('dustjs-linkedin'); } catch (err) { /* NOP */ } try { - Mustache = require("mustache"); + Mustache = require('mustache'); } catch (err) { /* NOP */ } try { - eco = require("eco"); + eco = require('eco'); } catch (err) { /* NOP */ } function error() { - throw new Error("EWOT"); + throw new Error('EWOT'); } function makeSuite(bench, name, template, handlebarsOnly) { @@ -34,19 +33,19 @@ function makeSuite(bench, name, template, handlebarsOnly) { mustacheOut; var handlebar = Handlebars.compile(template.handlebars, {data: false}), - compat = Handlebars.compile(template.handlebars, {data: false, compat: true}), + compat = Handlebars.compile(template.handlebars, {data: false, compat: true}), options = {helpers: template.helpers}; - _.each(template.partials && template.partials.handlebars, function(partial, name) { + _.each(template.partials && template.partials.handlebars, function(partial) { Handlebars.registerPartial(name, Handlebars.compile(partial, {data: false})); }); handlebarsOut = handlebar(context, options); - bench("handlebars", function() { + bench('handlebars', function() { handlebar(context, options); }); compatOut = compat(context, options); - bench("compat", function() { + bench('compat', function() { compat(context, options); }); @@ -61,8 +60,8 @@ function makeSuite(bench, name, template, handlebarsOnly) { dust.render(templateName, context, function(err, out) { dustOut = out; }); - bench("dust", function() { - dust.render(templateName, context, function(err, out) { }); + bench('dust', function() { + dust.render(templateName, context, function() {}); }); } else { bench('dust', error); @@ -75,11 +74,11 @@ function makeSuite(bench, name, template, handlebarsOnly) { ecoOut = ecoTemplate(context); - bench("eco", function() { + bench('eco', function() { ecoTemplate(context); }); } else { - bench("eco", error); + bench('eco', error); } } @@ -90,11 +89,11 @@ function makeSuite(bench, name, template, handlebarsOnly) { if (mustacheSource) { mustacheOut = Mustache.to_html(mustacheSource, context, mustachePartials); - bench("mustache", function() { + bench('mustache', function() { Mustache.to_html(mustacheSource, context, mustachePartials); }); } else { - bench("mustache", error); + bench('mustache', error); } } diff --git a/bench/util/benchwarmer.js b/bench/util/benchwarmer.js index 7496a3e..78b1a34 100644 --- a/bench/util/benchwarmer.js +++ b/bench/util/benchwarmer.js @@ -1,7 +1,7 @@ var _ = require('underscore'), - Benchmark = require("benchmark"); + Benchmark = require('benchmark'); -var BenchWarmer = function(names) { +function BenchWarmer() { this.benchmarks = []; this.currentBenches = []; this.names = []; @@ -9,9 +9,9 @@ var BenchWarmer = function(names) { this.minimum = Infinity; this.maximum = -Infinity; this.errors = {}; -}; +} -var print = require("sys").print; +var print = require('sys').print; BenchWarmer.prototype = { winners: function(benches) { @@ -29,7 +29,7 @@ BenchWarmer.prototype = { }); }, push: function(name, fn) { - if(this.names.indexOf(name) == -1) { + if (this.names.indexOf(name) == -1) { this.names.push(name); } @@ -37,9 +37,9 @@ BenchWarmer.prototype = { this.first = false; var bench = new Benchmark(fn, { - name: this.suiteName + ": " + name, + name: this.suiteName + ': ' + name, onComplete: function() { - if(first) { self.startLine(suiteName); } + if (first) { self.startLine(suiteName); } self.writeBench(bench); self.currentBenches.push(bench); }, onError: function() { @@ -58,7 +58,7 @@ BenchWarmer.prototype = { this.printHeader('ops/msec', true); Benchmark.invoke(this.benchmarks, { - name: "run", + name: 'run', onComplete: function() { self.scaleTimes(); @@ -76,7 +76,7 @@ BenchWarmer.prototype = { print('\n'); var errors = false, prop, bench; - for(prop in self.errors) { + for (prop in self.errors) { if (self.errors.hasOwnProperty(prop) && self.errors[prop].error.message !== 'EWOT') { errors = true; @@ -84,18 +84,18 @@ BenchWarmer.prototype = { } } - if(errors) { - print("\n\nErrors:\n"); - for(prop in self.errors) { + if (errors) { + print('\n\nErrors:\n'); + for (prop in self.errors) { if (self.errors.hasOwnProperty(prop) && self.errors[prop].error.message !== 'EWOT') { bench = self.errors[prop]; - print("\n" + bench.name + ":\n"); + print('\n' + bench.name + ':\n'); print(bench.error.message); - if(bench.error.stack) { - print(bench.error.stack.join("\n")); + if (bench.error.stack) { + print(bench.error.stack.join('\n')); } - print("\n"); + print('\n'); } } } @@ -104,7 +104,7 @@ BenchWarmer.prototype = { } }); - print("\n"); + print('\n'); }, scaleTimes: function() { @@ -121,10 +121,10 @@ BenchWarmer.prototype = { printHeader: function(title, winners) { var benchSize = 0, names = this.names, i, l; - for(i=0, l=names.length; i<l; i++) { + for (i = 0, l = names.length; i < l; i++) { var name = names[i]; - if(benchSize < name.length) { benchSize = name.length; } + if (benchSize < name.length) { benchSize = name.length; } } this.nameSize = benchSize + 2; @@ -133,28 +133,28 @@ BenchWarmer.prototype = { this.startLine(title); horSize = horSize + this.benchSize; - for(i=0, l=names.length; i<l; i++) { + for (i = 0, l = names.length; i < l; i++) { this.writeValue(names[i]); horSize = horSize + this.benchSize; } if (winners) { - print("WINNER(S)"); - horSize = horSize + "WINNER(S)".length; + print('WINNER(S)'); + horSize = horSize + 'WINNER(S)'.length; } - print("\n" + new Array(horSize + 1).join("-")); + print('\n' + new Array(horSize + 1).join('-')); }, startLine: function(name) { var winners = Benchmark.map(this.winners(this.currentBenches), function(bench) { - return bench.name.split(": ")[1]; + return bench.name.split(': ')[1]; }); this.currentBenches = []; - print(winners.join(", ")); - print("\n"); + print(winners.join(', ')); + print('\n'); if (name) { this.writeValue(name); @@ -163,9 +163,9 @@ BenchWarmer.prototype = { writeBench: function(bench) { var out; - if(!bench.error) { + if (!bench.error) { var count = bench.hz, - moe = count * bench.stats.rme / 100, + moe = count * bench.stats.rme / 100, minimum, maximum; @@ -174,24 +174,22 @@ BenchWarmer.prototype = { minimum = count - moe; maximum = count + moe; - out = count + " ±" + moe + " (" + bench.cycles + ")"; + out = count + ' ±' + moe + ' (' + bench.cycles + ')'; this.times[bench.suiteName][bench.benchName] = count; this.minimum = Math.min(this.minimum, minimum); this.maximum = Math.max(this.maximum, maximum); + } else if (bench.error.message === 'EWOT') { + out = 'NA'; } else { - if (bench.error.message === 'EWOT') { - out = 'NA'; - } else { - out = 'E'; - } + out = 'E'; } this.writeValue(out); }, writeValue: function(out) { var padding = this.benchSize - out.length + 1; - out = out + new Array(padding).join(" "); + out = out + new Array(padding).join(' '); print(out); } }; diff --git a/bench/util/template-runner.js b/bench/util/template-runner.js index 8863ccd..b492ff3 100644 --- a/bench/util/template-runner.js +++ b/bench/util/template-runner.js @@ -22,6 +22,8 @@ module.exports = function(grunt, makeSuite, callback) { }); warmer.bench(function() { - callback && callback(warmer.times, warmer.scaled); + if (callback) { + callback(warmer.times, warmer.scaled); + } }); }; diff --git a/tasks/.eslintrc b/tasks/.eslintrc new file mode 100644 index 0000000..3461502 --- /dev/null +++ b/tasks/.eslintrc @@ -0,0 +1,16 @@ +{ + "globals": { + "require": true + }, + "rules": { + // Disabling for tests, for now. + "no-path-concat": 0, + + "no-var": 0, + "no-shadow": 0, + "handle-callback-err": 0, + "no-console": 0, + "no-process-env": 0, + "dot-notation": [2, {"allowKeywords": true}] + } +}
\ No newline at end of file diff --git a/tasks/metrics.js b/tasks/metrics.js index c4a202b..9044306 100644 --- a/tasks/metrics.js +++ b/tasks/metrics.js @@ -36,7 +36,7 @@ module.exports = function(grunt) { return done(); } - emit(keen, events, function(err, res) { + emit(keen, events, function(err) { if (err) { throw err; } diff --git a/tasks/parser.js b/tasks/parser.js index 47533ce..7ff7258 100644 --- a/tasks/parser.js +++ b/tasks/parser.js @@ -6,7 +6,7 @@ module.exports = function(grunt) { var cmd = './node_modules/.bin/jison'; - if(process.platform === 'win32'){ + if (process.platform === 'win32') { cmd = 'node_modules\\.bin\\jison.cmd'; } diff --git a/tasks/publish.js b/tasks/publish.js index 68b3157..55ea20a 100644 --- a/tasks/publish.js +++ b/tasks/publish.js @@ -60,7 +60,7 @@ module.exports = function(grunt) { async.forEach(_.keys(files), function(file, callback) { var params = {Bucket: bucket, Key: file, Body: grunt.file.read(files[file])}; - s3.putObject(params, function(err, data) { + s3.putObject(params, function(err) { if (err) { throw err; } else { diff --git a/tasks/util/git.js b/tasks/util/git.js index a6c9ec1..0380263 100644 --- a/tasks/util/git.js +++ b/tasks/util/git.js @@ -50,7 +50,7 @@ module.exports = { childProcess.exec('git rev-parse --short origin/master', {}, function(err, stdout) { // This will error if master was not checked out but in this case we know we are not master // so we can ignore. - if (err && !/Needed a single revision/.test(err.message)) { + if (err && !(/Needed a single revision/.test(err.message))) { throw new Error('git.master: ' + err.message); } @@ -59,7 +59,7 @@ module.exports = { }, add: function(path, callback) { - childProcess.exec('git add -f ' + path, {}, function(err, stdout) { + childProcess.exec('git add -f ' + path, {}, function(err) { if (err) { throw new Error('git.add: ' + err.message); } @@ -68,7 +68,7 @@ module.exports = { }); }, commit: function(name, callback) { - childProcess.exec('git commit --message=' + name, {}, function(err, stdout) { + childProcess.exec('git commit --message=' + name, {}, function(err) { if (err) { throw new Error('git.commit: ' + err.message); } @@ -77,7 +77,7 @@ module.exports = { }); }, tag: function(name, callback) { - childProcess.exec('git tag -a --message=' + name + ' ' + name, {}, function(err, stdout, stderr) { + childProcess.exec('git tag -a --message=' + name + ' ' + name, {}, function(err) { if (err) { throw new Error('git.tag: ' + err.message); } @@ -98,7 +98,7 @@ module.exports = { }); var versionTags = tags.filter(function(info) { - return /^v/.test(info[0]); + return (/^v/.test(info[0])); }); callback(undefined, versionTags[0] || tags[0]); diff --git a/tasks/version.js b/tasks/version.js index 3912266..8bc4d82 100644 --- a/tasks/version.js +++ b/tasks/version.js @@ -33,9 +33,9 @@ module.exports = function(grunt) { }); }); - function replace(path, regex, replace) { + function replace(path, regex, value) { var content = grunt.file.read(path); - content = content.replace(regex, replace); + content = content.replace(regex, value); grunt.file.write(path, content); } }; |