summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkpdecker <kpdecker@gmail.com>2013-12-01 15:40:08 -0600
committerkpdecker <kpdecker@gmail.com>2013-12-01 15:40:08 -0600
commitf17cb3ecac8f211c2e7952bae80385197863fd4f (patch)
tree0864a9b6252eaea0438bbc5c43c79e5649ebd2a4
parent86974b26604c54225c0b734bca0696fd4492f2d7 (diff)
downloadhandlebars.js-f17cb3ecac8f211c2e7952bae80385197863fd4f.zip
handlebars.js-f17cb3ecac8f211c2e7952bae80385197863fd4f.tar.gz
handlebars.js-f17cb3ecac8f211c2e7952bae80385197863fd4f.tar.bz2
Run jshint on output
Allows us to execute jshint in non-forced mode.
-rw-r--r--.jshintrc2
-rw-r--r--Gruntfile.js11
-rw-r--r--lib/handlebars.runtime.js1
-rw-r--r--lib/handlebars/base.js1
-rw-r--r--lib/handlebars/runtime.js1
-rw-r--r--lib/handlebars/utils.js1
-rw-r--r--package.json6
-rw-r--r--src/handlebars.l2
-rw-r--r--src/parser-prefix.js1
-rw-r--r--src/parser-suffix.js1
-rw-r--r--tasks/parser.js2
11 files changed, 15 insertions, 14 deletions
diff --git a/.jshintrc b/.jshintrc
index 851cf78..e0a55f7 100644
--- a/.jshintrc
+++ b/.jshintrc
@@ -3,7 +3,6 @@
"console",
"Ember",
"DS",
- "Handlebars",
"Metamorph",
"ember_assert",
"ember_warn",
@@ -22,6 +21,7 @@
"ok",
"strictEqual",
"module",
+ "define",
"describe",
"it",
diff --git a/Gruntfile.js b/Gruntfile.js
index fae5486..27e35c1 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -7,11 +7,10 @@ module.exports = function(grunt) {
jshint: {
options: {
- jshintrc: '.jshintrc',
- force: true
+ jshintrc: '.jshintrc'
},
files: [
- 'lib/**/!(parser).js'
+ 'dist/**/!(*.min|parser).js'
]
},
@@ -116,17 +115,17 @@ module.exports = function(grunt) {
// Build a new version of the library
this.registerTask('build', "Builds a distributable version of the current project", [
- 'jshint',
'clean',
'parser',
'node',
- 'globals']);
+ 'globals',
+ 'jshint']);
this.registerTask('amd', ['packager:amd', 'requirejs']);
this.registerTask('node', ['packager:cjs']);
this.registerTask('globals', ['packager:global']);
- this.registerTask('release', 'Build final packages', ['amd', 'uglify', 'copy:dist', 'copy:components', 'copy:cdnjs']);
+ this.registerTask('release', 'Build final packages', ['amd', 'jshint', 'uglify', 'copy:dist', 'copy:components', 'copy:cdnjs']);
// Load tasks from npm
grunt.loadNpmTasks('grunt-contrib-clean');
diff --git a/lib/handlebars.runtime.js b/lib/handlebars.runtime.js
index a591019..e77aae0 100644
--- a/lib/handlebars.runtime.js
+++ b/lib/handlebars.runtime.js
@@ -1,3 +1,4 @@
+/*globals Handlebars: true */
module base from "./handlebars/base";
// Each of these augment the Handlebars object. No need to setup here.
diff --git a/lib/handlebars/base.js b/lib/handlebars/base.js
index c22a70d..c068c70 100644
--- a/lib/handlebars/base.js
+++ b/lib/handlebars/base.js
@@ -1,4 +1,3 @@
-/*globals Exception, Utils */
module Utils from "./utils";
import Exception from "./exception";
diff --git a/lib/handlebars/runtime.js b/lib/handlebars/runtime.js
index fe5fef4..65fa85f 100644
--- a/lib/handlebars/runtime.js
+++ b/lib/handlebars/runtime.js
@@ -1,4 +1,3 @@
-/*global Utils */
module Utils from "./utils";
import Exception from "./exception";
import { COMPILER_REVISION, REVISION_CHANGES } from "./base";
diff --git a/lib/handlebars/utils.js b/lib/handlebars/utils.js
index 5b4852b..ed2e1d8 100644
--- a/lib/handlebars/utils.js
+++ b/lib/handlebars/utils.js
@@ -1,3 +1,4 @@
+/*jshint -W004 */
import SafeString from "./safe-string";
var escape = {
diff --git a/package.json b/package.json
index af6d6bc..36ae4ed 100644
--- a/package.json
+++ b/package.json
@@ -33,9 +33,10 @@
"dustjs-linkedin": "~2.0.2",
"eco": "~1.1.0-rc-3",
"grunt": "~0.4.1",
+ "grunt-cli": "~0.1.10",
"grunt-contrib-clean": "~0.4.1",
"grunt-contrib-copy": "~0.4.1",
- "grunt-contrib-jshint": "~0.6.3",
+ "grunt-contrib-jshint": "~0.7.2",
"grunt-contrib-requirejs": "~0.4.1",
"grunt-contrib-uglify": "~0.2.2",
"es6-module-packager": "~0.1.1",
@@ -45,8 +46,7 @@
"mustache": "~0.7.2",
"semver": "~2.1.0",
"should": "~1.2.2",
- "underscore": "~1.5.1",
- "grunt-cli": "~0.1.10"
+ "underscore": "~1.5.1"
},
"main": "lib/index.js",
"bin": {
diff --git a/src/handlebars.l b/src/handlebars.l
index ddb7fe9..cc46939 100644
--- a/src/handlebars.l
+++ b/src/handlebars.l
@@ -66,7 +66,7 @@ ID [^\s!"#%-,\.\/;->@\[-\^`\{-~]+/{LOOKAHEAD}
<mu>".." return 'ID';
<mu>"."/{LOOKAHEAD} return 'ID';
<mu>[\/.] return 'SEP';
-<mu>\s+ /*ignore whitespace*/
+<mu>\s+ // ignore whitespace
<mu>"}"{RIGHT_STRIP}?"}}" this.popState(); return 'CLOSE_UNESCAPED';
<mu>{RIGHT_STRIP}?"}}" this.popState(); return 'CLOSE';
<mu>'"'("\\"["]|[^"])*'"' yytext = strip(1,2).replace(/\\"/g,'"'); return 'STRING';
diff --git a/src/parser-prefix.js b/src/parser-prefix.js
new file mode 100644
index 0000000..685b6ec
--- /dev/null
+++ b/src/parser-prefix.js
@@ -0,0 +1 @@
+/* jshint ignore:start */
diff --git a/src/parser-suffix.js b/src/parser-suffix.js
index 6e4aa20..67e3348 100644
--- a/src/parser-suffix.js
+++ b/src/parser-suffix.js
@@ -1 +1,2 @@
export default handlebars;
+/* jshint ignore:end */
diff --git a/tasks/parser.js b/tasks/parser.js
index b1c1c0f..f6a72c6 100644
--- a/tasks/parser.js
+++ b/tasks/parser.js
@@ -12,7 +12,7 @@ module.exports = function(grunt) {
return;
}
- var src = ['handlebars.js', 'src/parser-suffix.js'].map(grunt.file.read).join('');
+ var src = ['src/parser-prefix.js', 'handlebars.js', 'src/parser-suffix.js'].map(grunt.file.read).join('');
grunt.file.delete('handlebars.js');
grunt.file.write('lib/handlebars/compiler/parser.js', src);