From 87bc42b53d9e9a7c035ce0c9dd49916e685285f5 Mon Sep 17 00:00:00 2001 From: Paul Armstrong Date: Tue, 25 Feb 2014 12:27:24 -0800 Subject: [PATCH] require es5 (no trailing commas) closes gh-428 --- bin/swig.js | 1 + lib/lexer.js | 2 +- scripts/config-lint.js | 6 +++--- tests/filters.test.js | 2 +- tests/tags/for.test.js | 2 +- tests/variables.test.js | 4 ++-- 6 files changed, 9 insertions(+), 8 deletions(-) diff --git a/bin/swig.js b/bin/swig.js index bdd03017..3240f661 100755 --- a/bin/swig.js +++ b/bin/swig.js @@ -1,4 +1,5 @@ #!/usr/bin/env node +/*jslint es5: true */ var swig = require('../index'), optimist = require('optimist'), diff --git a/lib/lexer.js b/lib/lexer.js index af165cce..75681acf 100644 --- a/lib/lexer.js +++ b/lib/lexer.js @@ -224,7 +224,7 @@ var TYPES = { { type: TYPES.DOTKEY, regex: [ - /^\.(\w+)/, + /^\.(\w+)/ ], idx: 1 }, diff --git a/scripts/config-lint.js b/scripts/config-lint.js index e8d79ef5..f8d50bc8 100644 --- a/scripts/config-lint.js +++ b/scripts/config-lint.js @@ -4,12 +4,12 @@ var options = { browser: false, cap: false, confusion: false, - continue: true, + 'continue': true, css: false, debug: false, devel: false, eqeq: false, - es5: true, + es5: false, evil: true, forin: false, fragment: false, @@ -24,7 +24,7 @@ var options = { plusplus: false, predef: [ // Mocha - 'describe', 'it', 'after', 'afterEach', 'before', 'beforeEach', + 'describe', 'it', 'after', 'afterEach', 'before', 'beforeEach' ], regexp: true, rhino: false, diff --git a/tests/filters.test.js b/tests/filters.test.js index 33f0396c..880d8993 100644 --- a/tests/filters.test.js +++ b/tests/filters.test.js @@ -111,7 +111,7 @@ var n = new Swig(), { c: 'v|default("tacos")', v: '', e: 'tacos' }, { c: 'v|default("tacos")', v: undefined, e: 'tacos' }, { c: 'v|default("tacos")', v: null, e: 'tacos' }, - { c: 'v|default("tacos")', v: false, e: 'tacos' }, + { c: 'v|default("tacos")', v: false, e: 'tacos' } ], 'escape': [ { c: 'v|escape', v: '', e: '<foo>' }, diff --git a/tests/tags/for.test.js b/tests/tags/for.test.js index 4189c3eb..a7d3c588 100644 --- a/tests/tags/for.test.js +++ b/tests/tags/for.test.js @@ -25,7 +25,7 @@ var cases = [ { input: '{% for a,b in b %}{{ a }}{{ b }}{% endfor %}', out: '011223' }, { input: '{% for a, b in c %}{{ b }}{% endfor %}', out: 'applebanana' }, { input: '{% for a in d|default(["a"]) %}{{ a }}{% endfor %}', out: 'a' }, - { input: '{% for a in q %}hi{% endfor %}', out: '' }, + { input: '{% for a in q %}hi{% endfor %}', out: '' } ]; describe('Tag: for', function () { diff --git a/tests/variables.test.js b/tests/variables.test.js index 340bf386..d89d09ac 100644 --- a/tests/variables.test.js +++ b/tests/variables.test.js @@ -29,7 +29,7 @@ var cases = { { c: '{{ a * 3 }}', e: '3' }, { c: '{{ a / 3 }}', e: String(1 / 3) }, { c: '{{ 3 - a }}', e: '2' }, - { c: '{{ a % 3 }}', e: '1' }, + { c: '{{ a % 3 }}', e: '1' } ], 'can include objects': [ { c: '{{ {0: 1, a: "b"} }}', e: '[object Object]' }, @@ -65,7 +65,7 @@ var cases = { 'can use both notation types': [ { c: '{{ food.a }}', e: 'tacos' }, { c: '{{ food["a"] }}', e: 'tacos' }, - { c: '{{ g[0][h.g.i]["c"].b[i] }}', e: 'hi!' }, + { c: '{{ g[0][h.g.i]["c"].b[i] }}', e: 'hi!' } ], 'can do some logical operations': [ { c: '{{ ap === "apples" }}', e: 'true' },