From b52606373a9cefa706671ebd972d92ab2b5cda7a Mon Sep 17 00:00:00 2001 From: Sebastian Tschan Date: Fri, 27 Nov 2015 13:21:10 +0100 Subject: [PATCH 01/82] Fix JSHint compatibility (consistent quotes, missing "use strict" statement). Also remove obsolete version numbers from individual files. --- .jshintrc | 2 +- css/demo.css | 2 +- index.html | 6 +++--- js/compile.js | 6 +++--- js/demo.js | 2 +- js/runtime.js | 4 ++-- js/tmpl.js | 6 +++--- test/index.html | 6 +++--- test/test.js | 2 +- 9 files changed, 18 insertions(+), 18 deletions(-) diff --git a/.jshintrc b/.jshintrc index 4ad82e6..6978c32 100644 --- a/.jshintrc +++ b/.jshintrc @@ -13,7 +13,7 @@ "noempty" : true, // true: Prohibit use of empty blocks "nonew" : true, // true: Prohibit use of constructors for side-effects (without assignment) "plusplus" : false, // true: Prohibit use of `++` & `--` - "quotmark" : "single", // Quotation mark consistency: + "quotmark" : true, // Quotation mark consistency: // false : do nothing (default) // true : ensure whatever is used is consistent // "single" : require single quotes diff --git a/css/demo.css b/css/demo.css index 186844a..9405f52 100644 --- a/css/demo.css +++ b/css/demo.css @@ -1,5 +1,5 @@ /* - * JavaScript Templates Demo CSS 2.4.0 + * JavaScript Templates Demo CSS * https://github.com/blueimp/JavaScript-Templates * * Copyright 2013, Sebastian Tschan diff --git a/index.html b/index.html index 01ed76c..275b3af 100644 --- a/index.html +++ b/index.html @@ -1,7 +1,7 @@ - + - + diff --git a/js/compile.js b/js/compile.js index 84ff2ce..0bf0144 100755 --- a/js/compile.js +++ b/js/compile.js @@ -1,6 +1,6 @@ #!/usr/bin/env node /* - * JavaScript Templates Compiler 2.4.0 + * JavaScript Templates Compiler * https://github.com/blueimp/JavaScript-Templates * * Copyright 2011, Sebastian Tschan @@ -53,7 +53,7 @@ if (index > 1) { stats = fs.statSync(file); if (!stats.isFile()) { - console.error(file + ' is not a file.'); + console.error(file + " is not a file."); return; } content = fs.readFileSync(file, "utf8"); @@ -74,7 +74,7 @@ } }); if (!list.length) { - console.error('Missing input file.'); + console.error("Missing input file."); return; } // Combine the generated functions as cache of the minimal runtime: diff --git a/js/demo.js b/js/demo.js index afcedc2..2862415 100644 --- a/js/demo.js +++ b/js/demo.js @@ -1,5 +1,5 @@ /* - * JavaScript Templates Demo JS 2.4.0 + * JavaScript Templates Demo * https://github.com/blueimp/JavaScript-Templates * * Copyright 2013, Sebastian Tschan diff --git a/js/runtime.js b/js/runtime.js index c4121fd..cb4c27e 100644 --- a/js/runtime.js +++ b/js/runtime.js @@ -1,5 +1,5 @@ /* - * JavaScript Templates Runtime 2.4.1 + * JavaScript Templates Runtime * https://github.com/blueimp/JavaScript-Templates * * Copyright 2011, Sebastian Tschan @@ -9,10 +9,10 @@ * http://www.opensource.org/licenses/MIT */ -/*jslint sloppy: true */ /*global define */ (function ($) { + "use strict"; var tmpl = function (id, data) { var f = tmpl.cache[id]; return data ? f(data, tmpl) : function (data) { diff --git a/js/tmpl.js b/js/tmpl.js index 9380053..90b9e42 100644 --- a/js/tmpl.js +++ b/js/tmpl.js @@ -1,5 +1,5 @@ /* - * JavaScript Templates 2.4.1 + * JavaScript Templates * https://github.com/blueimp/JavaScript-Templates * * Copyright 2011, Sebastian Tschan @@ -12,7 +12,7 @@ * http://ejohn.org/blog/javascript-micro-templating/ */ -/*jslint evil: true, regexp: true, unparam: true */ +/*jshint evil: true */ /*global document, define */ (function ($) { @@ -21,7 +21,7 @@ var f = !/[^\w\-\.:]/.test(str) ? tmpl.cache[str] = tmpl.cache[str] || tmpl(tmpl.load(str)) : new Function( - tmpl.arg + ',tmpl', + tmpl.arg + ",tmpl", "var _e=tmpl.encode" + tmpl.helper + ",_s='" + str.replace(tmpl.regexp, tmpl.func) + "';return _s;" diff --git a/test/index.html b/test/index.html index 9bdd78b..5be1e78 100644 --- a/test/index.html +++ b/test/index.html @@ -1,7 +1,7 @@ JavaScript Templates Demo - +

JavaScript Templates Demo

-

< 1KB lightweight, fast & powerful JavaScript templating engine with zero dependencies.
-Compatible with server-side environments like node.js, module loaders like RequireJS and all web browsers.

+

1KB lightweight, fast & powerful JavaScript templating engine with zero dependencies.
+Compatible with server-side environments like Node.js, module loaders like RequireJS, Browserify or webpack and all web browsers.