From ccaa2a6d50a275180dd55c3fc5dad3df98f29a20 Mon Sep 17 00:00:00 2001 From: Jay Adkisson Date: Sun, 1 Jul 2012 18:52:48 -0700 Subject: [PATCH] add jshint --- .jshintrc | 3 +++ Makefile | 7 ++++++- package.json | 3 ++- src/p.js | 8 ++++---- 4 files changed, 15 insertions(+), 6 deletions(-) create mode 100644 .jshintrc diff --git a/.jshintrc b/.jshintrc new file mode 100644 index 0000000..3619bff --- /dev/null +++ b/.jshintrc @@ -0,0 +1,3 @@ +{ + "trailing": true +} diff --git a/Makefile b/Makefile index 2043dcc..2f72268 100644 --- a/Makefile +++ b/Makefile @@ -39,11 +39,16 @@ report: $(UGLY) # -*- testing -*- # MOCHA ?= mocha +JSHINT ?= jshint TESTS = ./test/*.test.js .PHONY: test -test: $(COMMONJS) +test: jshint $(COMMONJS) $(MOCHA) $(TESTS) +.PHONY: jshint +jshint: + $(JSHINT) $(SRC) + # -*- packaging -*- # # XXX this is kind of awful, but hey, it keeps the version info in the right place. diff --git a/package.json b/package.json index c979632..002348a 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,8 @@ "main": "index.js", "devDependencies": { "mocha": "*", - "uglify-js": "*" + "uglify-js": "*", + "jshint": "*" }, "scripts": { "install": "make commonjs", diff --git a/src/p.js b/src/p.js index be4ae99..cbf56d6 100644 --- a/src/p.js +++ b/src/p.js @@ -1,4 +1,4 @@ -var P = (function(prototype, hasOwnProperty, undefined) { +var P = (function(prototype, ownProperty, undefined) { // helper functions that also help minification function isObject(o) { return typeof o === 'object'; } function isFunction(f) { return typeof f === 'function'; } @@ -46,7 +46,7 @@ var P = (function(prototype, hasOwnProperty, undefined) { // set up the prototype of the new class // note that this resolves to `new Object` // if the superclass isn't given - var proto = C[prototype] = new _superclass; + var proto = C[prototype] = new _superclass(); var _super = _superclass[prototype]; var extensions; @@ -66,7 +66,7 @@ var P = (function(prototype, hasOwnProperty, undefined) { // ...and extend it if (isObject(extensions)) { for (var ext in extensions) { - if (hasOwnProperty.call(extensions, ext)) { + if (ownProperty.call(extensions, ext)) { proto[ext] = extensions[ext]; } } @@ -79,7 +79,7 @@ var P = (function(prototype, hasOwnProperty, undefined) { } return C; - } + }; // set the constructor property, for convenience proto.constructor = C;